Skip to content

Commit bb2e141

Browse files
committed
convert error to warning
Signed-off-by: Richard Brown <[email protected]>
1 parent 5c430ab commit bb2e141

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

monai/data/test_time_augmentation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# See the License for the specific language governing permissions and
1010
# limitations under the License.
1111

12+
import warnings
1213
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
1314

1415
import numpy as np
@@ -100,13 +101,13 @@ def _check_transforms(self):
100101
invertibles = np.array([isinstance(t, InvertibleTransform) for t in ts])
101102
# check at least 1 random
102103
if sum(randoms) == 0:
103-
raise RuntimeError(
104+
warnings.warn(
104105
"Requires a `Randomizable` transform or a `Compose` containing at least one `Randomizable` transform."
105106
)
106107
# check that whenever randoms is True, invertibles is also true
107108
for r, i in zip(randoms, invertibles):
108109
if r and not i:
109-
raise RuntimeError(
110+
warnings.warn(
110111
f"All applied random transform(s) must be invertible. Problematic transform: {type(r).__name__}"
111112
)
112113

0 commit comments

Comments
 (0)