espnet2.enh.layers.dcunet.make_unet_encoder_decoder_args
espnet2.enh.layers.dcunet.make_unet_encoder_decoder_args
espnet2.enh.layers.dcunet.make_unet_encoder_decoder_args(encoder_args, decoder_args)
Construct encoder and decoder arguments for a U-Net architecture.
This function processes the encoder arguments and prepares the decoder arguments based on the specified configurations. If decoder_args is set to “auto”, the decoder arguments will be automatically derived from the encoder arguments using skip connections.
- Parameters:
encoder_args (tuple) –
A tuple containing tuples of encoder parameters, where each inner tuple consists of:
- in_chan (int): Number of input channels.
- out_chan (int): Number of output channels.
- kernel_size (tuple): Size of the convolutional kernel.
- stride (tuple): Stride of the convolution.
- padding (tuple or str): Padding applied to the input.
- dilation (tuple): Dilation of the convolution.
decoder_args (tuple or str) – A tuple containing tuples of decoder parameters, similar to encoder_args, or “auto” to automatically derive decoder arguments.
- Returns: A tuple containing two tuples: : - The first tuple contains processed encoder arguments.
- The second tuple contains processed decoder arguments.
- Return type: tuple
Examples
>>> encoder_args = (
... (1, 32, (7, 5), (2, 2), "auto", (1, 1)),
... (32, 64, (7, 5), (2, 2), "auto", (1, 1)),
... )
>>> decoder_args = "auto"
>>> make_unet_encoder_decoder_args(encoder_args, decoder_args)
(
((1, 32, (7, 5), (2, 2), (3, 2), (1, 1)), ...),
((32, 1, (7, 5), (2, 2), (3, 2), (1, 1)), ...)
)
NOTE
Padding can be specified as “auto” to automatically calculate the appropriate padding based on the kernel size.
- Raises:ValueError – If encoder_args or decoder_args are not in the expected format.