DaNNet
|
Pooling layer base class. More...
#include <dnn_layer_pool.h>
Public Member Functions | |
layer_pool (const arma::uword n_block) | |
Pooling layer constructor. More... | |
virtual void | init (void) |
Initialize layer. More... | |
virtual void | upd_buf_size (arma::uword nmb) |
Update layer buffer sizes. More... | |
virtual void | prop (void)=0 |
Forward propagation. More... | |
virtual void | prop_mb (void)=0 |
Forward propagation - mini batch. More... | |
virtual void | backprop (void)=0 |
Back propagation. More... | |
virtual void | disp (void) |
Display info about layer. More... | |
void | upsamp2 (const arma::Mat< DNN_Dtype > &Src, arma::Mat< DNN_Dtype > &Dst, arma::uword N) |
2D upsampling More... | |
void | upsamp2 (const arma::Cube< DNN_Dtype > &Src, arma::Cube< DNN_Dtype > &Dst, const arma::uword N) |
2D upsampling for Cube More... | |
![]() | |
layer (void) | |
Layer constructor. More... | |
~layer () | |
virtual void | update (void) |
Parameter update. More... | |
virtual void | enable_training (void) |
Enable training of layer. More... | |
virtual void | disable_training (void) |
Disable training of layer. More... | |
virtual void | enable_bias (void) |
Enable bias term in layer. More... | |
virtual void | disable_bias (void) |
Disable bias term in layer. More... | |
virtual arma::Mat< DNN_Dtype > | get_B (void) |
Get bias. More... | |
virtual arma::Cube< DNN_Dtype > | get_W (void) |
Get weights. More... | |
virtual void | set_B (arma::Mat< DNN_Dtype > &b) |
Set bias. More... | |
virtual void | set_W (arma::Cube< DNN_Dtype > &w) |
Set weights. More... | |
virtual arma::uword | get_nrof_params (void) |
Get number of trainable parameters. More... | |
virtual void | set_phase (PHASE p) |
Set phase/state. More... | |
virtual void | set_left (layer *lptr) |
Set pointer to left layer. More... | |
virtual void | set_right (layer *rptr) |
Set pointer to right layer. More... | |
virtual void | set_id (const std::string str) |
Set layer id string. More... | |
virtual std::string | get_id (void) |
Get layer id string. More... | |
virtual void | set_type (const std::string str) |
Set layer type string. More... | |
virtual std::string | get_type (void) |
Get layer type string. More... | |
virtual void | set_ix (const arma::uword n) |
Set layer index. More... | |
virtual arma::uword | get_ix (void) |
Get layer index. More... | |
virtual void | set_batch_size (const arma::uword n) |
Set mini batch size. More... | |
virtual arma::uword | get_batch_size (void) |
Get mini batch size. More... | |
virtual void | set_Y1 (arma::Mat< DNN_Dtype > &y) |
Set output buffer. More... | |
virtual void | set_Y (arma::Mat< DNN_Dtype > &y) |
Set output buffer - mini batch. More... | |
virtual void | set_Dleft (arma::Mat< DNN_Dtype > &d) |
Set error output buffer - mini batch. More... | |
virtual void | set_rows_in (arma::uword r) |
Set input buffer row size. More... | |
virtual arma::uword | get_nrof_rows (void) |
Get output buffer row size. More... | |
virtual void | set_cols_in (arma::uword c) |
Set input buffer column size. More... | |
virtual arma::uword | get_nrof_cols (void) |
Get output buffer column size. More... | |
virtual void | set_channels_in (arma::uword l) |
Set input buffer channel/layer size. More... | |
virtual arma::uword | get_nrof_channels (void) |
Get output buffer channel/layer size. More... | |
virtual void | set_opt_alg (opt &alg_class) |
Set pointer to optimizer class. More... | |
virtual opt * | get_opt_alg (void) |
Get pointer to optimizer class. More... | |
virtual arma::uword | get_nrof_inputs (void) |
Get total number of layer inputs. More... | |
virtual arma::uword | get_nrof_outputs (void) |
Get total number of layer outputs. More... | |
virtual arma::Mat< DNN_Dtype > | get_Y1 (void) |
Get output buffer. More... | |
virtual arma::Mat< DNN_Dtype > * | get_Y1_ptr (void) |
Get output buffer pointer. More... | |
virtual DNN_Dtype * | get_Y1_memptr (void) |
Get output buffer memory pointer. More... | |
virtual arma::Mat< DNN_Dtype > | get_Y (void) |
Get output buffer - mini batch. More... | |
virtual arma::Mat< DNN_Dtype > * | get_Y_ptr (void) |
Get output buffer pointer - mini batch. More... | |
virtual DNN_Dtype * | get_Y_memptr (void) |
Get output buffer memory pointer - mini batch. More... | |
virtual DNN_Dtype * | get_Y_colptr (const arma::uword n) |
Get output buffer memory column pointer - mini batch. More... | |
virtual arma::Mat< DNN_Dtype > | get_Dleft () |
Get error buffer - mini batch. More... | |
virtual arma::Mat< DNN_Dtype > * | get_Dleft_ptr (void) |
Get error buffer pointer - mini batch. More... | |
virtual DNN_Dtype * | get_Dleft_memptr (void) |
Get error buffer memory pointer - mini batch. More... | |
virtual DNN_Dtype * | get_Dleft_colptr (const arma::uword n) |
Get error buffer memory column pointer - mini batch. More... | |
virtual void | save_layer_param (std::string name, PARAM_FORMAT f=PARAM_FORMAT::ASCII) |
Save layer weight and bias. More... | |
virtual void | load_layer_param (std::string name, PARAM_FORMAT f=PARAM_FORMAT::AUTO) |
Load layer weight and bias. More... | |
template<typename T > | |
void | init_weights (T &w, arma::uword fan_in, arma::uword fan_out, INIT_W_ALG alg, INIT_W_DIST dist) |
Initiate weights. More... | |
DNN_Dtype | sigmoid (const DNN_Dtype x) |
Sigmoid function - scalar. More... | |
arma::Mat< DNN_Dtype > | sigmoid (const arma::Mat< DNN_Dtype > &x) |
Sigmoid function - matrix. More... | |
arma::Mat< DNN_Dtype > | softmax (const arma::Mat< DNN_Dtype > &x) |
Softmax function - matrix. More... | |
Protected Attributes | |
arma::uword | N_block |
Pooling block size. More... | |
arma::uword | N_stride |
Stride. More... | |
arma::Mat< DNN_Dtype > | mask |
Pooling mask. More... | |
![]() | |
layer * | left |
Pointer to previous layer. More... | |
layer * | right |
Pointer to next layer. More... | |
std::string | id |
Layer id string. More... | |
std::string | type |
Layer type string. More... | |
arma::uword | layer_ix |
Layer index [0..]. More... | |
bool | train_par |
Enable training. More... | |
bool | add_bias |
Enable bias. More... | |
opt * | opt_alg |
Pointer to optimizer. More... | |
PHASE | phase |
Active state/phase. More... | |
arma::uword | N_batch |
Mini batch size. More... | |
arma::uword | N_rows_left |
Input rows. More... | |
arma::uword | N_cols_left |
Input cols. More... | |
arma::uword | N_channels_left |
Input channels, number of filters. More... | |
arma::uword | N_rows_right |
Output rows. More... | |
arma::uword | N_cols_right |
Output cols. More... | |
arma::uword | N_channels_right |
Output channels, number of filters. More... | |
arma::uword | N_left |
Total size left. More... | |
arma::uword | N_right |
Total size right. More... | |
arma::Mat< DNN_Dtype > | Y |
Output buffer mini batch [N_right,N_batch]. More... | |
arma::Mat< DNN_Dtype > | Y1 |
Output buffer [N_right,1]. More... | |
arma::Mat< DNN_Dtype > | Dleft |
Error buffer [N_left,N_batch]. More... | |
arma::Cube< DNN_Dtype > | W |
Weights. More... | |
arma::Mat< DNN_Dtype > | B |
Bias. More... | |
|
inline |
Pooling layer constructor.
[in] | n_block | Pooling block size |
Definition at line 43 of file dnn_layer_pool.h.
|
pure virtual |
Back propagation.
Reimplemented from dnn::layer.
Implemented in dnn::pool_average, and dnn::pool_max.
|
inlinevirtual |
Display info about layer.
Reimplemented from dnn::layer.
Definition at line 74 of file dnn_layer_pool.h.
|
inlinevirtual |
Initialize layer.
Initializes input buffer dimensions
Reimplemented from dnn::layer.
Definition at line 52 of file dnn_layer_pool.h.
|
pure virtual |
Forward propagation.
Reimplemented from dnn::layer.
Implemented in dnn::pool_average, and dnn::pool_max.
|
pure virtual |
Forward propagation - mini batch.
Reimplemented from dnn::layer.
Implemented in dnn::pool_average, and dnn::pool_max.
|
inlinevirtual |
Update layer buffer sizes.
Initializes and clears output buffer dimensions
Reimplemented from dnn::layer.
Definition at line 64 of file dnn_layer_pool.h.
|
inline |
2D upsampling
[in] | Src,Dst | Source and destination pointers |
[in] | N | Upsampling rate |
A 2D upsampling function
Definition at line 90 of file dnn_layer_pool.h.
|
inline |
2D upsampling for Cube
[in] | Src,Dst | Source and destination pointers |
[in] | N | Upsampling rate |
A 2D upsampling function
Definition at line 120 of file dnn_layer_pool.h.
|
protected |
Pooling mask.
Definition at line 35 of file dnn_layer_pool.h.
|
protected |
Pooling block size.
Definition at line 31 of file dnn_layer_pool.h.
|
protected |
Stride.
Definition at line 32 of file dnn_layer_pool.h.