Skip to content

Commit ff4bc92

Browse files
committed
fix error: incompatible types in assignment
Signed-off-by: ytl0623 <david89062388@gmail.com>
1 parent 8d887a5 commit ff4bc92

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

monai/metrics/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from collections.abc import Iterable, Sequence
1616
from functools import cache, partial
1717
from types import ModuleType
18-
from typing import Any, overload
18+
from typing import Any, cast, overload
1919

2020
import numpy as np
2121
import torch
@@ -79,14 +79,14 @@ def ignore_background(
7979

8080
y_pred_out = y_pred
8181
if y_pred.shape[1] > 1:
82-
y_pred_out = y_pred[:, 1:]
82+
y_pred_out = cast(NdarrayTensor, y_pred[:, 1:])
8383

8484
if y is None:
8585
return y_pred_out
8686

8787
y_out = y
8888
if y.shape[1] > 1:
89-
y_out = y[:, 1:]
89+
y_out = cast(NdarrayTensor, y[:, 1:])
9090

9191
return y_pred_out, y_out
9292

0 commit comments

Comments
 (0)