Skip to content

Commit e515686

Browse files
committed
fixed a bug and added a unbatched coordinate indices
1 parent 51f54b3 commit e515686

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/py_utils/utils_minkowski.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ def A_occupied_by_B(A, B):
204204
return mask
205205

206206
if isinstance(A, torch.Tensor) and isinstance(B, torch.Tensor):
207+
a_idx, _ = sparse_tensor_map(A, B)
207208
mask = torch.zeros(len(A), dtype=bool, device=A.device)
208209
mask[a_idx] = True
209210
return mask
@@ -538,6 +539,15 @@ def numpy_to_sparse_tensor(coord, feat, device, coordinate_manager):
538539
return torch_to_sparse_tensor(coord, feat, device, coordinate_manager)
539540

540541

542+
def unbatched_coordinates_indices(coord, num_batch):
543+
544+
indices = []
545+
for b in range(num_batch):
546+
I = torch.nonzero(coord[:, 0] == b)[:, 0]
547+
indices.append(I)
548+
return indices
549+
550+
541551
def unbatch_sparse_tensor(sparse_tensor, num_batch):
542552

543553
if sparse_tensor is None:

0 commit comments

Comments
 (0)