PLearn 0.1
|
#include <LogVariable.h>
Public Member Functions | |
LogVariable () | |
Default constructor for persistence. | |
LogVariable (Variable *input) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual LogVariable * | 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 | |
virtual void | rfprop () |
Static Public Member Functions | |
static string | _classname_ () |
LogVariable. | |
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_ |
Private Types | |
typedef UnaryVariable | inherited |
Definition at line 52 of file LogVariable.h.
typedef UnaryVariable PLearn::LogVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file LogVariable.h.
PLearn::LogVariable::LogVariable | ( | ) | [inline] |
PLearn::LogVariable::LogVariable | ( | Variable * | input | ) |
string PLearn::LogVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.cc.
OptionList & PLearn::LogVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.cc.
RemoteMethodMap & PLearn::LogVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.cc.
Object * PLearn::LogVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.cc.
StaticInitializer LogVariable::_static_initializer_ & PLearn::LogVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.cc.
void PLearn::LogVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 103 of file LogVariable.cc.
References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, PLearn::Variable::nelems(), and PLASSERT.
{ PLASSERT( input && input->gradientdata == input->gradient.data() ); for(int i=0; i<nelems(); i++) if (input->valuedata[i]>0) input->gradientdata[i] += gradientdata[i]/input->valuedata[i]; }
string PLearn::LogVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.cc.
static const PPath& PLearn::LogVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 61 of file LogVariable.h.
{ return new LogVariable(v); }
LogVariable * PLearn::LogVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.cc.
void PLearn::LogVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 79 of file LogVariable.cc.
References PLearn::displayVarGraph(), PLearn::endl(), i, PLearn::UnaryVariable::input, PLearn::Variable::nelems(), PLASSERT, PLERROR, PLearn::pout, PLearn::safeflog(), and PLearn::Variable::valuedata.
{ PLASSERT( input && nelems() == input->nelems() ); for(int i=0; i<nelems(); i++) { valuedata[i] = safeflog(input->valuedata[i]); #ifdef BOUNDCHECK real val = valuedata[i]; real ival = input->valuedata[i]; if (!finite(val) && finite(ival)) { //PLWARNING("LogVariable::fprop something is wrong"); pout << "inputdata[i]= " << input->valuedata[i] << endl; pout << "valuedata[i]= " << valuedata[i] << endl; displayVarGraph(this, true, 250); PLERROR("LogVariable::fprop Something is wrong"); } #endif } }
OptionList & PLearn::LogVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.cc.
OptionMap & PLearn::LogVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.cc.
RemoteMethodMap & PLearn::LogVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 58 of file LogVariable.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 67 of file LogVariable.cc.
References PLearn::UnaryVariable::input, PLearn::Var::length(), and PLearn::Var::width().
void PLearn::LogVariable::rfprop | ( | ) | [virtual] |
Reimplemented from PLearn::Variable.
Definition at line 123 of file LogVariable.cc.
References i, PLearn::UnaryVariable::input, PLearn::TVec< T >::length(), PLearn::Variable::nelems(), PLearn::UnaryVariable::resizeRValue(), PLearn::Variable::rValue, and PLearn::Variable::rvaluedata.
{ if (rValue.length()==0) resizeRValue(); for(int i=0; i<nelems(); i++) rvaluedata[i] = input->rvaluedata[i] / input->valuedata[i]; }
void PLearn::LogVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 114 of file LogVariable.cc.
References PLearn::Variable::g, and PLearn::UnaryVariable::input.
Reimplemented from PLearn::UnaryVariable.
Definition at line 61 of file LogVariable.h.