fix config.pixel_sampler check

This commit is contained in:
AdamRashid96 committed 2023-08-03 21:06:14 +00:00
1 parent 745d2b1423
commit 4ceae420a6
2 files changed
+1 -3

No files matched your search

@@ -461,7 +461,7 @@ class VanillaDataManager(DataManager, Generic[TDataset]):
def _get_pixel_sampler(self, dataset: TDataset, num_rays_per_batch: int) -> PixelSampler: def _get_pixel_sampler(self, dataset: TDataset, num_rays_per_batch: int) -> PixelSampler:
"""Infer pixel sampler to use.""" """Infer pixel sampler to use."""
if self.config.patch_size > 1 and isinstance(self.config.pixel_sampler, PixelSamplerConfig): if self.config.patch_size > 1 and type(self.config.pixel_sampler) is PixelSamplerConfig:
return PatchPixelSamplerConfig().setup( return PatchPixelSamplerConfig().setup(
patch_size=self.config.patch_size, num_rays_per_batch=num_rays_per_batch patch_size=self.config.patch_size, num_rays_per_batch=num_rays_per_batch
) )
-2
View File
@@ -318,7 +318,6 @@ 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, should switch to the base PixelSampler class
raise NotImplementedError( raise NotImplementedError(
"Masked sampling not implemented for PairPixelSampler. Change Config to PixelSamplerConfig instead." "Masked sampling not implemented for PairPixelSampler. Change Config to PixelSamplerConfig instead."
) )
@@ -382,7 +381,6 @@ 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 isinstance(mask, Tensor): if isinstance(mask, Tensor):
# Note: if there is a mask, should switch to the base PixelSampler class
raise NotImplementedError( raise NotImplementedError(
"Masked sampling not implemented for PairPixelSampler. Change Config to PixelSamplerConfig instead." "Masked sampling not implemented for PairPixelSampler. Change Config to PixelSamplerConfig instead."
) )