PLearn 0.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes
PLearn::LogSumVariable Class Reference

#include <LogSumVariable.h>

Inheritance diagram for PLearn::LogSumVariable:
Inheritance graph
[legend]
Collaboration diagram for PLearn::LogSumVariable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LogSumVariable (Variable *input)
 LogSumVariable.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual LogSumVariabledeepCopy (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 PPathdeclaringFile ()

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

Detailed Description

Definition at line 52 of file LogSumVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file LogSumVariable.h.


Constructor & Destructor Documentation

PLearn::LogSumVariable::LogSumVariable ( ) [inline, protected]

Default constructor for persistence.

Definition at line 57 of file LogSumVariable.h.

{}
PLearn::LogSumVariable::LogSumVariable ( Variable input)

LogSumVariable.

Definition at line 55 of file LogSumVariable.cc.

    :UnaryVariable(input,1,1),input_softmax(input->nelems()) {}

Member Function Documentation

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.

bool PLearn::LogSumVariable::_isa_ ( const Object o) [static]

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().

Here is the call graph for this function:

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.

{
    valuedata[0] = logadd(input->value);
}

Here is the call graph for this function:

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);
      ...
  }
Parameters:
copiesA 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().

Here is the call graph for this function:

void PLearn::LogSumVariable::recomputeSize ( int l,
int w 
) const [virtual]

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().

{
    input->accg(g*softmax(input));
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 63 of file LogSumVariable.h.

Definition at line 60 of file LogSumVariable.h.

Referenced by bprop(), and makeDeepCopyFromShallowCopy().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines