PLearn 0.1
|
elementwise pow (returns 0 wherever input is negative) More...
#include <PowVariable.h>
Public Member Functions | |
PowVariable () | |
Default constructor for persistence. | |
PowVariable (Variable *input, real the_power) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual PowVariable * | deepCopy (CopiesMap &copies) const |
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 | symbolicBprop () |
compute a piece of new Var graph that represents the symbolic derivative of this Var | |
Static Public Member Functions | |
static string | _classname_ () |
PowVariable. | |
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 void | declareOptions (OptionList &ol) |
Declare options (data fields) for the class. | |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Attributes | |
real | power |
Private Types | |
typedef UnaryVariable | inherited |
elementwise pow (returns 0 wherever input is negative)
Definition at line 54 of file PowVariable.h.
typedef UnaryVariable PLearn::PowVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 56 of file PowVariable.h.
PLearn::PowVariable::PowVariable | ( | ) | [inline] |
string PLearn::PowVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.cc.
OptionList & PLearn::PowVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.cc.
RemoteMethodMap & PLearn::PowVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.cc.
Object * PLearn::PowVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.cc.
StaticInitializer PowVariable::_static_initializer_ & PLearn::PowVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.cc.
void PLearn::PowVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 84 of file PowVariable.cc.
References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, PLearn::mypow(), PLearn::Variable::nelems(), and power.
{ for(int i=0; i<nelems(); i++) input->gradientdata[i] += power*gradientdata[i]*mypow(input->valuedata[i],power-1.0); }
string PLearn::PowVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.cc.
void PLearn::PowVariable::declareOptions | ( | OptionList & | ol | ) | [static] |
Declare options (data fields) for the class.
Redefine this in subclasses: call declareOption
(...) for each option, and then call inherited::declareOptions(options)
. Please call the inherited
method AT THE END to get the options listed in a consistent order (from most recently defined to least recently defined).
static void MyDerivedClass::declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "The size of the input; it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "The learned model weights"); inherited::declareOptions(ol); }
ol | List of options that is progressively being constructed for the current class. |
Reimplemented from PLearn::UnaryVariable.
Definition at line 62 of file PowVariable.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::UnaryVariable::declareOptions(), and power.
{ declareOption(ol, "power", &PowVariable::power, OptionBase::buildoption, ""); inherited::declareOptions(ol); }
static const PPath& PLearn::PowVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 66 of file PowVariable.h.
{ return new PowVariable(v,power); }
PowVariable * PLearn::PowVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.cc.
void PLearn::PowVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 77 of file PowVariable.cc.
References i, PLearn::UnaryVariable::input, PLearn::mypow(), PLearn::Variable::nelems(), power, and PLearn::Variable::valuedata.
OptionList & PLearn::PowVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.cc.
OptionMap & PLearn::PowVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.cc.
RemoteMethodMap & PLearn::PowVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PowVariable.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 68 of file PowVariable.cc.
References PLearn::UnaryVariable::input, PLearn::Var::length(), and PLearn::Var::width().
void PLearn::PowVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 91 of file PowVariable.cc.
References PLearn::Variable::g, PLearn::UnaryVariable::input, PLearn::pow(), and power.
Reimplemented from PLearn::UnaryVariable.
Definition at line 66 of file PowVariable.h.
real PLearn::PowVariable::power [protected] |
Definition at line 59 of file PowVariable.h.
Referenced by bprop(), declareOptions(), fprop(), and symbolicBprop().