From 28ab77c890af1be031d198c0cf1978ceaf076f59 Mon Sep 17 00:00:00 2001 From: Talhax55z Date: Tue, 31 Mar 2026 19:45:01 +0500 Subject: [PATCH 1/8] Docs: add spatial shape constraints to SegResNetDS docstring (fixes #6771) --- monai/networks/nets/segresnet_ds.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/monai/networks/nets/segresnet_ds.py b/monai/networks/nets/segresnet_ds.py index 36afe71c5c..12c21c4a9e 100644 --- a/monai/networks/nets/segresnet_ds.py +++ b/monai/networks/nets/segresnet_ds.py @@ -254,6 +254,21 @@ class SegResNetDS(nn.Module): image spacing into an approximately isotropic space. Otherwise, by default, the kernel size and downsampling is always isotropic. + Spatial shape constraints: + The input spatial dimensions must be divisible by ``2 ** (len(blocks_down) - 1)``. + With the default ``blocks_down=(1, 2, 2, 4)`` (4 levels), each spatial dimension + must be divisible by 8. + + Use :py:meth:`shape_factor` to query the required divisors for a given configuration, + and :py:meth:`is_valid_shape` to check whether a specific input tensor satisfies them. + + Example:: + + model = SegResNetDS(spatial_dims=3, blocks_down=(1, 2, 2, 4)) + print(model.shape_factor()) # [8, 8, 8] + # Valid input: shape (1, 1, 128, 128, 128) -- all dims divisible by 8 + # Invalid input: shape (1, 1, 100, 100, 100) -- 100 is not divisible by 8 + """ def __init__( From 584c915cfe5b4c6ea5981721c20fb5670ea7d57b Mon Sep 17 00:00:00 2001 From: Talhax55z Date: Tue, 31 Mar 2026 23:10:51 +0500 Subject: [PATCH 2/8] Docs: condition shape constraints on isotropic/anisotropic mode --- monai/networks/nets/segresnet_ds.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/monai/networks/nets/segresnet_ds.py b/monai/networks/nets/segresnet_ds.py index 12c21c4a9e..fab9032344 100644 --- a/monai/networks/nets/segresnet_ds.py +++ b/monai/networks/nets/segresnet_ds.py @@ -255,19 +255,23 @@ class SegResNetDS(nn.Module): Otherwise, by default, the kernel size and downsampling is always isotropic. Spatial shape constraints: - The input spatial dimensions must be divisible by ``2 ** (len(blocks_down) - 1)``. - With the default ``blocks_down=(1, 2, 2, 4)`` (4 levels), each spatial dimension - must be divisible by 8. + If ``resolution is None`` (isotropic downsampling), each input spatial dimension + must be divisible by ``2 ** (len(blocks_down) - 1)``. + With the default ``blocks_down=(1, 2, 2, 4)`` (4 levels), each spatial dimension + must be divisible by 8. - Use :py:meth:`shape_factor` to query the required divisors for a given configuration, - and :py:meth:`is_valid_shape` to check whether a specific input tensor satisfies them. + If ``resolution`` is provided, divisibility can differ by dimension based on + anisotropic scales; use :py:meth:`shape_factor` for the exact required factors. - Example:: + Use :py:meth:`shape_factor` to query the required divisors for a given configuration, + and :py:meth:`is_valid_shape` to check whether a specific input tensor satisfies them. - model = SegResNetDS(spatial_dims=3, blocks_down=(1, 2, 2, 4)) - print(model.shape_factor()) # [8, 8, 8] - # Valid input: shape (1, 1, 128, 128, 128) -- all dims divisible by 8 - # Invalid input: shape (1, 1, 100, 100, 100) -- 100 is not divisible by 8 + Example:: + + model = SegResNetDS(spatial_dims=3, blocks_down=(1, 2, 2, 4)) + print(model.shape_factor()) # [8, 8, 8] + # Valid input: shape (1, 1, 128, 128, 128) -- all dims divisible by 8 + # Invalid input: shape (1, 1, 100, 100, 100) -- 100 is not divisible by 8 """ From e72de42f1638c0cc2512980aeb110803d77a75c0 Mon Sep 17 00:00:00 2001 From: Talhax55z Date: Wed, 1 Apr 2026 19:07:06 +0500 Subject: [PATCH 3/8] Docs: add spatial shape constraints to SegResNetDS docstring (fixes #6771) Signed-off-by: Talhax55z From 0259f667a7791448d9e10e07ff424b26098de344 Mon Sep 17 00:00:00 2001 From: Talhax55z Date: Wed, 1 Apr 2026 19:11:27 +0500 Subject: [PATCH 4/8] DCO Remediation Commit for Talhax55z I, Talhax55z , hereby add my Signed-off-by to this commit: 28ab77c890af1be031d198c0cf1978ceaf076f59 I, Talhax55z , hereby add my Signed-off-by to this commit: 584c915cfe5b4c6ea5981721c20fb5670ea7d57b Signed-off-by: Talhax55z From 497ca39c40073792dcf0f566a13b9858989ea0e0 Mon Sep 17 00:00:00 2001 From: Talhax55z Date: Thu, 2 Apr 2026 18:26:25 +0500 Subject: [PATCH 5/8] Docs: fix RST formatting in SegResNetDS spatial shape constraints --- monai/networks/nets/segresnet_ds.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/monai/networks/nets/segresnet_ds.py b/monai/networks/nets/segresnet_ds.py index fab9032344..2b43c09045 100644 --- a/monai/networks/nets/segresnet_ds.py +++ b/monai/networks/nets/segresnet_ds.py @@ -254,24 +254,20 @@ class SegResNetDS(nn.Module): image spacing into an approximately isotropic space. Otherwise, by default, the kernel size and downsampling is always isotropic. - Spatial shape constraints: - If ``resolution is None`` (isotropic downsampling), each input spatial dimension - must be divisible by ``2 ** (len(blocks_down) - 1)``. - With the default ``blocks_down=(1, 2, 2, 4)`` (4 levels), each spatial dimension - must be divisible by 8. - - If ``resolution`` is provided, divisibility can differ by dimension based on - anisotropic scales; use :py:meth:`shape_factor` for the exact required factors. - - Use :py:meth:`shape_factor` to query the required divisors for a given configuration, - and :py:meth:`is_valid_shape` to check whether a specific input tensor satisfies them. + .. note:: + **Spatial shape constraints**: If ``resolution`` is ``None`` (isotropic mode), + each spatial dimension must be divisible by ``2 ** (len(blocks_down) - 1)``. + With the default ``blocks_down=(1, 2, 2, 4)``, each dimension must be + divisible by 8. If ``resolution`` is provided (anisotropic mode), + divisibility can differ per dimension; use :py:meth:`shape_factor` for + the exact required factors and :py:meth:`is_valid_shape` to verify a shape. Example:: model = SegResNetDS(spatial_dims=3, blocks_down=(1, 2, 2, 4)) print(model.shape_factor()) # [8, 8, 8] - # Valid input: shape (1, 1, 128, 128, 128) -- all dims divisible by 8 - # Invalid input: shape (1, 1, 100, 100, 100) -- 100 is not divisible by 8 + print(model.is_valid_shape((1, 1, 128, 128, 128))) # True + print(model.is_valid_shape((1, 1, 100, 100, 100))) # False """ From ee7c98711c3eaf9534a6e734e1e6b4648b670a03 Mon Sep 17 00:00:00 2001 From: Talhax55z Date: Thu, 2 Apr 2026 23:25:15 +0500 Subject: [PATCH 6/8] Docs: fix RST note directive formatting in SegResNetDS docstring --- monai/networks/nets/segresnet_ds.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/monai/networks/nets/segresnet_ds.py b/monai/networks/nets/segresnet_ds.py index 2b43c09045..5878d0f1de 100644 --- a/monai/networks/nets/segresnet_ds.py +++ b/monai/networks/nets/segresnet_ds.py @@ -255,19 +255,20 @@ class SegResNetDS(nn.Module): Otherwise, by default, the kernel size and downsampling is always isotropic. .. note:: - **Spatial shape constraints**: If ``resolution`` is ``None`` (isotropic mode), - each spatial dimension must be divisible by ``2 ** (len(blocks_down) - 1)``. - With the default ``blocks_down=(1, 2, 2, 4)``, each dimension must be - divisible by 8. If ``resolution`` is provided (anisotropic mode), - divisibility can differ per dimension; use :py:meth:`shape_factor` for - the exact required factors and :py:meth:`is_valid_shape` to verify a shape. - - Example:: - - model = SegResNetDS(spatial_dims=3, blocks_down=(1, 2, 2, 4)) - print(model.shape_factor()) # [8, 8, 8] - print(model.is_valid_shape((1, 1, 128, 128, 128))) # True - print(model.is_valid_shape((1, 1, 100, 100, 100))) # False + + **Spatial shape constraints**: If ``resolution`` is ``None`` (isotropic mode), + each spatial dimension must be divisible by ``2 ** (len(blocks_down) - 1)``. + With the default ``blocks_down=(1, 2, 2, 4)``, each dimension must be + divisible by 8. If ``resolution`` is provided (anisotropic mode), + divisibility can differ per dimension; use :py:meth:`shape_factor` for + the exact required factors and :py:meth:`is_valid_shape` to verify a shape. + + Example:: + + model = SegResNetDS(spatial_dims=3, blocks_down=(1, 2, 2, 4)) + print(model.shape_factor()) # [8, 8, 8] + print(model.is_valid_shape((1, 1, 128, 128, 128))) # True + print(model.is_valid_shape((1, 1, 100, 100, 100))) # False """ From 9e1c8b94be3dd796f06630e27f3db392369da377 Mon Sep 17 00:00:00 2001 From: Talhax55z Date: Fri, 3 Apr 2026 12:51:18 +0500 Subject: [PATCH 7/8] Docs: remove note directive, use plain bold text for shape constraints --- monai/networks/nets/segresnet_ds.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/monai/networks/nets/segresnet_ds.py b/monai/networks/nets/segresnet_ds.py index 5878d0f1de..a511989353 100644 --- a/monai/networks/nets/segresnet_ds.py +++ b/monai/networks/nets/segresnet_ds.py @@ -254,8 +254,6 @@ class SegResNetDS(nn.Module): image spacing into an approximately isotropic space. Otherwise, by default, the kernel size and downsampling is always isotropic. - .. note:: - **Spatial shape constraints**: If ``resolution`` is ``None`` (isotropic mode), each spatial dimension must be divisible by ``2 ** (len(blocks_down) - 1)``. With the default ``blocks_down=(1, 2, 2, 4)``, each dimension must be From 93c94371ff7c39fe4cdb7df5a925d8e550373d42 Mon Sep 17 00:00:00 2001 From: Talhax55z Date: Fri, 3 Apr 2026 14:22:28 +0500 Subject: [PATCH 8/8] DCO Remediation Commit for Talhax55z I, Talhax55z , hereby add my Signed-off-by to this commit: 497ca39c40073792dcf0f566a13b9858989ea0e0 I, Talhax55z , hereby add my Signed-off-by to this commit: ee7c98711c3eaf9534a6e734e1e6b4648b670a03 I, Talhax55z , hereby add my Signed-off-by to this commit: 9e1c8b94be3dd796f06630e27f3db392369da377 Signed-off-by: Talhax55z