espnet2.gan_codec.shared.discriminator.msmpmb_discriminator.WNConv2d
Less than 1 minute
espnet2.gan_codec.shared.discriminator.msmpmb_discriminator.WNConv2d
espnet2.gan_codec.shared.discriminator.msmpmb_discriminator.WNConv2d(*args, **kwargs)
Weight Normalized 2D Convolution Layer.
This class applies a 2D convolution with weight normalization. It can optionally apply a Leaky ReLU activation function after the convolution.
espnet2.gan_codec.shared.discriminator.msmpmb_discriminator.act
If True, applies Leaky ReLU activation after convolution.
Type: bool
Parameters:
- *args – Variable length argument list for nn.Conv2d.
- **kwargs – Keyword arguments for nn.Conv2d, including:
- act (bool): Whether to apply activation function (default: True).
Returns: A sequential model with convolution and activation or just the convolution layer.
Return type: nn.Sequential or nn.Conv2d
Examples
>>> conv_layer = WNConv2d(3, 16, kernel_size=3, padding=1)
>>> print(conv_layer)
WNConv2d(
(0): Conv2d(3, 16, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): LeakyReLU(negative_slope=0.1)
)
>>> conv_layer_no_act = WNConv2d(3, 16, kernel_size=3, padding=1, act=False)
>>> print(conv_layer_no_act)
Conv2d(3, 16, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))