PLearn 0.1
|
#include <LogSumVariable.h>
Public Member Functions | |
LogSumVariable (Variable *input) | |
LogSumVariable. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual LogSumVariable * | 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 | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be. | |
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_ () |
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 Types | |
typedef UnaryVariable | inherited |
Protected Member Functions | |
LogSumVariable () | |
Default constructor for persistence. | |
Protected Attributes | |
Vec | input_softmax |
Definition at line 52 of file LogSumVariable.h.
typedef UnaryVariable PLearn::LogSumVariable::inherited [protected] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file LogSumVariable.h.
PLearn::LogSumVariable::LogSumVariable | ( | ) | [inline, protected] |
PLearn::LogSumVariable::LogSumVariable | ( | Variable * | input | ) |
Definition at line 55 of file LogSumVariable.cc.
:UnaryVariable(input,1,1),input_softmax(input->nelems()) {}
string PLearn::LogSumVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
OptionList & PLearn::LogSumVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
RemoteMethodMap & PLearn::LogSumVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
Object * PLearn::LogSumVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
StaticInitializer LogSumVariable::_static_initializer_ & PLearn::LogSumVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
void PLearn::LogSumVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 84 of file LogSumVariable.cc.
References PLearn::Variable::gradientdata, PLearn::UnaryVariable::input, input_softmax, PLearn::multiplyAcc(), and PLearn::softmax().
{ softmax(input->value,input_softmax); multiplyAcc(input->gradient, input_softmax,gradientdata[0]); }
string PLearn::LogSumVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
static const PPath& PLearn::LogSumVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 63 of file LogSumVariable.h.
{ return new LogSumVariable(input); }
LogSumVariable * PLearn::LogSumVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
void PLearn::LogSumVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 78 of file LogSumVariable.cc.
References PLearn::UnaryVariable::input, PLearn::logadd(), and PLearn::Variable::valuedata.
OptionList & PLearn::LogSumVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
OptionMap & PLearn::LogSumVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
RemoteMethodMap & PLearn::LogSumVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 59 of file LogSumVariable.cc.
void PLearn::LogSumVariable::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be.
This needs to be overridden by every class that adds "complex" data members to the class, such as Vec
, Mat
, PP<Something>
, etc. Typical implementation:
void CLASS_OF_THIS::makeDeepCopyFromShallowCopy(CopiesMap& copies) { inherited::makeDeepCopyFromShallowCopy(copies); deepCopyField(complex_data_member1, copies); deepCopyField(complex_data_member2, copies); ... }
copies | A map used by the deep-copy mechanism to keep track of already-copied objects. |
Reimplemented from PLearn::UnaryVariable.
Definition at line 71 of file LogSumVariable.cc.
References PLearn::deepCopyField(), input_softmax, and PLearn::UnaryVariable::makeDeepCopyFromShallowCopy().
{ inherited::makeDeepCopyFromShallowCopy(copies); deepCopyField(input_softmax, copies); }
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 61 of file LogSumVariable.cc.
{ l=1; w=1; }
void PLearn::LogSumVariable::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 LogSumVariable.cc.
References PLearn::Variable::g, PLearn::UnaryVariable::input, and PLearn::softmax().
Reimplemented from PLearn::UnaryVariable.
Definition at line 63 of file LogSumVariable.h.
Vec PLearn::LogSumVariable::input_softmax [protected] |
Definition at line 60 of file LogSumVariable.h.
Referenced by bprop(), and makeDeepCopyFromShallowCopy().