From 4c3da18987f8ffb73a4e4ea0c17ba3861fd37aa8 Mon Sep 17 00:00:00 2001 From: benmalef Date: Sun, 6 Oct 2024 13:36:43 +0300 Subject: [PATCH] update dynunet_wrapper.py - change raise ValueError with assert --- GANDLF/models/dynunet_wrapper.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/GANDLF/models/dynunet_wrapper.py b/GANDLF/models/dynunet_wrapper.py index f6293c418..176596bee 100644 --- a/GANDLF/models/dynunet_wrapper.py +++ b/GANDLF/models/dynunet_wrapper.py @@ -24,10 +24,9 @@ def get_kernels_strides(sizes, spacings): if all(s == 1 for s in stride): break for idx, (i, j) in enumerate(zip(sizes, stride)): - if i % j != 0: - raise ValueError( - f"Patch size is not supported, please try to modify the size {input_size[idx]} in the spatial dimension {idx}." - ) + assert ( + i % j == 0 + ), f"Patch size is not supported, please try to modify the size {input_size[idx]} in the spatial dimension {idx}." sizes = [i / j for i, j in zip(sizes, stride)] spacings = [i * j for i, j in zip(spacings, stride)] kernels.append(kernel)