Skip to content

Commit 5e9bffa

Browse files
authored
Apply suggestion from @ericspod
Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
1 parent f2b3c71 commit 5e9bffa

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

monai/losses/image_dissimilarity.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ def parzen_windowing_gaussian(self, img: torch.Tensor) -> tuple[torch.Tensor, to
321321
img = torch.clamp(img, 0, 1)
322322
img = img.reshape(img.shape[0], -1, 1) # (batch, num_sample, 1)
323323
if self.bin_centers is None:
324-
raise ValueError("bin_centers must be defined for gaussian parzen windowing.")
324+
if self.bin_centers is None or self.preterm is None:
325+
raise ValueError("bin_centers and preterm must be defined for gaussian parzen windowing.")
325326
weight = torch.exp(
326327
-self.preterm.to(img) * (img - self.bin_centers.to(img)) ** 2
327328
) # (batch, num_sample, num_bin)

0 commit comments

Comments
 (0)