PLearn 0.1
|
Variable that is the row of the input1 variable indexed by the input2 variable. More...
#include <VarRowVariable.h>
Public Member Functions | |
VarRowVariable () | |
Default constructor for persistence. | |
VarRowVariable (Variable *input1, Variable *input2) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual VarRowVariable * | 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 | |
virtual void | rfprop () |
Static Public Member Functions | |
static string | _classname_ () |
VarRowVariable. | |
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 the row of the input1 variable indexed by the input2 variable.
Definition at line 54 of file VarRowVariable.h.
typedef BinaryVariable PLearn::VarRowVariable::inherited [private] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 56 of file VarRowVariable.h.
PLearn::VarRowVariable::VarRowVariable | ( | ) | [inline] |
string PLearn::VarRowVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 53 of file VarRowVariable.cc.
OptionList & PLearn::VarRowVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 53 of file VarRowVariable.cc.
RemoteMethodMap & PLearn::VarRowVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 53 of file VarRowVariable.cc.
Reimplemented from PLearn::BinaryVariable.
Definition at line 53 of file VarRowVariable.cc.
Object * PLearn::VarRowVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Definition at line 53 of file VarRowVariable.cc.
StaticInitializer VarRowVariable::_static_initializer_ & PLearn::VarRowVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 53 of file VarRowVariable.cc.
void PLearn::VarRowVariable::bprop | ( | ) | [virtual] |
Implements PLearn::Variable.
Definition at line 95 of file VarRowVariable.cc.
References PLearn::Variable::gradient, i, PLearn::BinaryVariable::input1, and PLearn::BinaryVariable::input2.
void PLearn::VarRowVariable::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 62 of file VarRowVariable.cc.
References PLearn::BinaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::VarRowVariable::build_ | ( | ) | [protected] |
This does the actual building.
Reimplemented from PLearn::BinaryVariable.
Definition at line 69 of file VarRowVariable.cc.
References PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, and PLERROR.
Referenced by build(), and VarRowVariable().
{ if (input1 && input2) { if (!input2->isScalar()) PLERROR("IN VarRowVariable(Variable* input1, Variable* input2) input2 must be scalar as it is supposed to be an integer index"); input1->allowPartialUpdates(); } }
string PLearn::VarRowVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file VarRowVariable.cc.
static const PPath& PLearn::VarRowVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 63 of file VarRowVariable.h.
: void build_();
VarRowVariable * PLearn::VarRowVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::BinaryVariable.
Definition at line 53 of file VarRowVariable.cc.
void PLearn::VarRowVariable::fprop | ( | ) | [virtual] |
compute output given input
Implements PLearn::Variable.
Definition at line 88 of file VarRowVariable.cc.
References i, PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, and PLearn::Variable::value.
OptionList & PLearn::VarRowVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file VarRowVariable.cc.
OptionMap & PLearn::VarRowVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file VarRowVariable.cc.
RemoteMethodMap & PLearn::VarRowVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file VarRowVariable.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 79 of file VarRowVariable.cc.
References PLearn::BinaryVariable::input1, and PLearn::Var::width().
void PLearn::VarRowVariable::rfprop | ( | ) | [virtual] |
Reimplemented from PLearn::Variable.
Definition at line 110 of file VarRowVariable.cc.
References i, PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, PLearn::TVec< T >::length(), PLearn::BinaryVariable::resizeRValue(), and PLearn::Variable::rValue.
{ if (rValue.length()==0) resizeRValue(); int i = int(input2->valuedata[0]); rValue << input1->matRValue(i); }
void PLearn::VarRowVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 104 of file VarRowVariable.cc.
References PLearn::Variable::g, PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, and PLearn::Var::length().
Reimplemented from PLearn::BinaryVariable.
Definition at line 63 of file VarRowVariable.h.