Skip to content

Commit af83422

Browse files
committed
style: reformat with black 25.11.0
Signed-off-by: Rusheel Sharma <rusheelhere@gmail.com>
1 parent f01cbc4 commit af83422

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

monai/losses/dice.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,11 @@ def forward(self, input: torch.Tensor, target: torch.Tensor) -> torch.Tensor:
214214
self.class_weight = torch.as_tensor([self.class_weight] * num_of_classes)
215215
else:
216216
if self.class_weight.shape[0] != num_of_classes:
217-
raise ValueError("""the length of the `weight` sequence should be the same as the number of classes.
217+
raise ValueError(
218+
"""the length of the `weight` sequence should be the same as the number of classes.
218219
If `include_background=False`, the weight should not include
219-
the background category class 0.""")
220+
the background category class 0."""
221+
)
220222
if self.class_weight.min() < 0:
221223
raise ValueError("the value/values of the `weight` should be no less than 0.")
222224
# apply class_weight to loss

monai/losses/focal_loss.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,11 @@ def forward(self, input: torch.Tensor, target: torch.Tensor) -> torch.Tensor:
191191
self.class_weight = torch.as_tensor([self.class_weight] * num_of_classes)
192192
else:
193193
if self.class_weight.shape[0] != num_of_classes:
194-
raise ValueError("""the length of the `weight` sequence should be the same as the number of classes.
194+
raise ValueError(
195+
"""the length of the `weight` sequence should be the same as the number of classes.
195196
If `include_background=False`, the weight should not include
196-
the background category class 0.""")
197+
the background category class 0."""
198+
)
197199
if self.class_weight.min() < 0:
198200
raise ValueError("the value/values of the `weight` should be no less than 0.")
199201
# apply class_weight to loss

0 commit comments

Comments
 (0)