libeblearn
|
An abstract class for a module with one input and one output. More...
#include <ebl_arch.h>
Public Member Functions | |
module_1_1 (const char *name="module_1_1", bool bresize=true) | |
virtual void | fprop (Tin &in, Tout &out) |
virtual void | bprop (Tin &in, Tout &out) |
virtual void | bbprop (Tin &in, Tout &out) |
virtual void | dump_fprop (Tin &in, Tout &out) |
virtual void | fprop (mstate< Tin > &in, mstate< Tout > &out) |
virtual void | bprop (mstate< Tin > &in, mstate< Tout > &out) |
virtual void | bbprop (mstate< Tin > &in, mstate< Tout > &out) |
virtual void | dump_fprop (mstate< Tin > &in, mstate< Tout > &out) |
virtual void | fprop (mstate< Tin > &in, Tout &out) |
virtual void | bprop (mstate< Tin > &in, Tout &out) |
virtual void | bbprop (mstate< Tin > &in, Tout &out) |
virtual void | dump_fprop (mstate< Tin > &in, Tout &out) |
virtual void | fprop (Tin &in, mstate< Tout > &out) |
virtual void | bprop (Tin &in, mstate< Tout > &out) |
virtual void | bbprop (Tin &in, mstate< Tout > &out) |
virtual void | dump_fprop (Tin &in, mstate< Tout > &out) |
virtual void | forget (forget_param_linear &fp) |
virtual void | normalize () |
virtual int | replicable_order () |
returns the order at which the module operates. | |
virtual bool | ignored (Tin &in, Tout &out) |
virtual bool | resize_output (Tin &in, Tout &out, idxdim *d=NULL) |
virtual bool | resize_output (Tin &in, idx< T > &out, idxdim *d=NULL) |
virtual fidxdim | fprop_size (fidxdim &isize) |
virtual fidxdim | bprop_size (const fidxdim &osize) |
virtual mfidxdim | fprop_size (mfidxdim &isize) |
virtual mfidxdim | bprop_size (mfidxdim &osize) |
virtual std::string | pretty (idxdim &isize) |
virtual std::string | pretty (mfidxdim &isize) |
virtual module_1_1< T, Tin, Tout > * | copy () |
Returns a deep copy of current module. | |
virtual module_1_1< T, Tin, Tout > * | copy (parameter< T, Tin > *p) |
virtual bool | optimize_fprop (Tin &in, Tout &out) |
virtual bool | optimize_fprop (mstate< Tin > &in, mstate< Tout > &out) |
Memory optimization is not implemented in case of mstates (TODO). | |
virtual void | load_x (idx< T > &weights) |
virtual module_1_1< T, Tin, Tout > * | last_module () |
virtual bool | mstate_input () |
Returns true if this module takes a multi-state as input. | |
virtual bool | mstate_output () |
Returns true if this module produces a multi-state as output. | |
virtual uint | get_ninputs () |
Returns the number of input states after last fprop. | |
virtual uint | get_noutputs () |
Returns the number of output states after last fprop. | |
Public Attributes | |
std::vector< idx< T > > | internals |
Internal buffers to display. | |
std::vector< std::string > | internals_str |
Internal buffers desc. | |
Protected Attributes | |
bool | bresize |
Tells module to resize output. | |
bool | memoptimized |
Using mem optim or not. | |
bool | bmstate_input |
Input is multi-state. | |
bool | bmstate_output |
Output is multi-state. | |
uint | ninputs |
uint | noutputs |
Current # of i/o states. |
An abstract class for a module with one input and one output.
ebl::module_1_1< T, Tin, Tout >::module_1_1 | ( | const char * | name = "module_1_1< T, Tin, Tout >" , |
bool | bresize = true |
||
) |
bresize | By default, resize output. |
fidxdim ebl::module_1_1< T, Tin, Tout >::bprop_size | ( | const fidxdim & | osize | ) | [virtual] |
Returns input dimensions corresponding to output dimensions 'osize'. Implementation of this method helps automatic scaling of input data but is optional.
Reimplemented in ebl::ebm_module_1_1< T, Tin, Tout, Ten >, ebl::layers< T, Tstate >, ebl::layers_2< T, Tin, Thid, Tout >, ebl::linear_module< T, Tstate >, ebl::convolution_module< T, Tstate >, ebl::zpad_module< T, Tstate >, ebl::back_module< T, Tstate >, ebl::convolution_layer< T, Tstate >, ebl::convabsnorm_layer< T, Tstate >, ebl::subsampling_layer< T, Tstate >, ebl::ms_module< T, Tstate >, ebl::msc_module< T, Tstate >, ebl::flat_merge_module< T, Tstate >, ebl::mstate_merge_module< T, Tstate >, ebl::subsampling_module< T, Tstate >, ebl::lppooling_module< T, Tstate >, ebl::wavg_pooling_module< T, Tstate >, ebl::maxss_module< T, Tstate >, ebl::resizepp_module< T, Tstate >, ebl::ms_module< Tnet, bbstate_idx< Tnet > >, and ebl::ms_module< T, Tin1 >.
mfidxdim ebl::module_1_1< T, Tin, Tout >::bprop_size | ( | mfidxdim & | osize | ) | [virtual] |
Returns input dimensions corresponding to multiple output dimensions 'osize'. Implementation of this method helps automatic scaling of input data but is optional.
Reimplemented in ebl::layers< T, Tstate >, ebl::narrow_module< T, Tstate >, ebl::table_module< T, Tstate >, ebl::zpad_module< T, Tstate >, ebl::s2m_module< T, Tin, Tout >, ebl::m2s_module< T, Tin, Tout >, ebl::ms_module< T, Tstate >, ebl::msc_module< T, Tstate >, ebl::flat_merge_module< T, Tstate >, ebl::interlace_module< T, Tstate >, ebl::pyramid_module< T, Tstate >, ebl::average_pyramid_module< T, Tstate >, ebl::resizepp_module< T, Tstate >, ebl::fovea_module< T, Tstate >, ebl::laplacian_pyramid_module< T, Tstate >, ebl::s2m_module< T, Tstate >, ebl::m2s_module< T, Tstate >, ebl::ms_module< Tnet, bbstate_idx< Tnet > >, and ebl::ms_module< T, Tin1 >.
module_1_1< T, Tin, Tout > * ebl::module_1_1< T, Tin, Tout >::copy | ( | parameter< T, Tin > * | p | ) | [virtual] |
Returns a deep copy of current module.
p | If NULL, the copy points to the same weights as this module. |
Reimplemented in ebl::linear_module< T, Tstate >, ebl::convolution_module< T, Tstate >, ebl::addc_module< T, Tstate >, ebl::zpad_module< T, Tstate >, ebl::mirrorpad_module< T, Tstate >, ebl::diag_module< T, Tstate >, ebl::divisive_norm_module< T, Tstate >, ebl::subtractive_norm_module< T, Tstate >, ebl::contrast_norm_module< T, Tstate >, and ebl::maxss_module< T, Tstate >.
void ebl::module_1_1< T, Tin, Tout >::dump_fprop | ( | mstate< Tin > & | in, |
mstate< Tout > & | out | ||
) | [virtual] |
Calls fprop and then dumps internal buffers, inputs and outputs into files. This can be useful for debugging.
Reimplemented in ebl::layers< T, Tstate >, and ebl::ms_module< T, Tstate >.
void ebl::module_1_1< T, Tin, Tout >::dump_fprop | ( | Tin & | in, |
mstate< Tout > & | out | ||
) | [virtual] |
Calls fprop and then dumps internal buffers, inputs and outputs into files. This can be useful for debugging.
Reimplemented in ebl::layers< T, Tstate >.
void ebl::module_1_1< T, Tin, Tout >::dump_fprop | ( | Tin & | in, |
Tout & | out | ||
) | [virtual] |
Calls fprop and then dumps internal buffers, inputs and outputs into files. This can be useful for debugging.
Reimplemented in ebl::layers< T, Tstate >, ebl::linear_module< T, Tstate >, ebl::convolution_module< T, Tstate >, ebl::addc_module< T, Tstate >, ebl::divisive_norm_module< T, Tstate >, ebl::subtractive_norm_module< T, Tstate >, ebl::contrast_norm_module< T, Tstate >, ebl::subsampling_module< T, Tstate >, ebl::lppooling_module< T, Tstate >, and ebl::wavg_pooling_module< T, Tstate >.
void ebl::module_1_1< T, Tin, Tout >::dump_fprop | ( | mstate< Tin > & | in, |
Tout & | out | ||
) | [virtual] |
Calls fprop and then dumps internal buffers, inputs and outputs into files. This can be useful for debugging.
Reimplemented in ebl::layers< T, Tstate >.
fidxdim ebl::module_1_1< T, Tin, Tout >::fprop_size | ( | fidxdim & | isize | ) | [virtual] |
Modifies input dimensions 'isize' to be compliant with module's architecture, and returns corresponding output dimensions. Implementation of this method helps automatic scaling of input data but is optional.
Reimplemented in ebl::ebm_module_1_1< T, Tin, Tout, Ten >, ebl::layers< T, Tstate >, ebl::layers_2< T, Tin, Thid, Tout >, ebl::linear_module< T, Tstate >, ebl::convolution_module< T, Tstate >, ebl::zpad_module< T, Tstate >, ebl::full_layer< T, Tstate >, ebl::convolution_layer< T, Tstate >, ebl::convabsnorm_layer< T, Tstate >, ebl::subsampling_layer< T, Tstate >, ebl::ms_module< T, Tstate >, ebl::msc_module< T, Tstate >, ebl::subsampling_module< T, Tstate >, ebl::lppooling_module< T, Tstate >, ebl::wavg_pooling_module< T, Tstate >, ebl::maxss_module< T, Tstate >, ebl::ms_module< Tnet, bbstate_idx< Tnet > >, and ebl::ms_module< T, Tin1 >.
mfidxdim ebl::module_1_1< T, Tin, Tout >::fprop_size | ( | mfidxdim & | isize | ) | [virtual] |
Modifies multi-input dimensions 'isize' to be compliant with module's architecture, and returns corresponding output dimensions. Implementation of this method helps automatic scaling of input data but is optional.
Reimplemented in ebl::layers< T, Tstate >, ebl::narrow_module< T, Tstate >, ebl::table_module< T, Tstate >, ebl::zpad_module< T, Tstate >, ebl::ms_module< T, Tstate >, ebl::laplacian_pyramid_module< T, Tstate >, ebl::ms_module< Tnet, bbstate_idx< Tnet > >, and ebl::ms_module< T, Tin1 >.
bool ebl::module_1_1< T, Tin, Tout >::ignored | ( | Tin & | in, |
Tout & | out | ||
) | [virtual] |
This tests if this module is enabled, if it is it returns false, otherwise simply copies data from in to out and returns true;
module_1_1< T, Tin, Tout > * ebl::module_1_1< T, Tin, Tout >::last_module | ( | ) | [virtual] |
Returns the last module contained in this module, or itself if composed of only 1 module.
Reimplemented in ebl::layers< T, Tstate >, ebl::ms_module< T, Tstate >, ebl::ms_module< Tnet, bbstate_idx< Tnet > >, and ebl::ms_module< T, Tin1 >.
void ebl::module_1_1< T, Tin, Tout >::load_x | ( | idx< T > & | weights | ) | [virtual] |
Load internal weights of module with passed weights w. TODO: there should be not idx specialization at this level.
Reimplemented in ebl::linear_module< T, Tstate >, ebl::convolution_module< T, Tstate >, ebl::addc_module< T, Tstate >, and ebl::diag_module< T, Tstate >.
bool ebl::module_1_1< T, Tin, Tout >::optimize_fprop | ( | Tin & | in, |
Tout & | out | ||
) | [virtual] |
Pre-determine the order of hidden buffers to use only 2 buffers in order to reduce memory footprint. This returns true if outputs is actually put in out, false if it's in in.
Reimplemented in ebl::divisive_norm_module< T, Tstate >, ebl::subtractive_norm_module< T, Tstate >, and ebl::contrast_norm_module< T, Tstate >.
std::string ebl::module_1_1< T, Tin, Tout >::pretty | ( | mfidxdim & | isize | ) | [virtual] |
Prints the forward transformation of multi-dimensions in a string and return it. This method calls fprop_size to determine the output size given the input.
Reimplemented in ebl::layers< T, Tstate >, ebl::ms_module< T, Tstate >, ebl::ms_module< Tnet, bbstate_idx< Tnet > >, and ebl::ms_module< T, Tin1 >.
std::string ebl::module_1_1< T, Tin, Tout >::pretty | ( | idxdim & | isize | ) | [virtual] |
Prints the forward transformation of dimensions in a string and return it. This method calls fprop_size to determine the output size given the input.
Reimplemented in ebl::layers< T, Tstate >, ebl::layers_2< T, Tin, Thid, Tout >, ebl::ms_module< T, Tstate >, ebl::ms_module< Tnet, bbstate_idx< Tnet > >, and ebl::ms_module< T, Tin1 >.
bool ebl::module_1_1< T, Tin, Tout >::resize_output | ( | Tin & | in, |
idx< T > & | out, | ||
idxdim * | d = NULL |
||
) | [virtual] |
Resizes 'out' to the same dimensions as 'in'. If dimensions already match, nothing is changed. If orders differ, then out is assigned a new 'Tout' buffer if the correct order and dimensions.
d | If not null, use these dimensions as target, otherwise use in.x This returns true if output was resized/reallocated, false otherwise. |
bool ebl::module_1_1< T, Tin, Tout >::resize_output | ( | Tin & | in, |
Tout & | out, | ||
idxdim * | d = NULL |
||
) | [virtual] |
Resizes 'out' to the same dimensions as 'in'. If dimensions already match, nothing is changed. If orders differ, then out is assigned a new 'Tout' buffer if the correct order and dimensions.
d | If not null, use these dimensions as target, otherwise use in.x This returns true if output was resized/reallocated, false otherwise. |