-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Is your feature request related to a problem? Please describe.
In the current implementation of the AutoEncoder class in the monai.networks.nets module, the padding parameter is not customizable. This limits the model's flexibility, as different padding strategies might suit different data-sizes.
MONAI/monai/networks/nets/autoencoder.py
Line 90 in 18a671a
| def __init__( |
Describe the solution you'd like
I would like to propose adding a padding argument to the AutoEncoder class constructor. This would allow users to specify the padding strategy when instantiating the model.
Describe alternatives you've considered
An alternative solution could be to create a subclass of AutoEncoder (like CustomAE) whenever a different padding strategy is needed. See below,
class CustomAE(AutoEncoder):
def __init__(self, padding, **kwargs):
self.padding = padding
super().__init__(**kwargs)
def _get_encode_layer(self, in_channels: int, out_channels: int, strides: int, is_last: bool) -> nn.Module:
# ...
mod = Convolution(
spatial_dims=self.dimensions,
in_channels=in_channels,
out_channels=out_channels,
strides=strides,
kernel_size=self.kernel_size,
padding=self.padding,
# ...
)
return mod