espnet2.asr.encoder.avhubert_encoder.conv3x3
Less than 1 minute
espnet2.asr.encoder.avhubert_encoder.conv3x3
espnet2.asr.encoder.avhubert_encoder.conv3x3(in_planes, out_planes, stride=1)
Create a 3x3 convolutional layer with padding.
This function returns a 2D convolution layer that uses a kernel size of 3x3 and includes padding to maintain the spatial dimensions of the input. The layer does not include a bias term.
- Parameters:
- in_planes (int) – Number of input channels.
- out_planes (int) – Number of output channels.
- stride (int , optional) – Stride of the convolution. Default is 1.
- Returns: A 2D convolution layer configured with the specified parameters.
- Return type: nn.Conv2d
Examples
>>> conv_layer = conv3x3(16, 32)
>>> input_tensor = torch.randn(1, 16, 64, 64) # (N, C, H, W)
>>> output_tensor = conv_layer(input_tensor)
>>> output_tensor.shape
torch.Size([1, 32, 64, 64]) # Output shape remains the same as input