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)