Skip to content

Commit d6a12af

Browse files
bottlerfacebook-github-bot
authored andcommitted
Pointclouds.subsample on Windows
Summary: Fix #1015. Stop relying on the fact that the dtype returned by np.random.choice (int64 on Linux, int32 on Windows) matches the dtype used by pytorch for indexing (int64 everywhere). Reviewed By: patricklabatut Differential Revision: D33428680 fbshipit-source-id: 716c857502cd54c563cb256f0eaca7dccd535c10
1 parent 49f93b6 commit d6a12af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pytorch3d/structures/pointclouds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ def subsample(self, max_points: Union[int, Sequence[int]]) -> "Pointclouds":
891891
):
892892
if n_points > max_:
893893
keep_np = np.random.choice(n_points, max_, replace=False)
894-
keep = torch.tensor(keep_np).to(points.device)
894+
keep = torch.tensor(keep_np, device=points.device, dtype=torch.int64)
895895
points = points[keep]
896896
if features is not None:
897897
features = features[keep]

0 commit comments

Comments
 (0)