From 818e161ec5394e3e6edad816a18287a08393e8c8 Mon Sep 17 00:00:00 2001 From: yaookyie Date: Mon, 7 Feb 2022 13:05:25 -0500 Subject: [PATCH] fixed scatter runtime error: size of index should be smaller than src --- pytorch3d/ops/cubify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch3d/ops/cubify.py b/pytorch3d/ops/cubify.py index b51051343..f18a90aae 100644 --- a/pytorch3d/ops/cubify.py +++ b/pytorch3d/ops/cubify.py @@ -224,7 +224,7 @@ def cubify(voxels, thresh, device=None, align: str = "topleft") -> Meshes: grid_faces += nyxz[:, 0].view(-1, 1) * num_verts idleverts = torch.ones(num_verts * N, dtype=torch.uint8, device=device) - idleverts.scatter_(0, grid_faces.flatten(), 0) + idleverts.scatter_(0, grid_faces.flatten().unique(), 0) grid_faces -= nyxz[:, 0].view(-1, 1) * num_verts split_size = torch.bincount(nyxz[:, 0], minlength=N) faces_list = list(torch.split(grid_faces, split_size.tolist(), 0))