UNet Constraints
UNet model constraints.
UNetConstraints
UNet model constraints on input tensors spatial shape.
Parameters:
-
model_config(UNetConfig) –The UNet model configuration from which to derive constraints.
__init__(model_config)
Constructor.
Parameters:
-
model_config(UNetConfig) –The UNet model configuration from which to derive constraints.
validate_input_channels(n_channels)
Whether the given channel size is compatible with the model constraints.
Parameters:
-
n_channels(int) –The number of channels in the input tensor to validate.
Raises:
-
ValueError–If the number of channels is not compatible with the model constraints.
validate_spatial_shape(input_shape)
Whether the given spatial shape is compatible with the model constraints.
Shape must be of length 2 (YX) or 3 (ZYX). To validate channel dimension, use
validate_input_channels or validate_target_channels instead.
Parameters:
Raises:
-
ValueError–If the spatial shape is not compatible with the model constraints.
validate_target_channels(n_channels)
Whether the given channel size is compatible with the model constraints.
Parameters:
-
n_channels(int) –The number of channels in the target tensor to validate.
Raises:
-
ValueError–If the number of channels is not compatible with the model constraints.