Skip to content

Commit 28ab77c

Browse files
committed
Docs: add spatial shape constraints to SegResNetDS docstring (fixes #6771)
1 parent a8176f1 commit 28ab77c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

monai/networks/nets/segresnet_ds.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,21 @@ class SegResNetDS(nn.Module):
254254
image spacing into an approximately isotropic space.
255255
Otherwise, by default, the kernel size and downsampling is always isotropic.
256256
257+
Spatial shape constraints:
258+
The input spatial dimensions must be divisible by ``2 ** (len(blocks_down) - 1)``.
259+
With the default ``blocks_down=(1, 2, 2, 4)`` (4 levels), each spatial dimension
260+
must be divisible by 8.
261+
262+
Use :py:meth:`shape_factor` to query the required divisors for a given configuration,
263+
and :py:meth:`is_valid_shape` to check whether a specific input tensor satisfies them.
264+
265+
Example::
266+
267+
model = SegResNetDS(spatial_dims=3, blocks_down=(1, 2, 2, 4))
268+
print(model.shape_factor()) # [8, 8, 8]
269+
# Valid input: shape (1, 1, 128, 128, 128) -- all dims divisible by 8
270+
# Invalid input: shape (1, 1, 100, 100, 100) -- 100 is not divisible by 8
271+
257272
"""
258273

259274
def __init__(

0 commit comments

Comments
 (0)