libeblearn
ebl::module_1_1< T, Tin, Tout > Class Template Reference

An abstract class for a module with one input and one output. More...

#include <ebl_arch.h>

Inheritance diagram for ebl::module_1_1< T, Tin, Tout >:
ebl::module ebl::ebm_module_1_1< T, Tin, Tout, Ten > ebl::layers_2< T, Tin, Thid, Tout > ebl::m2s_module< T, Tin, Tout > ebl::s2m_module< T, Tin, Tout > ebl::m2s_module< T, Tstate > ebl::s2m_module< T, Tstate > ebl::flat_merge_module< T, Tstate > ebl::average_pyramid_module< T, Tstate > ebl::fovea_module< T, Tstate > ebl::laplacian_pyramid_module< T, Tstate > ebl::mschan_module< T, Tstate > ebl::pyramid_module< T, Tstate >

List of all members.

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.

Detailed Description

template<typename T, class Tin = bbstate_idx<T>, class Tout = Tin>
class ebl::module_1_1< T, Tin, Tout >

An abstract class for a module with one input and one output.


Constructor & Destructor Documentation

template<typename T , class Tin , class Tout >
ebl::module_1_1< T, Tin, Tout >::module_1_1 ( const char *  name = "module_1_1< T, Tin, Tout >",
bool  bresize = true 
)
Parameters:
bresizeBy default, resize output.

Member Function Documentation

template<typename T, class Tin, class Tout >
module_1_1< T, Tin, Tout > * ebl::module_1_1< T, Tin, Tout >::copy ( parameter< T, Tin > *  p) [virtual]
template<typename T , class Tin, class Tout>
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 >.

template<typename T , class Tin, class Tout>
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 >.

template<typename T , class Tin, class Tout>
void ebl::module_1_1< T, Tin, Tout >::dump_fprop ( Tin &  in,
Tout &  out 
) [virtual]
template<typename T , class Tin, class Tout>
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 >.

template<typename T , class Tin , class Tout >
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 >.

template<typename T , class Tin, class Tout>
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;

template<typename T , class Tin , class Tout >
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 >.

template<typename T, class Tin , class Tout >
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 >.

template<typename T , class Tin, class Tout>
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 >.

template<typename T , class Tin , class Tout >
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 >.

template<typename T , class Tin , class Tout >
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 >.

template<typename T, class Tin, class Tout>
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.

Parameters:
dIf not null, use these dimensions as target, otherwise use in.x This returns true if output was resized/reallocated, false otherwise.
template<typename T , class Tin, class Tout>
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.

Parameters:
dIf not null, use these dimensions as target, otherwise use in.x This returns true if output was resized/reallocated, false otherwise.

The documentation for this class was generated from the following files: