Skip to content

Commit 642a9e0

Browse files
authored
Quick fix for mask None check (#1193)
quick fix
1 parent 028df82 commit 642a9e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nerfstudio/data/pixel_samplers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def sample_method( # pylint: disable=no-self-use
6161
num_images: number of images to sample over
6262
mask: mask of possible pixels in an image to sample from.
6363
"""
64-
if mask:
64+
if isinstance(mask, torch.Tensor):
6565
nonzero_indices = torch.nonzero(mask[..., 0], as_tuple=False)
6666
chosen_indices = random.sample(range(len(nonzero_indices)), k=batch_size)
6767
indices = nonzero_indices[chosen_indices]
@@ -222,7 +222,7 @@ def sample_method( # pylint: disable=no-self-use
222222
device: Union[torch.device, str] = "cpu",
223223
) -> TensorType["batch_size", 3]:
224224

225-
if mask:
225+
if isinstance(mask, torch.Tensor):
226226
# Note: if there is a mask, sampling reduces back to uniform sampling, which gives more
227227
# sampling weight to the poles of the image than the equators.
228228
# TODO(kevinddchen): implement the correct mask-sampling method.

0 commit comments

Comments
 (0)