23 #ifndef SRC_MLNN_CROPPING_HPP_
24 #define SRC_MLNN_CROPPING_HPP_
30 namespace convolution {
37 template <
typename eT=
float>
49 Cropping(
size_t input_height_,
size_t input_width_,
size_t depth_,
51 std::string name_ =
"Cropping") :
52 Layer<eT>::
Layer(input_height_, input_width_, depth_,
53 (input_height_ - 2*cropping_), (input_width_ - 2*cropping_), depth_,
71 mic::types::MatrixPtr<eT> batch_x =
s[
'x'];
72 LOG(LTRACE) <<
"Cropping::forward input x activation: min:" << (*batch_x).minCoeff() <<
" max: " << (*batch_x).maxCoeff() << std::endl;
75 mic::types::MatrixPtr<eT> batch_y =
s[
'y'];
82 #pragma omp parallel for
105 LOG(LTRACE) <<
"Cropping::forward end\n";
112 LOG(LTRACE) <<
"Cropping::backward\n";
114 mic::types::MatrixPtr<eT> batch_dy =
g[
'y'];
120 mic::types::MatrixPtr<eT> batch_dx =
g[
'x'];
148 LOG(LTRACE) <<
"Cropping::backward end\n";
156 void update(eT alpha_, eT decay_ = 0.0f) { }
size_t cropping
Cropping size - number of pixels removed in each channel (width and height)
size_t input_depth
Number of channels of the input (e.g. 3 for RGB images).
Class implementing cropping operation - crops the size of image (matrix) by a margin of n pixels on e...
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.
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).
Cropping(size_t input_height_, size_t input_width_, size_t depth_, size_t cropping_, std::string name_="Cropping")
size_t output_height
Number of receptive fields in a single channel - vertical direction.
void update(eT alpha_, eT decay_=0.0f)
size_t output_width
Number of receptive fields in a single channel - horizontal direction.
Contains a template class representing a layer.