PLearn 0.1
|
#include <ExtractVariable.h>
Public Member Functions | |
ExtractVariable () | |
Default constructor for persistence. | |
ExtractVariable (Variable *v, int the_offset, int the_length, int the_width) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual ExtractVariable * | 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 () |
Nothing to do by default. | |
virtual void | bprop () |
Nothing to do by default. | |
virtual void | bbprop () |
compute an approximation to diag(d^2/dinput^2) given diag(d^2/doutput^2), with diag(d^2/dinput^2) ~=~ (doutput/dinput)' diag(d^2/doutput^2) (doutput/dinput) In particular: if 'C' depends on 'y' and 'y' depends on x ... | |
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_ () |
ExtractVariable. | |
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 Attributes | |
int | offset_ |
int | length_ |
int | width_ |
Private Types | |
typedef UnaryVariable | inherited |
Private Member Functions | |
void | build_ () |
Object-specific post-constructor. |
Definition at line 51 of file ExtractVariable.h.
typedef UnaryVariable PLearn::ExtractVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 56 of file ExtractVariable.h.
PLearn::ExtractVariable::ExtractVariable | ( | ) | [inline] |
string PLearn::ExtractVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.cc.
OptionList & PLearn::ExtractVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.cc.
RemoteMethodMap & PLearn::ExtractVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.cc.
Object * PLearn::ExtractVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.cc.
StaticInitializer ExtractVariable::_static_initializer_ & PLearn::ExtractVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.cc.
void PLearn::ExtractVariable::bbprop | ( | ) | [virtual] |
compute an approximation to diag(d^2/dinput^2) given diag(d^2/doutput^2), with diag(d^2/dinput^2) ~=~ (doutput/dinput)' diag(d^2/doutput^2) (doutput/dinput) In particular: if 'C' depends on 'y' and 'y' depends on x ...
d^2C/dx^2 = d^2C/dy^2 * (dy/dx)^2 + dC/dy * d^2y/dx^2 (diaghessian) (gradient)
Reimplemented from PLearn::Variable.
Definition at line 107 of file ExtractVariable.cc.
References PLERROR.
{ PLERROR("In SVDVariable::bbprop: feature not implemented"); }
void PLearn::ExtractVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 95 of file ExtractVariable.cc.
References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, PLearn::Variable::length(), PLearn::Var::length(), PLearn::min(), offset_, and PLearn::Variable::width().
{ real* inputgradient = input->gradientdata+offset_; int cnt = min(input->length()-offset_,length()*width()); for(int i=0; i<cnt; i++) { inputgradient[i] += gradientdata[i]; } }
void PLearn::ExtractVariable::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::UnaryVariable.
Definition at line 66 of file ExtractVariable.cc.
References PLearn::UnaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::ExtractVariable::build_ | ( | ) | [private] |
Object-specific post-constructor.
This method should be redefined in subclasses and do the actual building of the object according to previously set option fields. Constructors can just set option fields, and then call build_. This method is NOT virtual, and will typically be called only from three places: a constructor, the public virtual build()
method, and possibly the public virtual read method (which calls its parent's read). build_()
can assume that its parent's build_()
has already been called.
Reimplemented from PLearn::UnaryVariable.
Definition at line 72 of file ExtractVariable.cc.
References PLearn::UnaryVariable::input, offset_, and PLERROR.
Referenced by build(), and ExtractVariable().
{ if (input) { // input is v from constructor if(offset_ < 0) PLERROR("In ExtractVariable: requested matrix is out of bounds"); } }
string PLearn::ExtractVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.cc.
static const PPath& PLearn::ExtractVariable::declaringFile | ( | ) | [inline, static] |
ExtractVariable * PLearn::ExtractVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.cc.
void PLearn::ExtractVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 84 of file ExtractVariable.cc.
References i, PLearn::UnaryVariable::input, PLearn::Variable::length(), PLearn::Var::length(), PLearn::min(), offset_, PLearn::Variable::valuedata, and PLearn::Variable::width().
{ real* inputdata = input->valuedata+offset_; int cnt = min(input->length()-offset_,length()*width()); for(int i=0; i<cnt; i++) { valuedata[i] = inputdata[i]; } }
OptionList & PLearn::ExtractVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.cc.
OptionMap & PLearn::ExtractVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.cc.
RemoteMethodMap & PLearn::ExtractVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file ExtractVariable.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 81 of file ExtractVariable.cc.
void PLearn::ExtractVariable::rfprop | ( | ) | [virtual] |
Reimplemented from PLearn::Variable.
Definition at line 118 of file ExtractVariable.cc.
References PLERROR.
{ PLERROR("In SVDVariable::rfprop: feature not implemented"); }
void PLearn::ExtractVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 112 of file ExtractVariable.cc.
References PLERROR.
{ PLERROR("In SVDVariable::symbolicBprop: feature not implemented"); }
Reimplemented from PLearn::UnaryVariable.
Definition at line 69 of file ExtractVariable.h.
int PLearn::ExtractVariable::length_ [protected] |
Definition at line 61 of file ExtractVariable.h.
Referenced by recomputeSize().
int PLearn::ExtractVariable::offset_ [protected] |
Definition at line 60 of file ExtractVariable.h.
int PLearn::ExtractVariable::width_ [protected] |
Definition at line 61 of file ExtractVariable.h.
Referenced by recomputeSize().