Skip to content

Commit fb49109

Browse files
author
Virginia Fernandez
committed
autofix run
Signed-off-by: Virginia Fernandez <virginia.fernandez@kcl.ac.uk>
1 parent 3e34a8f commit fb49109

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

monai/losses/perceptual.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ def forward(self, input: torch.Tensor, target: torch.Tensor) -> torch.Tensor:
202202
target: the shape should be BNHW[D].
203203
"""
204204
if target.shape != input.shape:
205-
raise ValueError(f"ground truth has differing shape ({target.shape}) from input ({input.shape})", stacklevel=2)
205+
raise ValueError(
206+
f"ground truth has differing shape ({target.shape}) from input ({input.shape})", stacklevel=2
207+
)
206208

207209
if self.spatial_dims == 3 and self.is_fake_3d:
208210
# Compute 2.5D approach
@@ -246,7 +248,9 @@ def __init__(
246248
) -> None:
247249
super().__init__()
248250
if net not in HF_MONAI_MODELS:
249-
raise ValueError(f"Invalid download model name '{net}'. Must be one of: {', '.join(HF_MONAI_MODELS)}.", stacklevel=2)
251+
raise ValueError(
252+
f"Invalid download model name '{net}'. Must be one of: {', '.join(HF_MONAI_MODELS)}.", stacklevel=2
253+
)
250254

251255
self.model = torch.hub.load(
252256
"Project-MONAI/perceptual-models:main", model=net, verbose=verbose, cache_dir=cache_dir, trust_repo=True
@@ -340,7 +344,9 @@ class RadImageNetPerceptualSimilarity(nn.Module):
340344
def __init__(self, net: str = "radimagenet_resnet50", verbose: bool = False, cache_dir: str | None = None) -> None:
341345
super().__init__()
342346
if net not in HF_MONAI_MODELS:
343-
raise ValueError(f"Invalid download model name '{net}'. Must be one of: {', '.join(HF_MONAI_MODELS)}.", stacklevel=2)
347+
raise ValueError(
348+
f"Invalid download model name '{net}'. Must be one of: {', '.join(HF_MONAI_MODELS)}.", stacklevel=2
349+
)
344350
self.model = torch.hub.load(
345351
"Project-MONAI/perceptual-models:main", model=net, verbose=verbose, cache_dir=cache_dir, trust_repo=True
346352
)
@@ -410,8 +416,7 @@ def __init__(
410416
supported_networks = ["resnet50"]
411417
if net not in supported_networks:
412418
raise NotImplementedError(
413-
f"'net' {net} is not supported, please select a network from {supported_networks}.",
414-
stacklevel=2,
419+
f"'net' {net} is not supported, please select a network from {supported_networks}.", stacklevel=2
415420
)
416421

417422
if pretrained_path is None:

0 commit comments

Comments
 (0)