Skip to content
Merged
15 changes: 15 additions & 0 deletions monai/networks/nets/segresnet_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

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__(
Expand Down
Loading