libeblearn
ebl::ms_module< T, Tstate > Class Template Reference

#include <ebl_march.h>

Inheritance diagram for ebl::ms_module< T, Tstate >:
ebl::module_1_1< T, Tstate, Tstate > ebl::module ebl::msc_module< T, Tstate >

List of all members.

Public Member Functions

 ms_module (bool replicate_inputs=false, const char *name="ms_module")
 Construct an empty multi-state module.
 ms_module (module_1_1< T, Tstate > *pipe, uint n=1, bool replicate_inputs=false, const char *name="ms_module")
 Construct a multi-state module where 'pipe' is replicated 'n' times.
 ms_module (std::vector< module_1_1< T, Tstate > * > &pipes, bool replicate_inputs=false, const char *name="ms_module")
virtual ~ms_module ()
 Destructor.
virtual void fprop (mstate< Tstate > &in, mstate< Tstate > &out)
virtual void bprop (mstate< Tstate > &in, mstate< Tstate > &out)
virtual void bbprop (mstate< Tstate > &in, mstate< Tstate > &out)
virtual void dump_fprop (mstate< Tstate > &in, mstate< Tstate > &out)
virtual void forget (forget_param_linear &fp)
virtual fidxdim fprop_size (fidxdim &i_size)
virtual mfidxdim fprop_size (mfidxdim &isize)
virtual fidxdim bprop_size (const fidxdim &o_size)
virtual mfidxdim bprop_size (mfidxdim &o_size)
virtual std::string pretty (idxdim &isize)
virtual std::string pretty (mfidxdim &isize)
virtual std::string describe ()
 Returns a string describing this module and its parameters.
virtual void set_switch (midxdim &sizes)
 Only propagate in 1 pipe based on the size of the first input state.
virtual void set_switch (intg id)
 Only propagate in pipe with index 'id'.
virtual uint npipes ()
 Returns the number of pipes.
virtual module_1_1< T, Tstate > * get_pipe (uint i)
 Returns pointer to pipe 'i'.
virtual module_1_1< T, Tstate > * last_module ()

Protected Member Functions

virtual void init ()
 Initializations.
virtual void init_fprop (mstate< Tstate > &in, mstate< Tstate > &out)
 Prepare pipes and buffer for fprop.
virtual void switch_pipes (mstate< Tstate > &in)
 Switch used_pipes on input size when switches are defined.

Protected Attributes

std::vector< module_1_1< T,
Tstate > * > 
pipes
 All pipes/.
std::vector< module_1_1< T,
Tstate > * > 
used_pipes
 Not always all pipes.
std::vector< uint > pipes_noutputs
 Number of outputs for each pipe.
svector< mstate< Tstate > > ins
 Inputs of each pipe.
svector< mstate< Tstate > > mbuffers
 Multi-state buffers.
bool replicate_inputs
 Replicate all inputs for each pipe.
midxdim switches
 Only propagate 1 pipe based on input sizes.
bool bindex
 If true, use switch id to switch.
intg switch_id
 Index of pipe to switch to.

Friends

class ms_module_gui
template<typename T1 , class Ts , class Tc >
EXPORT Tc * arch_find (ms_module< T1, Ts > *m, Tc *c)
template<typename T1 , class Ts , class Tc >
EXPORT std::vector< Tc * > arch_find_all (ms_module< T1, Ts > *m, Tc *c, std::vector< Tc * > *)
template<typename T1 , class Ts , class Tc >
EXPORT ms_module< T1, Ts > * arch_narrow (ms_module< T1, Ts > *m, Tc *c, bool i, bool *f)

Detailed Description

template<typename T, class Tstate = bbstate_idx<T>>
class ebl::ms_module< T, Tstate >

A container for one or multiple modules with one input and one output that processes a pipeline between a single-to-multi-state module and a multi-to-single-state module. Multiple pipes can be defined for multiple inputs, or a single pipe can be reused for all inputs.


Constructor & Destructor Documentation

template<typename T, class Tstate>
ebl::ms_module< T, Tstate >::ms_module ( std::vector< module_1_1< T, Tstate > * > &  pipes,
bool  replicate_inputs = false,
const char *  name = "ms_module< T, Tstate >" 
)

Constructor a multi-state module where each state goes through one of 'pipes' pipe.


Member Function Documentation

template<typename T , class Tstate >
fidxdim ebl::ms_module< T, Tstate >::bprop_size ( const fidxdim &  o_size) [virtual]

given the output dimensions, returns the input dimensions. the implementation of this method helps automatic scaling of input data but is optional.

Reimplemented from ebl::module_1_1< T, Tstate, Tstate >.

Reimplemented in ebl::msc_module< T, Tstate >.

template<typename T , class Tstate >
mfidxdim ebl::ms_module< T, Tstate >::bprop_size ( mfidxdim &  o_size) [virtual]

Given the multi-output dimensions, returns the multi-input dimensions. the implementation of this method helps automatic scaling of input data but is optional.

Reimplemented from ebl::module_1_1< T, Tstate, Tstate >.

Reimplemented in ebl::msc_module< T, Tstate >.

template<typename T , class Tstate>
void ebl::ms_module< T, Tstate >::dump_fprop ( mstate< Tstate > &  in,
mstate< Tstate > &  out 
) [virtual]

Calls fprop and then dumps internal buffers, inputs and outputs into files. This can be useful for debugging.

Reimplemented from ebl::module_1_1< T, Tstate, Tstate >.

template<typename T , class Tstate >
fidxdim ebl::ms_module< T, Tstate >::fprop_size ( fidxdim &  i_size) [virtual]

given the input dimensions, modifies it to be compliant with module's architecture, and returns the output dimensions corresponding to modified input dimensions. the implementation of this method helps automatic scaling of input data but is optional.

Reimplemented from ebl::module_1_1< T, Tstate, Tstate >.

Reimplemented in ebl::msc_module< T, Tstate >.

template<typename T , class Tstate >
mfidxdim ebl::ms_module< T, Tstate >::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 from ebl::module_1_1< T, Tstate, Tstate >.

template<typename T , class Tstate >
module_1_1< T, Tstate > * ebl::ms_module< T, Tstate >::last_module ( ) [virtual]

Returns the last module contained in this module, or itself if composed of only 1 module.

Reimplemented from ebl::module_1_1< T, Tstate, Tstate >.

template<typename T , class Tstate >
std::string ebl::ms_module< T, Tstate >::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 from ebl::module_1_1< T, Tstate, Tstate >.

template<typename T , class Tstate >
std::string ebl::ms_module< T, Tstate >::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 from ebl::module_1_1< T, Tstate, Tstate >.


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