From fa6f27975146045d066a7123144e5a15098b7da7 Mon Sep 17 00:00:00 2001 From: dozeri83 <109915435+dozeri83@users.noreply.github.com> Date: Mon, 2 Jan 2023 02:14:55 +0200 Subject: [PATCH] fixed an exception bug in case of num_samples is 0 (#1198) fixed an exception bug when num samples is 0 , "IndexError tensors used as indices must be long, byte or bool tensors" change type to long ( was float32) --- nerfstudio/model_components/ray_samplers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nerfstudio/model_components/ray_samplers.py b/nerfstudio/model_components/ray_samplers.py index 40a848ed3..89a238c72 100644 --- a/nerfstudio/model_components/ray_samplers.py +++ b/nerfstudio/model_components/ray_samplers.py @@ -472,7 +472,7 @@ class VolumetricSampler(Sampler): if num_samples == 0: # create a single fake sample and update packed_info accordingly # this says the last ray in packed_info has 1 sample, which starts and ends at 1 - ray_indices = torch.zeros((1,), dtype=starts.dtype, device=rays_o.device) + ray_indices = torch.zeros((1,), dtype=torch.long, device=rays_o.device) starts = torch.ones((1, 1), dtype=starts.dtype, device=rays_o.device) ends = torch.ones((1, 1), dtype=ends.dtype, device=rays_o.device)