Skip to content

Commit a445cf6

Browse files
author
Egemen Yiğit Kömürcü
authored
.dense fix cuda cpu mismatch (#319)
1 parent c4470e2 commit a445cf6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

MinkowskiEngine/MinkowskiSparseTensor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def dense(self, shape=None, min_coordinate=None, contract_stride=True):
492492
shape = torch.Size([shape[0], self._F.size(1), *[s for s in shape[2:]]])
493493

494494
# Use int tensor for all operations
495-
tensor_stride = torch.IntTensor(self.tensor_stride)
495+
tensor_stride = torch.IntTensor(self.tensor_stride).to(self.device)
496496

497497
# New coordinates
498498
batch_indices = self.C[:, 0]
@@ -527,7 +527,7 @@ def dense(self, shape=None, min_coordinate=None, contract_stride=True):
527527
nchannels = self.F.size(1)
528528
if shape is None:
529529
size = coords.max(0)[0] + 1
530-
shape = torch.Size([batch_indices.max() + 1, nchannels, *size.numpy()])
530+
shape = torch.Size([batch_indices.max() + 1, nchannels, *size.cpu().numpy()])
531531

532532
dense_F = torch.zeros(shape, dtype=self.F.dtype, device=self.F.device)
533533

0 commit comments

Comments
 (0)