Dynamic implementation of a 2-dimensional convolution layer with no activation. More...
Public Member Functions | |
Conv2D (int in_num_filters_in, int in_num_filters_out, int in_num_features_in, int in_kernel_size_time, int in_kernel_size_feature, int in_dilation_rate, int in_stride, bool in_valid_pad) | |
Conv2D (std::initializer_list< int > sizes) | |
Conv2D (const Conv2D &other) | |
Conv2D & | operator= (const Conv2D &other) |
virtual | ~Conv2D ()=default |
RTNEURAL_REALTIME void | reset () override |
Reset the layer's state. More... | |
std::string | getName () const noexcept override |
Returns the name of this layer. More... | |
constexpr bool | isActivation () const noexcept |
Returns false since convolution is not an activation layer. More... | |
RTNEURAL_REALTIME void | forward (const T *input, T *output) noexcept override |
Performs forward propagation for this layer. More... | |
RTNEURAL_REALTIME void | setWeights (const std::vector< std::vector< std::vector< std::vector< T >>>> &inWeights) |
Sets the layer weights. More... | |
RTNEURAL_REALTIME void | setBias (const std::vector< T > &inBias) |
Sets the layer biases. More... | |
RTNEURAL_REALTIME int | getKernelSizeTime () const noexcept |
Returns the size of the convolution kernel (time axis). More... | |
RTNEURAL_REALTIME int | getKernelSizeFeature () const noexcept |
Returns the size of the convolution kernel (feature axis). More... | |
RTNEURAL_REALTIME int | getStride () const noexcept |
Returns the convolution stride (feature axis) More... | |
RTNEURAL_REALTIME int | getDilationRate () const noexcept |
Returns the convolution dilation rate (time axis) More... | |
Public Member Functions inherited from Layer< T > | |
Layer (int in_size, int out_size) | |
Constructs a layer with given input and output size. More... | |
virtual | ~Layer ()=default |
Public Attributes | |
const int | num_filters_in |
const int | num_features_in |
const int | num_filters_out |
const int | kernel_size_time |
const int | kernel_size_feature |
const int | dilation_rate |
const int | stride |
const int | num_features_out |
const int | receptive_field |
const bool | valid_pad |
Public Attributes inherited from Layer< T > | |
const int | in_size |
const int | out_size |
Dynamic implementation of a 2-dimensional convolution layer with no activation.
T | Type of the layer (float, double, int ...) |
Conv2D | ( | int | in_num_filters_in, |
int | in_num_filters_out, | ||
int | in_num_features_in, | ||
int | in_kernel_size_time, | ||
int | in_kernel_size_feature, | ||
int | in_dilation_rate, | ||
int | in_stride, | ||
bool | in_valid_pad | ||
) |
in_num_filters_in | number of input filters (channels) |
in_num_filters_out | number of output filters (channels) |
in_num_features_in | number of input features |
in_kernel_size_time | size of the convolution kernel (time axis) |
in_kernel_size_feature | size of the convolution kernel (feature axis) |
in_dilation_rate | dilation_rate (time axis) |
in_stride | convolution stride (feature axis) |
in_valid_pad | whether the padding is "valid" or not ("same" otherwise) |
Conv2D | ( | std::initializer_list< int > | sizes | ) |
|
virtualdefault |
|
overridevirtual |
|
overridevirtualnoexcept |
Returns the name of this layer.
Reimplemented from Layer< T >.
|
constexprnoexcept |
Returns false since convolution is not an activation layer.
|
overridevirtualnoexcept |
Performs forward propagation for this layer.
Implements Layer< T >.
References Conv2D< T >::dilation_rate, Conv2D< T >::kernel_size_time, Conv2D< T >::num_features_out, Conv2D< T >::num_filters_out, and Conv2D< T >::receptive_field.
RTNEURAL_REALTIME void setWeights | ( | const std::vector< std::vector< std::vector< std::vector< T >>>> & | inWeights | ) |
Sets the layer weights.
The weights vector must have size weights[num_filters_out][num_filters_in][kernel_size]
RTNEURAL_REALTIME void setBias | ( | const std::vector< T > & | inBias | ) |
Sets the layer biases.
The bias vector must have size bias[num_filters_out]
|
noexcept |
Returns the size of the convolution kernel (time axis).
References Conv2D< T >::kernel_size_time.
|
noexcept |
Returns the size of the convolution kernel (feature axis).
References Conv2D< T >::kernel_size_feature.
|
noexcept |
Returns the convolution stride (feature axis)
References Conv2D< T >::stride.
|
noexcept |
Returns the convolution dilation rate (time axis)
References Conv2D< T >::dilation_rate.
const int num_filters_in |
const int num_features_in |
const int num_filters_out |
Referenced by Conv2D< T >::forward().
const int kernel_size_time |
Referenced by Conv2D< T >::forward(), and Conv2D< T >::getKernelSizeTime().
const int kernel_size_feature |
Referenced by Conv2D< T >::getKernelSizeFeature().
const int dilation_rate |
Referenced by Conv2D< T >::forward(), and Conv2D< T >::getDilationRate().
const int stride |
Referenced by Conv2D< T >::getStride().
const int num_features_out |
Referenced by Conv2D< T >::forward().
const int receptive_field |
Referenced by Conv2D< T >::forward(), and Conv2D< T >::reset().
const bool valid_pad |