espnet2.gan_tts.wavenet.residual_block.Conv1d1x1
Less than 1 minute
espnet2.gan_tts.wavenet.residual_block.Conv1d1x1
class espnet2.gan_tts.wavenet.residual_block.Conv1d1x1(in_channels: int, out_channels: int, bias: bool)
Bases: Conv1d
1x1 Conv1d with customized initialization.
This class implements a 1x1 convolutional layer that extends the Conv1d class with a specific initialization method for its weights.
in_channels
The number of input channels.
- Type: int
out_channels
The number of output channels.
- Type: int
bias
Whether to include a bias term in the convolution.
Type: bool
Parameters:
- in_channels (int) – Number of input channels.
- out_channels (int) – Number of output channels.
- bias (bool) – Whether to add bias parameter in the convolution.
Examples
>>> conv1d_1x1 = Conv1d1x1(in_channels=16, out_channels=32, bias=True)
>>> input_tensor = torch.randn(1, 16, 10) # (batch_size, channels, length)
>>> output_tensor = conv1d_1x1(input_tensor)
>>> output_tensor.shape
torch.Size([1, 32, 10])
NOTE
This layer is primarily used in the context of neural network architectures where 1x1 convolutions are beneficial, such as in residual networks.
Initialize 1x1 Conv1d module.