removed defaulting to base pixel sampler with mask

This commit is contained in:
AdamRashid96 committed 2023-08-01 23:01:23 +00:00
1 parent 64ca0020e3
commit a2f7599d17
1 file changed
+4 -3
+4 -3
View File
@@ -318,8 +318,8 @@ class PatchPixelSampler(PixelSampler):
device: Union[torch.device, str] = "cpu", device: Union[torch.device, str] = "cpu",
) -> Int[Tensor, "batch_size 3"]: ) -> Int[Tensor, "batch_size 3"]:
if isinstance(mask, Tensor): if isinstance(mask, Tensor):
# Note: if there is a mask, sampling reduces back to uniform sampling # Note: if there is a mask, should switch to the base PixelSampler class
indices = super().sample_method(batch_size, num_images, image_height, image_width, mask=mask, device=device) raise NotImplementedError()
else: else:
sub_bs = batch_size // (self.config.patch_size**2) sub_bs = batch_size // (self.config.patch_size**2)
indices = torch.rand((sub_bs, 3), device=device) * torch.tensor( indices = torch.rand((sub_bs, 3), device=device) * torch.tensor(
@@ -380,7 +380,8 @@ class PairPixelSampler(PixelSampler): # pylint: disable=too-few-public-methods
device: Union[torch.device, str] = "cpu", device: Union[torch.device, str] = "cpu",
) -> Int[Tensor, "batch_size 3"]: ) -> Int[Tensor, "batch_size 3"]:
if mask: if mask:
# Note: if there is a mask, sampling reduces back to uniform sampling # Note: if there is a mask, should switch to the base PixelSampler class
raise NotImplementedError() raise NotImplementedError()
else: else:
s = (self.rays_to_sample, 1) s = (self.rays_to_sample, 1)