Struct neuronika::nn::GroupedConv1d [−][src]
pub struct GroupedConv1d<Pad: PaddingMode> {
pub padding: usize,
pub padding_mode: Pad,
pub stride: usize,
pub dilation: usize,
pub groups: usize,
pub weight: Learnable<Ix3>,
pub bias: Learnable<Ix1>,
}
Expand description
Applies a grouped temporal convolution over an input signal composed of several input planes.
Fields
padding: usize
padding_mode: Pad
stride: usize
dilation: usize
groups: usize
weight: Learnable<Ix3>
bias: Learnable<Ix1>
Implementations
Creates a new GroupedConv1d.
Arguments
-
in_channels
- number of planes in the input signal. -
out_channels
- number of planes in the output signal. -
kernel_size
- size of the kernel, a number for this one-dimensional case. -
padding
- padding to be applied to the input, a number for this one-dimensional case. -
padding_mode
- padding mode, it can be:Zero
,Constant
,Reflective
orReplicative
. -
stride
- stride of the convolution, a number for this one-dimensional case. -
dilation
- controls the spacing between the kernel points, a number for this one-dimensional case. -
groups
- controls the connections between inputs and outputs.in_channels
andout_channels
must both be divisible by groups.
For example:
- at
groups = 1
, all inputs are convolved to all outputs. - at
groups = 2
, the operation becomes equivalent to having two convolutional layers side by side, each seeing half the input channels and producing half the output channels, and both subsequently concatenated. - at
groups = in_channels
, each input channel is convolved with its own set of filters.
The weight and the bias of the layer are initialized from U(-k, k) where
k = (groups /(in_channels * kernel_size) as f32).sqrt()
.
Computes a 1-dimensional grouped convolution (cross correlation).
Arguments
input
- signal to convolve.
The input must be of shape (N, Cin, L)
- N is the batch size
- Cin is the number of input channels
- L is the length of the input
The kernel must be of shape (Cout, Cin, Lk)
- Cout is the number of output channels
- Cin is the number of input channels
- Lk is the length of the kernel
The resulting output shape will be (N, Cout, Lout)
Trait Implementations
Registers the weight and the bias of this GroupedConv1d
instance.
Register self
’s status to the model’s status state status
.