PLearn 0.1
|
#include <VarRowsVariable.h>
Public Member Functions | |
VarRowsVariable () | |
Default constructor for persistence. | |
VarRowsVariable (Variable *input1, Variable *input2) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual VarRowsVariable * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Post-constructor. | |
virtual void | recomputeSize (int &l, int &w) const |
Recomputes the length l and width w that this variable should have, according to its parent variables. | |
virtual void | fprop () |
compute output given input | |
virtual void | bprop () |
virtual void | symbolicBprop () |
compute a piece of new Var graph that represents the symbolic derivative of this Var | |
Static Public Member Functions | |
static string | _classname_ () |
VarRowsVariable. | |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static Object * | _new_instance_for_typemap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Member Functions | |
void | build_ () |
This does the actual building. | |
Private Types | |
typedef BinaryVariable | inherited |
Variable that is a subset of a matrix's rows input1 : matrix from which rows are selected input2 : vector whose elements are row indices in input1
Definition at line 56 of file VarRowsVariable.h.
typedef BinaryVariable PLearn::VarRowsVariable::inherited [private] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 58 of file VarRowsVariable.h.
PLearn::VarRowsVariable::VarRowsVariable | ( | ) | [inline] |
string PLearn::VarRowsVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 55 of file VarRowsVariable.cc.
OptionList & PLearn::VarRowsVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 55 of file VarRowsVariable.cc.
RemoteMethodMap & PLearn::VarRowsVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 55 of file VarRowsVariable.cc.
Reimplemented from PLearn::BinaryVariable.
Definition at line 55 of file VarRowsVariable.cc.
Object * PLearn::VarRowsVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Definition at line 55 of file VarRowsVariable.cc.
StaticInitializer VarRowsVariable::_static_initializer_ & PLearn::VarRowsVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 55 of file VarRowsVariable.cc.
void PLearn::VarRowsVariable::bprop | ( | ) | [virtual] |
Implements PLearn::Variable.
Definition at line 92 of file VarRowsVariable.cc.
References i, PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, PLearn::Var::length(), PLearn::Variable::matGradient, PLearn::TMat< T >::row(), and PLearn::Var::row().
{ for (int i = 0; i < input2->length(); ++i) { int r=int(input2->value[i]); input1->matGradient.row(r) += matGradient.row(i); input1->updateRow(r); } }
void PLearn::VarRowsVariable::build | ( | ) | [virtual] |
Post-constructor.
The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.
Reimplemented from PLearn::BinaryVariable.
Definition at line 64 of file VarRowsVariable.cc.
References PLearn::BinaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::VarRowsVariable::build_ | ( | ) | [protected] |
This does the actual building.
Reimplemented from PLearn::BinaryVariable.
Definition at line 71 of file VarRowsVariable.cc.
References PLearn::BinaryVariable::input1.
Referenced by build(), and VarRowsVariable().
string PLearn::VarRowsVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 55 of file VarRowsVariable.cc.
static const PPath& PLearn::VarRowsVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 65 of file VarRowsVariable.h.
: void build_();
VarRowsVariable * PLearn::VarRowsVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 55 of file VarRowsVariable.cc.
void PLearn::VarRowsVariable::fprop | ( | ) | [virtual] |
compute output given input
Implements PLearn::Variable.
Definition at line 86 of file VarRowsVariable.cc.
References PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, and PLearn::Variable::matValue.
OptionList & PLearn::VarRowsVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 55 of file VarRowsVariable.cc.
OptionMap & PLearn::VarRowsVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 55 of file VarRowsVariable.cc.
RemoteMethodMap & PLearn::VarRowsVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 55 of file VarRowsVariable.cc.
Recomputes the length l and width w that this variable should have, according to its parent variables.
This is used for ex. by sizeprop() The default version stupidly returns the current dimensions, so make sure to overload it in subclasses if this is not appropriate.
Reimplemented from PLearn::Variable.
Definition at line 77 of file VarRowsVariable.cc.
References PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, PLearn::Var::length(), and PLearn::Var::width().
void PLearn::VarRowsVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 103 of file VarRowsVariable.cc.
References PLERROR.
{ PLERROR("VarRowsVariable::symbolicBprop() not implemented"); }
Reimplemented from PLearn::BinaryVariable.
Definition at line 65 of file VarRowsVariable.h.