From f13086779de9d3b12ddb584a341c99e19c1748ef Mon Sep 17 00:00:00 2001 From: Jeremy Reizenstein Date: Thu, 13 Oct 2022 14:37:46 -0700 Subject: [PATCH] avoid torch.range Summary: Avoid unintended use of torch.range. Reviewed By: kjchalup Differential Revision: D40341396 fbshipit-source-id: 108295983afdec0ca9e43178fef9c65695150bc1 --- pytorch3d/renderer/implicit/raysampling.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytorch3d/renderer/implicit/raysampling.py b/pytorch3d/renderer/implicit/raysampling.py index ac08b972..36351d0c 100644 --- a/pytorch3d/renderer/implicit/raysampling.py +++ b/pytorch3d/renderer/implicit/raysampling.py @@ -207,7 +207,7 @@ class MultinomialRaysampler(torch.nn.Module): n_rays_per_image, ) = _sample_cameras_and_masks(n_rays_total, cameras, mask) else: - camera_ids = torch.range(0, len(cameras), dtype=torch.long) + camera_ids = torch.arange(len(cameras), dtype=torch.long) batch_size = cameras.R.shape[0] device = cameras.device @@ -438,7 +438,7 @@ class MonteCarloRaysampler(torch.nn.Module): n_rays_per_image, ) = _sample_cameras_and_masks(self._n_rays_total, cameras, None) else: - camera_ids = torch.range(0, len(cameras), dtype=torch.long) + camera_ids = torch.arange(len(cameras), dtype=torch.long) n_rays_per_image = self._n_rays_per_image batch_size = cameras.R.shape[0]