23 #ifndef SRC_MLNN_PADDING_HPP_
24 #define SRC_MLNN_PADDING_HPP_
30 namespace convolution {
37 template <
typename eT=
float>
49 Padding(
size_t input_height_,
size_t input_width_,
size_t depth_,
51 std::string name_ =
"Padding") :
52 Layer<eT>::
Layer(input_height_, input_width_, depth_,
53 (input_height_ + 2*padding_), (input_width_ + 2*padding_), depth_,
69 LOG(LTRACE) <<
"Padding::forward\n";
72 mic::types::MatrixPtr<eT> batch_x =
s[
'x'];
77 mic::types::MatrixPtr<eT> batch_y =
s[
'y'];
84 #pragma omp parallel for
108 LOG(LTRACE) <<
"Padding::forward end\n";
115 LOG(LTRACE) <<
"Padding::backward\n";
118 mic::types::MatrixPtr<eT> batch_dy =
g[
'y'];
121 mic::types::MatrixPtr<eT> batch_dx =
g[
'x'];
125 #pragma omp parallel for
145 LOG(LTRACE) <<
"Padding::backward end\n";
153 void update(eT alpha_, eT decay_ = 0.0f) { }
size_t input_depth
Number of channels of the input (e.g. 3 for RGB images).
size_t batch_size
Size (length) of (mini)batch.
void forward(bool test=false)
size_t input_height
Height of the input (e.g. 28 for MNIST).
Class representing a multi-layer neural network.
LayerTypes
Enumeration of possible layer types.
Padding(size_t input_height_, size_t input_width_, size_t depth_, size_t padding_, std::string name_="Padding")
mic::types::MatrixArray< eT > s
States - contains input [x] and output [y] matrices.
mic::types::MatrixArray< eT > g
Gradients - contains input [x] and output [y] matrices.
size_t input_width
Width of the input (e.g. 28 for MNIST).
void update(eT alpha_, eT decay_=0.0f)
Class implementing padding operation - expanding the size of image (matrix) by a margin of n pixels o...
Contains a template class representing a layer.