Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::Variable Class Reference

#include <Variable.h>

Inheritance diagram for PLearn::Variable:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef Object inherited

Public Member Functions

 Variable (int thelength, int thewidth)
 Variable (const Mat &m)
 this variable's value and m will be views of the same data

int length () const
int width () const
int size () const
int nelems () 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.

void resize (int l, int w)
 resizes the matValue and matGradient fields of this variable (and updates the value, gradient, valuedata and gradientdata fields accordingly)

void sizeprop ()
 resizes value and gradient fields according to size given by recomputeSize(...) This corresponds to "propagating" the size from its parent's size, much as fprop propagates the values

virtual void setParents (const VarArray &parents)
 set this Variable's parents. To use with default constructor.

 Variable (const Variable &v)
 Copy constructor.

virtual void build ()
 Should call simply inherited::build(), then this class's build_().

bool isScalar () const
bool isVec () const
bool isColumnVec () const
bool isRowVec () const
 PLEARN_DECLARE_ABSTRACT_OBJECT (Variable)
virtual void makeDeepCopyFromShallowCopy (map< const void *, void * > &copies)
virtual void fprop ()=0
 compute output given input

void sizefprop ()
 compute dC/dinput given dC/doutput Calls sizeprop, then fprop

virtual void bprop ()=0
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 fbprop ()
 do both fprop and bprop

virtual void fbbprop ()
 do fprop, bprop and bbprop

virtual void symbolicBprop ()
 compute a piece of new Var graph that represents the symbolic derivative of this Var

virtual void rfprop ()
virtual void copyValueInto (Vec v)
virtual void copyGradientInto (Vec g)
virtual void print (ostream &out) const
string getName () const
 returns the name of this variable.

void setName (const string &the_name)
 call this to set a name for this variable

bool nameIsSet ()
Mat defineGradientLocation (const Mat &m)
 Defines a new Mat to use as this Var's matGradient field, modifies gradient and graidentdata to keep consistent, and returns the previous matGradient.

virtual void printInfo (bool print_gradient=false)=0
virtual void printInfos (bool print_gradient=false)
Var subVec (int start, int len, bool transpose=false)
Var subMat (int i, int j, int sublength, int subwidth, bool transpose=false)
Var row (int i, bool transpose=false)
Var column (int j, bool transpose=false)
void setDontBpropHere (bool val)
void setKeepPositive ()
void setMinValue (real minv=-FLT_MAX)
void setMaxValue (real maxv=FLT_MAX)
void setBoxConstraint (real minv, real maxv)
void setMark ()
void clearMark ()
bool isMarked ()
void fillGradient (real value)
void clearGradient ()
void clearDiagHessian ()
void clearSymbolicGradient ()
bool update (real step_size, Vec direction_vec, real coeff=1.0, real b=0.0)
bool update (Vec step_sizes, Vec direction_vec, real coeff=1.0, real b=0.0)
void updateAndClear ()
 Does value += gradient; gradient.clear();.

bool update (real step_size)
void allowPartialUpdates ()
 send message that update may be sometimes needed on only parts of the Variable

void disallowPartialUpdates ()
 send message that updates must be full.

void updateRow (int row)
 says that given row has received gradient (should be updated on next call to update)

bool update (Vec new_value)
real maxUpdate (Vec direction)
virtual bool markPath ()=0
virtual void buildPath (VarArray &proppath)=0
 Finally buildPath is to be called from the output Variable of interest (this will build the proppath at the same time as erasing the marks).

virtual void oldread (istream &in)
 DEPRECATED For backward compatibility with old saved object.

virtual void write (ostream &out) const
void copyFrom (const Vec &v)
void copyTo (Vec &v)
void copyGradientFrom (const Vec &v)
void copyGradientTo (Vec &v)
void makeSharedValue (real *x, int n)
 like copyTo but also makes value's point to x

void makeSharedGradient (real *x, int n)
 like copyTo but also makes value's point to x

void makeSharedValue (PP< Storage< real > > storage, int offset_=0)
 make value and matValue point into this storage

void makeSharedGradient (PP< Storage< real > > storage, int offset_=0)
void makeSharedValue (Vec &v, int offset_=0)
void makeSharedGradient (Vec &v, int offset_=0)
void copyRValueFrom (const Vec &v)
void copyRValueTo (Vec &v)
void makeSharedRValue (real *x, int n)
 like copyTo but also makes value's point to x

void makeSharedRValue (PP< Storage< real > > storage, int offset_=0)
void makeSharedRValue (Vec &v, int offset_=0)
virtual bool isConstant ()
virtual void fprop_from_all_sources ()
virtual VarArray sources ()=0
 if not marked, find all constant sources that influence this Variable.

virtual VarArray random_sources ()=0
 return ancestors which compute a non-deterministic function of their parents

virtual VarArray ancestors ()=0
 if not marked, find all Variables that influence this Variable.

virtual void unmarkAncestors ()=0
 undo any marking done by a call to sources() or ancestors()

virtual VarArray parents ()=0
 returns all the direct parents of this Var that are not marked (the call doesn't change any mark)

virtual void accg (Var v)
 accumulate the symbolic gradient in a smart way...

virtual void verifyGradient (real step=0.001)
 call verify gradient for the mapping from all the sources to this Variable.

virtual void resizeDiagHessian ()
 resize the DiagHessian field

virtual void resizeRValue ()

Public Attributes

int varnum
 number of this variable (the first one created is numbered 1, the second 2, etc...)

Vec value
Vec gradient
Mat matValue
Mat matGradient
Vec rValue
Mat matRValue
Mat matDiagHessian
 optionally computed second derivative (see bbprop methods)

realvaluedata
 Set to value.data().

realgradientdata
 set to gradient.data()

real min_value
real max_value
 box constraints on values

Var g
 symbolic gradient used for symbolicBprop

Vec diaghessian
 optionally computed second derivative (see bbprop methods)

realdiaghessiandata
 set to diaghessian.data() or NULL if no diaghessian

realrvaluedata
bool dont_bprop_here
 if true, children are encouraged not to bprop gradient in this var (saves computation time)


Static Public Attributes

int nvars = 0
 keeps track of how many vars have been created (also used for the default naming scheme, see getName() )


Protected Member Functions

 Variable ()
 Default constructor for persistence.


Static Protected Member Functions

void declareOptions (OptionList &ol)
 redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)


Protected Attributes

bool marked
 used for building the propagation paths

string varname
 used when printing or drawing the var graph (see setName and getName)

bool allows_partial_update
 only if this is true then the following two fields are used.

int gradient_status
 0: no gradient was accumulated, 1: to some rows, 2: everywhere.

TVec< introws_to_update
 the list of rows to update.


Private Member Functions

void build_ ()

Member Typedef Documentation

typedef Object PLearn::Variable::inherited
 

Reimplemented from PLearn::Object.

Reimplemented in PLearn::AbsVariable, PLearn::AffineTransformVariable, PLearn::AffineTransformWeightPenalty, PLearn::ArgmaxVariable, PLearn::ArgminVariable, PLearn::BinaryClassificationLossVariable, PLearn::BinaryVariable, PLearn::ClassificationLossVariable, PLearn::ColumnIndexVariable, PLearn::ColumnSumVariable, PLearn::ConcatColumnsVariable, PLearn::ConcatOfVariable, PLearn::ConcatRowsVariable, PLearn::ConvolveVariable, PLearn::CrossEntropyVariable, PLearn::CutAboveThresholdVariable, PLearn::CutBelowThresholdVariable, PLearn::DeterminantVariable, PLearn::DiagonalizedFactorsProductVariable, PLearn::DilogarithmVariable, PLearn::DivVariable, PLearn::DotProductVariable, PLearn::DuplicateColumnVariable, PLearn::DuplicateRowVariable, PLearn::DuplicateScalarVariable, PLearn::ElementAtPositionVariable, PLearn::EqualConstantVariable, PLearn::EqualScalarVariable, PLearn::EqualVariable, PLearn::ErfVariable, PLearn::ExpVariable, PLearn::ExtendedVariable, PLearn::HardSlopeVariable, PLearn::IfThenElseVariable, PLearn::IndexAtPositionVariable, PLearn::InterValuesVariable, PLearn::InvertElementsVariable, PLearn::IsAboveThresholdVariable, PLearn::IsLargerVariable, PLearn::IsMissingVariable, PLearn::IsSmallerVariable, PLearn::LeftPseudoInverseVariable, PLearn::LiftOutputVariable, PLearn::LogAddVariable, PLearn::LogSoftmaxVariable, PLearn::LogSumVariable, PLearn::LogVariable, PLearn::MarginPerceptronCostVariable, PLearn::MatrixAffineTransformFeedbackVariable, PLearn::MatrixAffineTransformVariable, PLearn::MatrixElementsVariable, PLearn::MatrixInverseVariable, PLearn::MatrixOneHotSquaredLoss, PLearn::MatrixSoftmaxLossVariable, PLearn::MatrixSoftmaxVariable, PLearn::MatrixSumOfVariable, PLearn::MatRowVariable, PLearn::Max2Variable, PLearn::MaxVariable, PLearn::MiniBatchClassificationLossVariable, PLearn::MinusColumnVariable, PLearn::MinusRowVariable, PLearn::MinusScalarVariable, PLearn::MinusTransposedColumnVariable, PLearn::MinusVariable, PLearn::MinVariable, PLearn::MulticlassLossVariable, PLearn::NaryVariable, PLearn::NegateElementsVariable, PLearn::NegCrossEntropySigmoidVariable, PLearn::NllSemisphericalGaussianVariable, PLearn::OneHotSquaredLoss, PLearn::OneHotVariable, PLearn::PDistributionVariable, PLearn::PLogPVariable, PLearn::PlusColumnVariable, PLearn::PlusConstantVariable, PLearn::PlusRowVariable, PLearn::PlusScalarVariable, PLearn::PlusVariable, PLearn::PowVariable, PLearn::PowVariableVariable, PLearn::ProductTransposeVariable, PLearn::ProductVariable, PLearn::ProjectionErrorVariable, PLearn::ReshapeVariable, PLearn::RightPseudoInverseVariable, PLearn::RowAtPositionVariable, PLearn::RowSumVariable, PLearn::SemiSupervisedProbClassCostVariable, PLearn::SigmoidVariable, PLearn::SignVariable, PLearn::SoftmaxLossVariable, PLearn::SoftmaxVariable, PLearn::SoftplusVariable, PLearn::SoftSlopeIntegralVariable, PLearn::SoftSlopeVariable, PLearn::SourceVariable, PLearn::SquareRootVariable, PLearn::SquareVariable, PLearn::SubMatTransposeVariable, PLearn::SubMatVariable, PLearn::SubsampleVariable, PLearn::SumAbsVariable, PLearn::SumOfVariable, PLearn::SumOverBagsVariable, PLearn::SumSquareVariable, PLearn::SumVariable, PLearn::TanhVariable, PLearn::TimesColumnVariable, PLearn::TimesConstantVariable, PLearn::TimesRowVariable, PLearn::TimesScalarVariable, PLearn::TimesVariable, PLearn::TransposeProductVariable, PLearn::UnaryHardSlopeVariable, PLearn::UnaryVariable, PLearn::UnequalConstantVariable, PLearn::UnfoldedFuncVariable, PLearn::UnfoldedSumOfVariable, PLearn::VarArrayElementVariable, PLearn::VarColumnsVariable, PLearn::VarElementVariable, PLearn::VarRowsVariable, PLearn::VarRowVariable, PLearn::VecElementVariable, and PLearn::WeightedSumSquareVariable.

Definition at line 103 of file Variable.h.


Constructor & Destructor Documentation

PLearn::Variable::Variable  )  [inline, protected]
 

Default constructor for persistence.

Definition at line 107 of file Variable.h.

References allows_partial_update, dont_bprop_here, gradient_status, gradientdata, marked, max_value, min_value, nvars, valuedata, varname, and varnum.

PLearn::Variable::Variable int  thelength,
int  thewidth
 

Definition at line 167 of file Variable.cc.

References PLearn::TVec< T >::data(), gradient, gradientdata, matGradient, matValue, PLearn::TMat< T >::toVec(), value, and valuedata.

PLearn::Variable::Variable const Mat m  ) 
 

this variable's value and m will be views of the same data

Definition at line 180 of file Variable.cc.

References PLearn::TVec< T >::data(), gradient, gradientdata, PLearn::TMat< T >::isCompact(), matGradient, matValue, PLERROR, PLearn::TMat< T >::toVec(), value, and valuedata.

PLearn::Variable::Variable const Variable v  ) 
 

Copy constructor.

Definition at line 196 of file Variable.cc.


Member Function Documentation

void PLearn::Variable::accg Var  v  )  [virtual]
 

accumulate the symbolic gradient in a smart way...

Definition at line 384 of file Variable.cc.

References g, length(), PLearn::Var::length(), width(), and PLearn::Var::width().

void PLearn::Variable::allowPartialUpdates  )  [inline]
 

send message that update may be sometimes needed on only parts of the Variable

Definition at line 302 of file Variable.h.

References allows_partial_update, gradient_status, length(), PLearn::TVec< int >::resize(), and rows_to_update.

virtual VarArray PLearn::Variable::ancestors  )  [pure virtual]
 

if not marked, find all Variables that influence this Variable.

Implemented in PLearn::BinaryVariable, PLearn::NaryVariable, PLearn::SourceVariable, and PLearn::UnaryVariable.

Referenced by printInfos().

void PLearn::Variable::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 in PLearn::DotProductVariable, PLearn::LogSoftmaxVariable, PLearn::MatrixSoftmaxLossVariable, PLearn::MatrixSoftmaxVariable, PLearn::MinusColumnVariable, PLearn::MinusRowVariable, PLearn::MinusScalarVariable, PLearn::MinusVariable, PLearn::NegateElementsVariable, PLearn::PDistributionVariable, PLearn::PlusColumnVariable, PLearn::PlusRowVariable, PLearn::PlusScalarVariable, PLearn::PlusVariable, PLearn::ProductTransposeVariable, PLearn::ProductVariable, PLearn::SigmoidVariable, PLearn::SoftmaxLossVariable, PLearn::SoftmaxVariable, PLearn::SourceVariable, PLearn::SquareVariable, PLearn::SubMatVariable, PLearn::TanhVariable, and PLearn::TransposeProductVariable.

Definition at line 323 of file Variable.cc.

References c_str(), PLearn::Object::classname(), and PLERROR.

Referenced by fbbprop().

virtual void PLearn::Variable::bprop  )  [pure virtual]
 

Implemented in PLearn::SourceSampleVariable, PLearn::UnarySampleVariable, PLearn::BinarySampleVariable, PLearn::AbsVariable, PLearn::AffineTransformVariable, PLearn::AffineTransformWeightPenalty, PLearn::ArgmaxVariable, PLearn::ArgminOfVariable, PLearn::ArgminVariable, PLearn::BinaryClassificationLossVariable, PLearn::ClassificationLossVariable, PLearn::ColumnIndexVariable, PLearn::ColumnSumVariable, PLearn::ConcatColumnsVariable, PLearn::ConcatOfVariable, PLearn::ConcatRowsVariable, PLearn::ConvolveVariable, PLearn::CrossEntropyVariable, PLearn::CutAboveThresholdVariable, PLearn::CutBelowThresholdVariable, PLearn::DeterminantVariable, PLearn::DiagonalizedFactorsProductVariable, PLearn::DilogarithmVariable, PLearn::DivVariable, PLearn::DotProductVariable, PLearn::DuplicateColumnVariable, PLearn::DuplicateRowVariable, PLearn::DuplicateScalarVariable, PLearn::ElementAtPositionVariable, PLearn::EqualConstantVariable, PLearn::EqualScalarVariable, PLearn::EqualVariable, PLearn::ErfVariable, PLearn::ExpVariable, PLearn::ExtendedVariable, PLearn::HardSlopeVariable, PLearn::IfThenElseVariable, PLearn::IndexAtPositionVariable, PLearn::InterValuesVariable, PLearn::InvertElementsVariable, PLearn::IsAboveThresholdVariable, PLearn::IsLargerVariable, PLearn::IsMissingVariable, PLearn::IsSmallerVariable, PLearn::LeftPseudoInverseVariable, PLearn::LiftOutputVariable, PLearn::LogAddVariable, PLearn::LogSoftmaxVariable, PLearn::LogSumVariable, PLearn::LogVariable, PLearn::MarginPerceptronCostVariable, PLearn::MatrixAffineTransformFeedbackVariable, PLearn::MatrixAffineTransformVariable, PLearn::MatrixElementsVariable, PLearn::MatrixInverseVariable, PLearn::MatrixOneHotSquaredLoss, PLearn::MatrixSoftmaxLossVariable, PLearn::MatrixSoftmaxVariable, PLearn::MatrixSumOfVariable, PLearn::MatRowVariable, PLearn::Max2Variable, PLearn::MaxVariable, PLearn::MiniBatchClassificationLossVariable, PLearn::MinusColumnVariable, PLearn::MinusRowVariable, PLearn::MinusScalarVariable, PLearn::MinusTransposedColumnVariable, PLearn::MinusVariable, PLearn::MinVariable, PLearn::MulticlassLossVariable, PLearn::NegateElementsVariable, PLearn::NegCrossEntropySigmoidVariable, PLearn::NllSemisphericalGaussianVariable, PLearn::OneHotSquaredLoss, PLearn::OneHotVariable, PLearn::PDistributionVariable, PLearn::PLogPVariable, PLearn::PlusColumnVariable, PLearn::PlusConstantVariable, PLearn::PlusRowVariable, PLearn::PlusScalarVariable, PLearn::PlusVariable, PLearn::PowVariable, PLearn::PowVariableVariable, PLearn::ProductTransposeVariable, PLearn::ProductVariable, PLearn::ProjectionErrorVariable, PLearn::ReshapeVariable, PLearn::RightPseudoInverseVariable, PLearn::RowAtPositionVariable, PLearn::RowSumVariable, PLearn::SemiSupervisedProbClassCostVariable, PLearn::SigmoidVariable, PLearn::SignVariable, PLearn::SoftmaxLossVariable, PLearn::SoftmaxVariable, PLearn::SoftplusVariable, PLearn::SoftSlopeIntegralVariable, PLearn::SoftSlopeVariable, PLearn::SourceVariable, PLearn::SquareRootVariable, PLearn::SquareVariable, PLearn::SubMatTransposeVariable, PLearn::SubMatVariable, PLearn::SubsampleVariable, PLearn::SumAbsVariable, PLearn::SumOfVariable, PLearn::SumOverBagsVariable, PLearn::SumSquareVariable, PLearn::SumVariable, PLearn::TanhVariable, PLearn::TimesColumnVariable, PLearn::TimesConstantVariable, PLearn::TimesRowVariable, PLearn::TimesScalarVariable, PLearn::TimesVariable, PLearn::TransposeProductVariable, PLearn::UnaryHardSlopeVariable, PLearn::UnequalConstantVariable, PLearn::UnfoldedFuncVariable, PLearn::UnfoldedSumOfVariable, PLearn::VarArrayElementVariable, PLearn::VarColumnsVariable, PLearn::VarElementVariable, PLearn::VarRowsVariable, PLearn::VarRowVariable, PLearn::VecElementVariable, and PLearn::WeightedSumSquareVariable.

Referenced by fbbprop(), and fbprop().

void PLearn::Variable::build  )  [virtual]
 

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::Object.

Reimplemented in PLearn::AffineTransformVariable, PLearn::BinaryClassificationLossVariable, PLearn::ClassificationLossVariable, PLearn::ColumnIndexVariable, PLearn::ConcatColumnsVariable, PLearn::ConcatOfVariable, PLearn::ConcatRowsVariable, PLearn::CrossEntropyVariable, PLearn::DeterminantVariable, PLearn::DiagonalizedFactorsProductVariable, PLearn::DivVariable, PLearn::DotProductVariable, PLearn::DuplicateColumnVariable, PLearn::DuplicateRowVariable, PLearn::DuplicateScalarVariable, PLearn::ElementAtPositionVariable, PLearn::EqualScalarVariable, PLearn::EqualVariable, PLearn::ExtendedVariable, PLearn::IfThenElseVariable, PLearn::IndexAtPositionVariable, PLearn::InterValuesVariable, PLearn::IsLargerVariable, PLearn::IsSmallerVariable, PLearn::LeftPseudoInverseVariable, PLearn::LiftOutputVariable, PLearn::LogAddVariable, PLearn::MarginPerceptronCostVariable, PLearn::MatrixElementsVariable, PLearn::MatrixOneHotSquaredLoss, PLearn::MatrixSoftmaxLossVariable, PLearn::MatrixSumOfVariable, PLearn::MatRowVariable, PLearn::Max2Variable, PLearn::MiniBatchClassificationLossVariable, PLearn::MinusColumnVariable, PLearn::MinusRowVariable, PLearn::MinusScalarVariable, PLearn::MinusTransposedColumnVariable, PLearn::MinusVariable, PLearn::MulticlassLossVariable, PLearn::NegCrossEntropySigmoidVariable, PLearn::NllSemisphericalGaussianVariable, PLearn::OneHotSquaredLoss, PLearn::OneHotVariable, PLearn::PDistributionVariable, PLearn::PlusColumnVariable, PLearn::PlusRowVariable, PLearn::PlusScalarVariable, PLearn::PlusVariable, PLearn::PowVariableVariable, PLearn::ProductTransposeVariable, PLearn::ProductVariable, PLearn::ProjectionErrorVariable, PLearn::ReshapeVariable, PLearn::RightPseudoInverseVariable, PLearn::RowAtPositionVariable, PLearn::SemiSupervisedProbClassCostVariable, PLearn::SoftmaxLossVariable, PLearn::SubMatTransposeVariable, PLearn::SubMatVariable, PLearn::SubsampleVariable, PLearn::SumOfVariable, PLearn::SumOverBagsVariable, PLearn::TimesColumnVariable, PLearn::TimesRowVariable, PLearn::TimesScalarVariable, PLearn::TimesVariable, PLearn::TransposeProductVariable, PLearn::UnaryHardSlopeVariable, PLearn::UnfoldedFuncVariable, PLearn::UnfoldedSumOfVariable, PLearn::VarArrayElementVariable, PLearn::VarElementVariable, PLearn::VarRowsVariable, PLearn::VarRowVariable, PLearn::VecElementVariable, and PLearn::WeightedSumSquareVariable.

Definition at line 232 of file Variable.cc.

References build_().

void PLearn::Variable::build_  )  [private]
 

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 it's parent's build_ has already been called.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::AffineTransformVariable, PLearn::BinaryClassificationLossVariable, PLearn::ClassificationLossVariable, PLearn::ColumnIndexVariable, PLearn::ConcatColumnsVariable, PLearn::ConcatOfVariable, PLearn::ConcatRowsVariable, PLearn::CrossEntropyVariable, PLearn::DeterminantVariable, PLearn::DiagonalizedFactorsProductVariable, PLearn::DivVariable, PLearn::DotProductVariable, PLearn::DuplicateColumnVariable, PLearn::DuplicateRowVariable, PLearn::DuplicateScalarVariable, PLearn::ElementAtPositionVariable, PLearn::EqualScalarVariable, PLearn::EqualVariable, PLearn::ExtendedVariable, PLearn::IfThenElseVariable, PLearn::IndexAtPositionVariable, PLearn::InterValuesVariable, PLearn::IsLargerVariable, PLearn::IsSmallerVariable, PLearn::LeftPseudoInverseVariable, PLearn::LiftOutputVariable, PLearn::LogAddVariable, PLearn::MarginPerceptronCostVariable, PLearn::MatrixElementsVariable, PLearn::MatrixOneHotSquaredLoss, PLearn::MatrixSoftmaxLossVariable, PLearn::MatrixSumOfVariable, PLearn::MatRowVariable, PLearn::Max2Variable, PLearn::MiniBatchClassificationLossVariable, PLearn::MinusColumnVariable, PLearn::MinusRowVariable, PLearn::MinusScalarVariable, PLearn::MinusTransposedColumnVariable, PLearn::MinusVariable, PLearn::MulticlassLossVariable, PLearn::NegCrossEntropySigmoidVariable, PLearn::NllSemisphericalGaussianVariable, PLearn::OneHotSquaredLoss, PLearn::OneHotVariable, PLearn::PDistributionVariable, PLearn::PlusColumnVariable, PLearn::PlusRowVariable, PLearn::PlusScalarVariable, PLearn::PlusVariable, PLearn::PowVariableVariable, PLearn::ProductTransposeVariable, PLearn::ProductVariable, PLearn::ProjectionErrorVariable, PLearn::ReshapeVariable, PLearn::RightPseudoInverseVariable, PLearn::RowAtPositionVariable, PLearn::SemiSupervisedProbClassCostVariable, PLearn::SoftmaxLossVariable, PLearn::SubMatTransposeVariable, PLearn::SubMatVariable, PLearn::SubsampleVariable, PLearn::SumOfVariable, PLearn::SumOverBagsVariable, PLearn::TimesColumnVariable, PLearn::TimesRowVariable, PLearn::TimesScalarVariable, PLearn::TimesVariable, PLearn::TransposeProductVariable, PLearn::UnaryHardSlopeVariable, PLearn::UnfoldedFuncVariable, PLearn::UnfoldedSumOfVariable, PLearn::VarArrayElementVariable, PLearn::VarElementVariable, PLearn::VarRowsVariable, PLearn::VarRowVariable, PLearn::VecElementVariable, and PLearn::WeightedSumSquareVariable.

Definition at line 224 of file Variable.cc.

References recomputeSize(), and resize().

Referenced by build().

virtual void PLearn::Variable::buildPath VarArray proppath  )  [pure virtual]
 

Finally buildPath is to be called from the output Variable of interest (this will build the proppath at the same time as erasing the marks).

Implemented in PLearn::BinaryVariable, PLearn::NaryVariable, PLearn::SourceVariable, and PLearn::UnaryVariable.

void PLearn::Variable::clearDiagHessian  ) 
 

Definition at line 302 of file Variable.cc.

References PLearn::TVec< T >::clear(), diaghessian, and resizeDiagHessian().

void PLearn::Variable::clearGradient  )  [inline]
 

Definition at line 261 of file Variable.h.

References allows_partial_update, PLearn::TVec< T >::clear(), gradient, gradient_status, PLearn::TVec< int >::length(), matGradient, PLearn::TVec< int >::resize(), PLearn::TMat< T >::row(), and rows_to_update.

void PLearn::Variable::clearMark  )  [inline]
 

Definition at line 257 of file Variable.h.

References marked.

Referenced by PLearn::UnaryVariable::buildPath(), PLearn::SourceVariable::buildPath(), PLearn::NaryVariable::buildPath(), PLearn::BinaryVariable::buildPath(), and PLearn::SourceVariable::unmarkAncestors().

void PLearn::Variable::clearSymbolicGradient  )  [inline]
 

Definition at line 277 of file Variable.h.

References g.

Var PLearn::Variable::column int  j,
bool  transpose = false
[inline]
 

Definition at line 248 of file Variable.h.

References column(), length(), PLearn::subMat(), and PLearn::transpose().

Referenced by column().

void PLearn::Variable::copyFrom const Vec v  )  [inline]
 

Definition at line 357 of file Variable.h.

References copyFrom(), and value.

Referenced by copyFrom().

void PLearn::Variable::copyGradientFrom const Vec v  )  [inline]
 

Definition at line 359 of file Variable.h.

References copyGradientFrom(), and gradient.

Referenced by copyGradientFrom().

virtual void PLearn::Variable::copyGradientInto Vec  g  )  [inline, virtual]
 

Definition at line 226 of file Variable.h.

References copyGradientInto(), and gradient.

Referenced by copyGradientInto().

void PLearn::Variable::copyGradientTo Vec v  )  [inline]
 

Definition at line 360 of file Variable.h.

References copyGradientTo(), and gradient.

Referenced by copyGradientTo().

void PLearn::Variable::copyRValueFrom const Vec v  )  [inline]
 

Definition at line 369 of file Variable.h.

References copyRValueFrom(), resizeRValue(), and rValue.

Referenced by copyRValueFrom().

void PLearn::Variable::copyRValueTo Vec v  )  [inline]
 

Definition at line 370 of file Variable.h.

References copyRValueTo(), resizeRValue(), and rValue.

Referenced by copyRValueTo().

void PLearn::Variable::copyTo Vec v  )  [inline]
 

Definition at line 358 of file Variable.h.

References copyTo(), and value.

Referenced by copyTo().

virtual void PLearn::Variable::copyValueInto Vec  v  )  [inline, virtual]
 

Definition at line 225 of file Variable.h.

References copyValueInto(), and value.

Referenced by copyValueInto().

void PLearn::Variable::declareOptions OptionList ol  )  [static, protected]
 

redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)

ex: static void declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "the size of the input\n it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "the learnt model weights"); inherited::declareOptions(ol); }

Reimplemented from PLearn::Object.

Reimplemented in PLearn::AffineTransformWeightPenalty, PLearn::BinaryVariable, PLearn::ConcatOfVariable, PLearn::CutAboveThresholdVariable, PLearn::CutBelowThresholdVariable, PLearn::DuplicateColumnVariable, PLearn::DuplicateRowVariable, PLearn::DuplicateScalarVariable, PLearn::ElementAtPositionVariable, PLearn::EqualConstantVariable, PLearn::ExtendedVariable, PLearn::IndexAtPositionVariable, PLearn::IsAboveThresholdVariable, PLearn::IsMissingVariable, PLearn::MarginPerceptronCostVariable, PLearn::MatrixElementsVariable, PLearn::MatrixOneHotSquaredLoss, PLearn::MatrixSumOfVariable, PLearn::MatRowVariable, PLearn::NaryVariable, PLearn::OneHotSquaredLoss, PLearn::OneHotVariable, PLearn::PDistributionVariable, PLearn::PlusConstantVariable, PLearn::PowVariable, PLearn::ReshapeVariable, PLearn::RowAtPositionVariable, PLearn::SemiSupervisedProbClassCostVariable, PLearn::SoftSlopeIntegralVariable, PLearn::SoftSlopeVariable, PLearn::SubMatTransposeVariable, PLearn::SubMatVariable, PLearn::SubsampleVariable, PLearn::SumOfVariable, PLearn::SumOverBagsVariable, PLearn::UnaryHardSlopeVariable, PLearn::UnaryVariable, PLearn::UnequalConstantVariable, PLearn::UnfoldedFuncVariable, PLearn::UnfoldedSumOfVariable, and PLearn::VecElementVariable.

Definition at line 208 of file Variable.cc.

References PLearn::declareOption(), and PLearn::OptionList.

Mat PLearn::Variable::defineGradientLocation const Mat m  ) 
 

Defines a new Mat to use as this Var's matGradient field, modifies gradient and graidentdata to keep consistent, and returns the previous matGradient.

Definition at line 265 of file Variable.cc.

References PLearn::TVec< T >::data(), gradient, gradientdata, PLearn::TMat< T >::isCompact(), matGradient, and PLERROR.

void PLearn::Variable::disallowPartialUpdates  )  [inline]
 

send message that updates must be full.

Definition at line 311 of file Variable.h.

References allows_partial_update, and gradient_status.

void PLearn::Variable::fbbprop  )  [virtual]
 

do fprop, bprop and bbprop

Definition at line 316 of file Variable.cc.

References bbprop(), bprop(), and fprop().

void PLearn::Variable::fbprop  )  [virtual]
 

do both fprop and bprop

Reimplemented in PLearn::ConcatOfVariable, PLearn::MatrixElementsVariable, PLearn::MatrixSumOfVariable, PLearn::SumOfVariable, and PLearn::SumOverBagsVariable.

Definition at line 310 of file Variable.cc.

References bprop(), and fprop().

void PLearn::Variable::fillGradient real  value  )  [inline]
 

Definition at line 260 of file Variable.h.

References PLearn::TVec< T >::fill(), fillGradient(), and gradient.

Referenced by fillGradient().

virtual void PLearn::Variable::fprop  )  [pure virtual]
 

compute output given input

Implemented in PLearn::UniformSampleVariable, PLearn::MultinomialSampleVariable, PLearn::DiagonalNormalSampleVariable, PLearn::AbsVariable, PLearn::AffineTransformVariable, PLearn::AffineTransformWeightPenalty, PLearn::ArgmaxVariable, PLearn::ArgminOfVariable, PLearn::ArgminVariable, PLearn::BinaryClassificationLossVariable, PLearn::ClassificationLossVariable, PLearn::ColumnIndexVariable, PLearn::ColumnSumVariable, PLearn::ConcatColumnsVariable, PLearn::ConcatOfVariable, PLearn::ConcatRowsVariable, PLearn::ConvolveVariable, PLearn::CrossEntropyVariable, PLearn::CutAboveThresholdVariable, PLearn::CutBelowThresholdVariable, PLearn::DeterminantVariable, PLearn::DiagonalizedFactorsProductVariable, PLearn::DilogarithmVariable, PLearn::DivVariable, PLearn::DotProductVariable, PLearn::DuplicateColumnVariable, PLearn::DuplicateRowVariable, PLearn::DuplicateScalarVariable, PLearn::ElementAtPositionVariable, PLearn::EqualConstantVariable, PLearn::EqualScalarVariable, PLearn::EqualVariable, PLearn::ErfVariable, PLearn::ExpVariable, PLearn::ExtendedVariable, PLearn::HardSlopeVariable, PLearn::IfThenElseVariable, PLearn::IndexAtPositionVariable, PLearn::InterValuesVariable, PLearn::InvertElementsVariable, PLearn::IsAboveThresholdVariable, PLearn::IsLargerVariable, PLearn::IsMissingVariable, PLearn::IsSmallerVariable, PLearn::LeftPseudoInverseVariable, PLearn::LiftOutputVariable, PLearn::LogAddVariable, PLearn::LogSoftmaxVariable, PLearn::LogSumVariable, PLearn::LogVariable, PLearn::MarginPerceptronCostVariable, PLearn::MatrixAffineTransformFeedbackVariable, PLearn::MatrixAffineTransformVariable, PLearn::MatrixElementsVariable, PLearn::MatrixInverseVariable, PLearn::MatrixOneHotSquaredLoss, PLearn::MatrixSoftmaxLossVariable, PLearn::MatrixSoftmaxVariable, PLearn::MatrixSumOfVariable, PLearn::MatRowVariable, PLearn::Max2Variable, PLearn::MaxVariable, PLearn::MiniBatchClassificationLossVariable, PLearn::MinusColumnVariable, PLearn::MinusRowVariable, PLearn::MinusScalarVariable, PLearn::MinusTransposedColumnVariable, PLearn::MinusVariable, PLearn::MinVariable, PLearn::MulticlassLossVariable, PLearn::NegateElementsVariable, PLearn::NegCrossEntropySigmoidVariable, PLearn::NllSemisphericalGaussianVariable, PLearn::OneHotSquaredLoss, PLearn::OneHotVariable, PLearn::PDistributionVariable, PLearn::PLogPVariable, PLearn::PlusColumnVariable, PLearn::PlusConstantVariable, PLearn::PlusRowVariable, PLearn::PlusScalarVariable, PLearn::PlusVariable, PLearn::PowVariable, PLearn::PowVariableVariable, PLearn::ProductTransposeVariable, PLearn::ProductVariable, PLearn::ProjectionErrorVariable, PLearn::ReshapeVariable, PLearn::RightPseudoInverseVariable, PLearn::RowAtPositionVariable, PLearn::RowSumVariable, PLearn::SemiSupervisedProbClassCostVariable, PLearn::SigmoidVariable, PLearn::SignVariable, PLearn::SoftmaxLossVariable, PLearn::SoftmaxVariable, PLearn::SoftplusVariable, PLearn::SoftSlopeIntegralVariable, PLearn::SoftSlopeVariable, PLearn::SourceVariable, PLearn::SquareRootVariable, PLearn::SquareVariable, PLearn::SubMatTransposeVariable, PLearn::SubMatVariable, PLearn::SubsampleVariable, PLearn::SumAbsVariable, PLearn::SumOfVariable, PLearn::SumOverBagsVariable, PLearn::SumSquareVariable, PLearn::SumVariable, PLearn::TanhVariable, PLearn::TimesColumnVariable, PLearn::TimesConstantVariable, PLearn::TimesRowVariable, PLearn::TimesScalarVariable, PLearn::TimesVariable, PLearn::TransposeProductVariable, PLearn::UnaryHardSlopeVariable, PLearn::UnequalConstantVariable, PLearn::UnfoldedFuncVariable, PLearn::UnfoldedSumOfVariable, PLearn::VarArrayElementVariable, PLearn::VarColumnsVariable, PLearn::VarElementVariable, PLearn::VarRowsVariable, PLearn::VarRowVariable, PLearn::VecElementVariable, and PLearn::WeightedSumSquareVariable.

Referenced by fbbprop(), fbprop(), and sizefprop().

void PLearn::Variable::fprop_from_all_sources  )  [virtual]
 

find all constant sources that influence this Variable, build a propagation path from them to this Variable, and fprop through it. This can be useful to make sure that all dependencies are computed at least once. This function uses source(), below.

Definition at line 369 of file Variable.cc.

References PLearn::VarArray::fprop(), PLearn::propagationPath(), sources(), and unmarkAncestors().

string PLearn::Variable::getName  )  const
 

returns the name of this variable.

If its name has not been set, it will be assigned a name of V_varnum

Definition at line 335 of file Variable.cc.

References PLearn::tostring(), varname, and varnum.

Referenced by PLearn::UnfoldedSumOfVariable::printInfo(), PLearn::UnfoldedFuncVariable::printInfo(), PLearn::UnaryVariable::printInfo(), PLearn::SumOverBagsVariable::printInfo(), PLearn::SumOfVariable::printInfo(), PLearn::SourceVariable::printInfo(), PLearn::NaryVariable::printInfo(), PLearn::MatrixSumOfVariable::printInfo(), and PLearn::BinaryVariable::printInfo().

bool PLearn::Variable::isColumnVec  )  const [inline]
 

Definition at line 194 of file Variable.h.

References width().

Referenced by subVec().

virtual bool PLearn::Variable::isConstant  )  [inline, virtual]
 

Reimplemented in PLearn::SourceVariable.

Definition at line 375 of file Variable.h.

bool PLearn::Variable::isMarked  )  [inline]
 

Definition at line 258 of file Variable.h.

References marked.

bool PLearn::Variable::isRowVec  )  const [inline]
 

Definition at line 195 of file Variable.h.

References length().

Referenced by subVec().

bool PLearn::Variable::isScalar  )  const [inline]
 

Definition at line 192 of file Variable.h.

References length(), and width().

bool PLearn::Variable::isVec  )  const [inline]
 

Definition at line 193 of file Variable.h.

References length(), and width().

int PLearn::Variable::length  )  const [inline]
 

Definition at line 157 of file Variable.h.

References PLearn::TMat< T >::length(), and matValue.

Referenced by accg(), allowPartialUpdates(), PLearn::SubMatVariable::bbprop(), PLearn::PlusRowVariable::bbprop(), PLearn::PlusColumnVariable::bbprop(), PLearn::MinusRowVariable::bbprop(), PLearn::MinusColumnVariable::bbprop(), PLearn::TimesRowVariable::bprop(), PLearn::TimesColumnVariable::bprop(), PLearn::SubsampleVariable::bprop(), PLearn::SubMatVariable::bprop(), PLearn::SubMatTransposeVariable::bprop(), PLearn::PlusRowVariable::bprop(), PLearn::PlusColumnVariable::bprop(), PLearn::MinusTransposedColumnVariable::bprop(), PLearn::MinusRowVariable::bprop(), PLearn::MinusColumnVariable::bprop(), PLearn::MatrixSoftmaxVariable::bprop(), PLearn::MatrixOneHotSquaredLoss::bprop(), PLearn::MatrixAffineTransformVariable::bprop(), PLearn::DuplicateRowVariable::bprop(), PLearn::DuplicateColumnVariable::bprop(), PLearn::ConvolveVariable::bprop(), PLearn::SemiSupervisedProbClassCostVariable::build_(), PLearn::ReshapeVariable::build_(), PLearn::NllSemisphericalGaussianVariable::build_(), column(), PLearn::TimesRowVariable::fprop(), PLearn::TimesColumnVariable::fprop(), PLearn::SubMatVariable::fprop(), PLearn::SubMatTransposeVariable::fprop(), PLearn::DiagonalNormalSampleVariable::fprop(), PLearn::PlusRowVariable::fprop(), PLearn::PlusColumnVariable::fprop(), PLearn::MinusTransposedColumnVariable::fprop(), PLearn::MinusRowVariable::fprop(), PLearn::MinusColumnVariable::fprop(), PLearn::MatrixOneHotSquaredLoss::fprop(), PLearn::MatrixAffineTransformVariable::fprop(), PLearn::DuplicateRowVariable::fprop(), PLearn::DuplicateColumnVariable::fprop(), isRowVec(), isScalar(), isVec(), recomputeSize(), resizeDiagHessian(), resizeRValue(), PLearn::TimesRowVariable::rfprop(), PLearn::TimesColumnVariable::rfprop(), PLearn::SubMatVariable::rfprop(), PLearn::SubMatTransposeVariable::rfprop(), PLearn::PlusRowVariable::rfprop(), PLearn::PlusColumnVariable::rfprop(), PLearn::SubMatVariable::symbolicBprop(), PLearn::SubMatTransposeVariable::symbolicBprop(), PLearn::PowVariableVariable::symbolicBprop(), PLearn::IfThenElseVariable::symbolicBprop(), PLearn::ConcatColumnsVariable::symbolicBprop(), and update().

void PLearn::Variable::makeDeepCopyFromShallowCopy map< const void *, void * > &  copies  )  [virtual]
 

Reimplemented in PLearn::ArgminOfVariable, PLearn::BinaryVariable, PLearn::ConcatOfVariable, PLearn::LogSumVariable, PLearn::MatrixElementsVariable, PLearn::MatrixSumOfVariable, PLearn::MatRowVariable, PLearn::NaryVariable, PLearn::PDistributionVariable, PLearn::SourceVariable, PLearn::SumOfVariable, PLearn::SumOverBagsVariable, PLearn::UnaryVariable, PLearn::UnfoldedFuncVariable, PLearn::UnfoldedSumOfVariable, and PLearn::VecElementVariable.

Definition at line 290 of file Variable.cc.

References PLearn::TVec< T >::data(), PLearn::deepCopyField(), g, gradient, gradientdata, matGradient, matValue, value, valuedata, and PLearn::varDeepCopyField().

void PLearn::Variable::makeSharedGradient Vec v,
int  offset_ = 0
 

Definition at line 723 of file Variable.cc.

References makeSharedGradient(), PLearn::TVec< T >::offset_, and PLearn::TVec< T >::storage.

void PLearn::Variable::makeSharedGradient PP< Storage< real > >  storage,
int  offset_ = 0
 

Definition at line 728 of file Variable.cc.

References PLearn::TVec< T >::data(), gradient, gradientdata, matGradient, PLearn::TMat< T >::mod_, nelems(), PLearn::TMat< T >::offset_, PLearn::TVec< T >::offset_, PLERROR, PLearn::TMat< T >::storage, PLearn::TVec< T >::storage, PLearn::TMat< T >::width(), and x.

void PLearn::Variable::makeSharedGradient real x,
int  n
 

like copyTo but also makes value's point to x

Definition at line 747 of file Variable.cc.

References PLearn::TVec< T >::data(), gradient, gradientdata, matGradient, PLearn::TMat< T >::mod_, nelems(), PLearn::TMat< T >::offset_, PLearn::TVec< T >::offset_, PLERROR, PLearn::TMat< T >::storage, PLearn::TVec< T >::storage, PLearn::TMat< T >::width(), and x.

Referenced by makeSharedGradient().

void PLearn::Variable::makeSharedRValue Vec v,
int  offset_ = 0
 

Definition at line 805 of file Variable.cc.

References makeSharedRValue(), PLearn::TVec< T >::offset_, and PLearn::TVec< T >::storage.

void PLearn::Variable::makeSharedRValue PP< Storage< real > >  storage,
int  offset_ = 0
 

Definition at line 768 of file Variable.cc.

References PLearn::TVec< T >::data(), matRValue, PLearn::TMat< T >::mod_, nelems(), PLearn::TMat< T >::offset_, PLearn::TVec< T >::offset_, PLERROR, resizeRValue(), rValue, rvaluedata, PLearn::TMat< T >::storage, PLearn::TVec< T >::storage, PLearn::TMat< T >::width(), and x.

void PLearn::Variable::makeSharedRValue real x,
int  n
 

like copyTo but also makes value's point to x

Definition at line 788 of file Variable.cc.

References PLearn::TVec< T >::data(), matRValue, PLearn::TMat< T >::mod_, nelems(), PLearn::TMat< T >::offset_, PLearn::TVec< T >::offset_, PLERROR, resizeRValue(), rValue, rvaluedata, PLearn::TMat< T >::storage, PLearn::TVec< T >::storage, PLearn::TMat< T >::width(), and x.

Referenced by makeSharedRValue().

void PLearn::Variable::makeSharedValue Vec v,
int  offset_ = 0
 

Definition at line 763 of file Variable.cc.

References makeSharedValue(), PLearn::TVec< T >::offset_, and PLearn::TVec< T >::storage.

void PLearn::Variable::makeSharedValue PP< Storage< real > >  storage,
int  offset_ = 0
 

make value and matValue point into this storage

Definition at line 705 of file Variable.cc.

References PLearn::TVec< T >::data(), matValue, PLearn::TMat< T >::mod_, nelems(), PLearn::TMat< T >::offset_, PLearn::TVec< T >::offset_, PLERROR, PLearn::TMat< T >::storage, PLearn::TVec< T >::storage, value, valuedata, PLearn::TMat< T >::width(), and x.

void PLearn::Variable::makeSharedValue real x,
int  n
 

like copyTo but also makes value's point to x

Definition at line 689 of file Variable.cc.

References PLearn::TVec< T >::data(), matValue, PLearn::TMat< T >::mod_, nelems(), PLearn::TMat< T >::offset_, PLearn::TVec< T >::offset_, PLERROR, PLearn::TMat< T >::storage, PLearn::TVec< T >::storage, value, valuedata, PLearn::TMat< T >::width(), and x.

Referenced by makeSharedValue().

virtual bool PLearn::Variable::markPath  )  [pure virtual]
 

sets the marked flag of all the sVariable that are to be in the fprop path. The input sVariable that are of interest are to be marked first. Then markPath is to be called from the output Variable of interest

Implemented in PLearn::BinaryVariable, PLearn::NaryVariable, PLearn::SourceVariable, and PLearn::UnaryVariable.

real PLearn::Variable::maxUpdate Vec  direction  ) 
 

Using the box constraints on the values, return the maximum allowable step_size in the given direction i.e., argmax_{step_size} {new = value + step_size * direction, new in box}

Definition at line 653 of file Variable.cc.

References PLearn::TVec< T >::data(), max_value, min_value, nelems(), PLERROR, and valuedata.

bool PLearn::Variable::nameIsSet  )  [inline]
 

Definition at line 235 of file Variable.h.

References varname.

int PLearn::Variable::nelems  )  const [inline]
 

Definition at line 160 of file Variable.h.

References size().

Referenced by PLearn::TanhVariable::bbprop(), PLearn::SubMatVariable::bbprop(), PLearn::SquareVariable::bbprop(), PLearn::SigmoidVariable::bbprop(), PLearn::PlusVariable::bbprop(), PLearn::PlusScalarVariable::bbprop(), PLearn::NegateElementsVariable::bbprop(), PLearn::MinusVariable::bbprop(), PLearn::MinusScalarVariable::bbprop(), PLearn::VarArrayElementVariable::bprop(), PLearn::UnaryHardSlopeVariable::bprop(), PLearn::TimesVariable::bprop(), PLearn::TimesScalarVariable::bprop(), PLearn::TimesConstantVariable::bprop(), PLearn::TanhVariable::bprop(), PLearn::SubMatVariable::bprop(), PLearn::SubMatTransposeVariable::bprop(), PLearn::SquareVariable::bprop(), PLearn::SquareRootVariable::bprop(), PLearn::SoftSlopeVariable::bprop(), PLearn::SoftSlopeIntegralVariable::bprop(), PLearn::SoftplusVariable::bprop(), PLearn::SoftmaxVariable::bprop(), PLearn::SigmoidVariable::bprop(), PLearn::ReshapeVariable::bprop(), PLearn::PowVariableVariable::bprop(), PLearn::PowVariable::bprop(), PLearn::PlusVariable::bprop(), PLearn::PlusScalarVariable::bprop(), PLearn::PlusConstantVariable::bprop(), PLearn::PLogPVariable::bprop(), PLearn::NegateElementsVariable::bprop(), PLearn::MinusVariable::bprop(), PLearn::MinusScalarVariable::bprop(), PLearn::LogVariable::bprop(), PLearn::LogSoftmaxVariable::bprop(), PLearn::LogAddVariable::bprop(), PLearn::InvertElementsVariable::bprop(), PLearn::InterValuesVariable::bprop(), PLearn::IfThenElseVariable::bprop(), PLearn::HardSlopeVariable::bprop(), PLearn::ExpVariable::bprop(), PLearn::ErfVariable::bprop(), PLearn::DuplicateScalarVariable::bprop(), PLearn::DivVariable::bprop(), PLearn::DilogarithmVariable::bprop(), PLearn::CutBelowThresholdVariable::bprop(), PLearn::CutAboveThresholdVariable::bprop(), PLearn::AbsVariable::bprop(), PLearn::ExtendedVariable::build_(), PLearn::VarArrayElementVariable::fprop(), PLearn::UnequalConstantVariable::fprop(), PLearn::UnaryHardSlopeVariable::fprop(), PLearn::TimesVariable::fprop(), PLearn::TimesScalarVariable::fprop(), PLearn::TimesConstantVariable::fprop(), PLearn::TanhVariable::fprop(), PLearn::SubMatVariable::fprop(), PLearn::SubMatTransposeVariable::fprop(), PLearn::SquareVariable::fprop(), PLearn::SquareRootVariable::fprop(), PLearn::SoftSlopeVariable::fprop(), PLearn::SoftSlopeIntegralVariable::fprop(), PLearn::SoftplusVariable::fprop(), PLearn::SignVariable::fprop(), PLearn::SigmoidVariable::fprop(), PLearn::MultinomialSampleVariable::fprop(), PLearn::UniformSampleVariable::fprop(), PLearn::ReshapeVariable::fprop(), PLearn::PowVariableVariable::fprop(), PLearn::PowVariable::fprop(), PLearn::PlusVariable::fprop(), PLearn::PlusScalarVariable::fprop(), PLearn::PlusConstantVariable::fprop(), PLearn::PLogPVariable::fprop(), PLearn::OneHotVariable::fprop(), PLearn::NegateElementsVariable::fprop(), PLearn::MinusVariable::fprop(), PLearn::MinusScalarVariable::fprop(), PLearn::LogVariable::fprop(), PLearn::IsSmallerVariable::fprop(), PLearn::IsMissingVariable::fprop(), PLearn::IsLargerVariable::fprop(), PLearn::InvertElementsVariable::fprop(), PLearn::InterValuesVariable::fprop(), PLearn::IfThenElseVariable::fprop(), PLearn::HardSlopeVariable::fprop(), PLearn::ExpVariable::fprop(), PLearn::ErfVariable::fprop(), PLearn::EqualVariable::fprop(), PLearn::EqualScalarVariable::fprop(), PLearn::EqualConstantVariable::fprop(), PLearn::DuplicateScalarVariable::fprop(), PLearn::DivVariable::fprop(), PLearn::DilogarithmVariable::fprop(), PLearn::CutBelowThresholdVariable::fprop(), PLearn::CutAboveThresholdVariable::fprop(), PLearn::AbsVariable::fprop(), makeSharedGradient(), makeSharedRValue(), makeSharedValue(), maxUpdate(), PLearn::SumOfVariable::printInfo(), PLearn::MatrixSumOfVariable::printInfo(), PLearn::TimesScalarVariable::rfprop(), PLearn::TimesConstantVariable::rfprop(), PLearn::TanhVariable::rfprop(), PLearn::SubMatVariable::rfprop(), PLearn::SubMatTransposeVariable::rfprop(), PLearn::SquareVariable::rfprop(), PLearn::SigmoidVariable::rfprop(), PLearn::PlusScalarVariable::rfprop(), PLearn::PlusConstantVariable::rfprop(), PLearn::NegateElementsVariable::rfprop(), PLearn::MinusScalarVariable::rfprop(), PLearn::LogVariable::rfprop(), PLearn::InvertElementsVariable::rfprop(), PLearn::IfThenElseVariable::rfprop(), PLearn::ExpVariable::rfprop(), PLearn::DivVariable::rfprop(), PLearn::AbsVariable::rfprop(), update(), and updateAndClear().

void PLearn::Variable::oldread istream &  in  )  [virtual]
 

DEPRECATED For backward compatibility with old saved object.

Reimplemented from PLearn::Object.

Definition at line 343 of file Variable.cc.

References PLearn::read(), and value.

virtual VarArray PLearn::Variable::parents  )  [pure virtual]
 

returns all the direct parents of this Var that are not marked (the call doesn't change any mark)

Implemented in PLearn::BinaryVariable, PLearn::NaryVariable, PLearn::SourceVariable, and PLearn::UnaryVariable.

PLearn::Variable::PLEARN_DECLARE_ABSTRACT_OBJECT Variable   ) 
 

void PLearn::Variable::print ostream &  out  )  const [virtual]
 

Prints a human-readable, short (not necessarily complete) description of this object instance (default prints info()). This is what is called by operator<< on Object

Reimplemented from PLearn::Object.

Definition at line 276 of file Variable.cc.

References PLearn::endl(), and PLearn::Object::info().

virtual void PLearn::Variable::printInfo bool  print_gradient = false  )  [pure virtual]
 

Implemented in PLearn::BinaryVariable, PLearn::MatrixSumOfVariable, PLearn::NaryVariable, PLearn::SourceVariable, PLearn::SumOfVariable, PLearn::SumOverBagsVariable, PLearn::UnaryVariable, PLearn::UnfoldedFuncVariable, and PLearn::UnfoldedSumOfVariable.

void PLearn::Variable::printInfos bool  print_gradient = false  )  [virtual]
 

Definition at line 377 of file Variable.cc.

References ancestors(), PLearn::VarArray::printInfo(), and unmarkAncestors().

virtual VarArray PLearn::Variable::random_sources  )  [pure virtual]
 

return ancestors which compute a non-deterministic function of their parents

Implemented in PLearn::SourceSampleVariable, PLearn::UnarySampleVariable, PLearn::BinarySampleVariable, PLearn::BinaryVariable, PLearn::NaryVariable, PLearn::SourceVariable, and PLearn::UnaryVariable.

void PLearn::Variable::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 in PLearn::AbsVariable, PLearn::AffineTransformVariable, PLearn::AffineTransformWeightPenalty, PLearn::ArgmaxVariable, PLearn::ArgminOfVariable, PLearn::ArgminVariable, PLearn::BinaryClassificationLossVariable, PLearn::ClassificationLossVariable, PLearn::ColumnIndexVariable, PLearn::ColumnSumVariable, PLearn::ConcatColumnsVariable, PLearn::ConcatOfVariable, PLearn::ConcatRowsVariable, PLearn::ConvolveVariable, PLearn::CrossEntropyVariable, PLearn::CutAboveThresholdVariable, PLearn::CutBelowThresholdVariable, PLearn::DeterminantVariable, PLearn::DiagonalizedFactorsProductVariable, PLearn::DilogarithmVariable, PLearn::DivVariable, PLearn::DotProductVariable, PLearn::DuplicateColumnVariable, PLearn::DuplicateRowVariable, PLearn::DuplicateScalarVariable, PLearn::ElementAtPositionVariable, PLearn::EqualConstantVariable, PLearn::EqualScalarVariable, PLearn::EqualVariable, PLearn::ErfVariable, PLearn::ExpVariable, PLearn::ExtendedVariable, PLearn::HardSlopeVariable, PLearn::IfThenElseVariable, PLearn::IndexAtPositionVariable, PLearn::InterValuesVariable, PLearn::InvertElementsVariable, PLearn::IsAboveThresholdVariable, PLearn::IsLargerVariable, PLearn::IsMissingVariable, PLearn::IsSmallerVariable, PLearn::LeftPseudoInverseVariable, PLearn::LiftOutputVariable, PLearn::LogAddVariable, PLearn::LogSoftmaxVariable, PLearn::LogSumVariable, PLearn::LogVariable, PLearn::MarginPerceptronCostVariable, PLearn::MatrixAffineTransformVariable, PLearn::MatrixElementsVariable, PLearn::MatrixInverseVariable, PLearn::MatrixOneHotSquaredLoss, PLearn::MatrixSoftmaxLossVariable, PLearn::MatrixSoftmaxVariable, PLearn::MatrixSumOfVariable, PLearn::MatRowVariable, PLearn::Max2Variable, PLearn::MaxVariable, PLearn::MiniBatchClassificationLossVariable, PLearn::MinusColumnVariable, PLearn::MinusRowVariable, PLearn::MinusScalarVariable, PLearn::MinusTransposedColumnVariable, PLearn::MinusVariable, PLearn::MinVariable, PLearn::MulticlassLossVariable, PLearn::NegateElementsVariable, PLearn::NegCrossEntropySigmoidVariable, PLearn::NllSemisphericalGaussianVariable, PLearn::OneHotSquaredLoss, PLearn::OneHotVariable, PLearn::PDistributionVariable, PLearn::PLogPVariable, PLearn::PlusColumnVariable, PLearn::PlusConstantVariable, PLearn::PlusRowVariable, PLearn::PlusScalarVariable, PLearn::PlusVariable, PLearn::PowVariable, PLearn::PowVariableVariable, PLearn::ProductTransposeVariable, PLearn::ProductVariable, PLearn::ProjectionErrorVariable, PLearn::ReshapeVariable, PLearn::RightPseudoInverseVariable, PLearn::RowAtPositionVariable, PLearn::RowSumVariable, PLearn::SemiSupervisedProbClassCostVariable, PLearn::SigmoidVariable, PLearn::SignVariable, PLearn::SoftmaxLossVariable, PLearn::SoftmaxVariable, PLearn::SoftplusVariable, PLearn::SoftSlopeIntegralVariable, PLearn::SoftSlopeVariable, PLearn::SquareRootVariable, PLearn::SquareVariable, PLearn::SubMatTransposeVariable, PLearn::SubMatVariable, PLearn::SubsampleVariable, PLearn::SumAbsVariable, PLearn::SumOfVariable, PLearn::SumOverBagsVariable, PLearn::SumSquareVariable, PLearn::SumVariable, PLearn::TanhVariable, PLearn::TimesColumnVariable, PLearn::TimesConstantVariable, PLearn::TimesRowVariable, PLearn::TimesScalarVariable, PLearn::TimesVariable, PLearn::TransposeProductVariable, PLearn::UnaryHardSlopeVariable, PLearn::UnequalConstantVariable, PLearn::UnfoldedFuncVariable, PLearn::UnfoldedSumOfVariable, PLearn::VarArrayElementVariable, PLearn::VarColumnsVariable, PLearn::VarElementVariable, PLearn::VarRowsVariable, PLearn::VarRowVariable, PLearn::VecElementVariable, and PLearn::WeightedSumSquareVariable.

Definition at line 239 of file Variable.cc.

References length(), and width().

Referenced by build_(), and sizeprop().

void PLearn::Variable::resize int  l,
int  w
 

resizes the matValue and matGradient fields of this variable (and updates the value, gradient, valuedata and gradientdata fields accordingly)

Definition at line 242 of file Variable.cc.

References PLearn::TVec< T >::data(), gradient, gradientdata, matGradient, matValue, PLearn::TMat< T >::resize(), PLearn::TMat< T >::toVec(), value, valuedata, and PLearn::Vec.

void PLearn::Variable::resizeDiagHessian  )  [virtual]
 

resize the DiagHessian field

Definition at line 810 of file Variable.cc.

References PLearn::TVec< T >::data(), diaghessian, diaghessiandata, length(), matDiagHessian, PLearn::TMat< T >::resize(), PLearn::TMat< T >::toVec(), and width().

Referenced by clearDiagHessian().

void PLearn::Variable::resizeRValue  )  [virtual]
 

Reimplemented in PLearn::BinaryVariable, PLearn::NaryVariable, and PLearn::UnaryVariable.

Definition at line 817 of file Variable.cc.

References PLearn::TVec< T >::data(), length(), matRValue, PLearn::TMat< T >::resize(), rValue, rvaluedata, PLearn::TMat< T >::toVec(), and width().

Referenced by copyRValueFrom(), copyRValueTo(), and makeSharedRValue().

void PLearn::Variable::rfprop  )  [virtual]
 

Reimplemented in PLearn::AbsVariable, PLearn::ConcatRowsVariable, PLearn::DivVariable, PLearn::DotProductVariable, PLearn::ElementAtPositionVariable, PLearn::ExpVariable, PLearn::ExtendedVariable, PLearn::IfThenElseVariable, PLearn::IndexAtPositionVariable, PLearn::InvertElementsVariable, PLearn::IsAboveThresholdVariable, PLearn::LogVariable, PLearn::MatrixSoftmaxLossVariable, PLearn::MatrixSoftmaxVariable, PLearn::MatrixSumOfVariable, PLearn::MinusScalarVariable, PLearn::NegateElementsVariable, PLearn::OneHotSquaredLoss, PLearn::OneHotVariable, PLearn::PDistributionVariable, PLearn::PlusColumnVariable, PLearn::PlusConstantVariable, PLearn::PlusRowVariable, PLearn::PlusScalarVariable, PLearn::ProductTransposeVariable, PLearn::ProductVariable, PLearn::RowAtPositionVariable, PLearn::SemiSupervisedProbClassCostVariable, PLearn::SigmoidVariable, PLearn::SoftmaxLossVariable, PLearn::SoftmaxVariable, PLearn::SourceVariable, PLearn::SquareVariable, PLearn::SubMatTransposeVariable, PLearn::SubMatVariable, PLearn::SumOfVariable, PLearn::SumVariable, PLearn::TanhVariable, PLearn::TimesColumnVariable, PLearn::TimesConstantVariable, PLearn::TimesRowVariable, PLearn::TimesScalarVariable, PLearn::TransposeProductVariable, PLearn::VarElementVariable, and PLearn::VarRowVariable.

Definition at line 329 of file Variable.cc.

References c_str(), PLearn::Object::classname(), and PLERROR.

Var PLearn::Variable::row int  i,
bool  transpose = false
[inline]
 

Definition at line 247 of file Variable.h.

References row(), PLearn::subMat(), PLearn::transpose(), and width().

Referenced by row(), and update().

void PLearn::Variable::setBoxConstraint real  minv,
real  maxv
[inline]
 

Definition at line 254 of file Variable.h.

References max_value, min_value, and setBoxConstraint().

Referenced by setBoxConstraint().

void PLearn::Variable::setDontBpropHere bool  val  )  [inline]
 

Definition at line 250 of file Variable.h.

References dont_bprop_here, setDontBpropHere(), and val.

Referenced by setDontBpropHere().

void PLearn::Variable::setKeepPositive  )  [inline]
 

Definition at line 251 of file Variable.h.

References min_value.

void PLearn::Variable::setMark  )  [inline]
 

Definition at line 256 of file Variable.h.

References marked.

Referenced by PLearn::SourceVariable::ancestors(), PLearn::SourceVariable::random_sources(), and PLearn::SourceVariable::sources().

void PLearn::Variable::setMaxValue real  maxv = FLT_MAX  )  [inline]
 

Definition at line 253 of file Variable.h.

References max_value, and setMaxValue().

Referenced by setMaxValue().

void PLearn::Variable::setMinValue real  minv = -FLT_MAX  )  [inline]
 

Definition at line 252 of file Variable.h.

References min_value, and setMinValue().

Referenced by setMinValue().

void PLearn::Variable::setName const string the_name  ) 
 

call this to set a name for this variable

Definition at line 332 of file Variable.cc.

References varname.

Referenced by PLearn::Var::Var().

void PLearn::Variable::setParents const VarArray parents  )  [virtual]
 

set this Variable's parents. To use with default constructor.

Reimplemented in PLearn::BinaryVariable, and PLearn::SourceVariable.

Definition at line 262 of file Variable.cc.

References c_str(), PLearn::Object::classname(), and PLERROR.

int PLearn::Variable::size  )  const [inline]
 

Definition at line 159 of file Variable.h.

References matValue, and PLearn::TMat< T >::size().

Referenced by PLearn::SumOfVariable::fbprop(), PLearn::SemiSupervisedProbClassCostVariable::fprop(), and nelems().

void PLearn::Variable::sizefprop  )  [inline]
 

compute dC/dinput given dC/doutput Calls sizeprop, then fprop

Definition at line 206 of file Variable.h.

References fprop(), and sizeprop().

void PLearn::Variable::sizeprop  ) 
 

resizes value and gradient fields according to size given by recomputeSize(...) This corresponds to "propagating" the size from its parent's size, much as fprop propagates the values

Definition at line 255 of file Variable.cc.

References recomputeSize(), and resize().

Referenced by sizefprop().

virtual VarArray PLearn::Variable::sources  )  [pure virtual]
 

if not marked, find all constant sources that influence this Variable.

A constant source is normally a SourceVariable.

Implemented in PLearn::BinaryVariable, PLearn::NaryVariable, PLearn::SourceVariable, and PLearn::UnaryVariable.

Referenced by fprop_from_all_sources(), and verifyGradient().

Var PLearn::Variable::subMat int  i,
int  j,
int  sublength,
int  subwidth,
bool  transpose = false
 

Definition at line 361 of file Variable.cc.

Var PLearn::Variable::subVec int  start,
int  len,
bool  transpose = false
 

Definition at line 350 of file Variable.cc.

References isColumnVec(), isRowVec(), PLERROR, PLearn::subMat(), and PLearn::transpose().

void PLearn::Variable::symbolicBprop  )  [virtual]
 

compute a piece of new Var graph that represents the symbolic derivative of this Var

Reimplemented in PLearn::AbsVariable, PLearn::AffineTransformVariable, PLearn::ArgmaxVariable, PLearn::ArgminVariable, PLearn::ColumnIndexVariable, PLearn::ColumnSumVariable, PLearn::ConcatColumnsVariable, PLearn::ConcatRowsVariable, PLearn::ConvolveVariable, PLearn::CutAboveThresholdVariable, PLearn::CutBelowThresholdVariable, PLearn::DeterminantVariable, PLearn::DilogarithmVariable, PLearn::DivVariable, PLearn::DotProductVariable, PLearn::DuplicateColumnVariable, PLearn::DuplicateRowVariable, PLearn::DuplicateScalarVariable, PLearn::ElementAtPositionVariable, PLearn::EqualConstantVariable, PLearn::EqualScalarVariable, PLearn::EqualVariable, PLearn::ErfVariable, PLearn::ExpVariable, PLearn::ExtendedVariable, PLearn::HardSlopeVariable, PLearn::IfThenElseVariable, PLearn::IndexAtPositionVariable, PLearn::InterValuesVariable, PLearn::InvertElementsVariable, PLearn::IsAboveThresholdVariable, PLearn::IsLargerVariable, PLearn::IsMissingVariable, PLearn::IsSmallerVariable, PLearn::LeftPseudoInverseVariable, PLearn::LogAddVariable, PLearn::LogSoftmaxVariable, PLearn::LogSumVariable, PLearn::LogVariable, PLearn::MatrixAffineTransformVariable, PLearn::MatrixInverseVariable, PLearn::MatrixOneHotSquaredLoss, PLearn::MatrixSoftmaxLossVariable, PLearn::MatrixSoftmaxVariable, PLearn::MatrixSumOfVariable, PLearn::MatRowVariable, PLearn::Max2Variable, PLearn::MaxVariable, PLearn::MiniBatchClassificationLossVariable, PLearn::MinusColumnVariable, PLearn::MinusRowVariable, PLearn::MinusScalarVariable, PLearn::MinusTransposedColumnVariable, PLearn::MinusVariable, PLearn::MinVariable, PLearn::NegateElementsVariable, PLearn::NllSemisphericalGaussianVariable, PLearn::OneHotSquaredLoss, PLearn::OneHotVariable, PLearn::PDistributionVariable, PLearn::PLogPVariable, PLearn::PlusColumnVariable, PLearn::PlusConstantVariable, PLearn::PlusRowVariable, PLearn::PlusScalarVariable, PLearn::PlusVariable, PLearn::PowVariable, PLearn::PowVariableVariable, PLearn::ProductTransposeVariable, PLearn::ProductVariable, PLearn::ProjectionErrorVariable, PLearn::ReshapeVariable, PLearn::RightPseudoInverseVariable, PLearn::RowAtPositionVariable, PLearn::RowSumVariable, PLearn::SemiSupervisedProbClassCostVariable, PLearn::SigmoidVariable, PLearn::SignVariable, PLearn::SoftmaxLossVariable, PLearn::SoftmaxVariable, PLearn::SoftplusVariable, PLearn::SoftSlopeIntegralVariable, PLearn::SoftSlopeVariable, PLearn::SourceVariable, PLearn::SquareVariable, PLearn::SubMatTransposeVariable, PLearn::SubMatVariable, PLearn::SubsampleVariable, PLearn::SumAbsVariable, PLearn::SumOfVariable, PLearn::SumSquareVariable, PLearn::SumVariable, PLearn::TanhVariable, PLearn::TimesColumnVariable, PLearn::TimesConstantVariable, PLearn::TimesRowVariable, PLearn::TimesScalarVariable, PLearn::TimesVariable, PLearn::TransposeProductVariable, PLearn::UnequalConstantVariable, PLearn::VarArrayElementVariable, PLearn::VarColumnsVariable, PLearn::VarElementVariable, PLearn::VarRowsVariable, PLearn::VarRowVariable, PLearn::VecElementVariable, and PLearn::WeightedSumSquareVariable.

Definition at line 326 of file Variable.cc.

References c_str(), PLearn::Object::classname(), and PLERROR.

virtual void PLearn::Variable::unmarkAncestors  )  [pure virtual]
 

undo any marking done by a call to sources() or ancestors()

Implemented in PLearn::BinaryVariable, PLearn::NaryVariable, PLearn::SourceVariable, and PLearn::UnaryVariable.

Referenced by fprop_from_all_sources(), printInfos(), and verifyGradient().

bool PLearn::Variable::update Vec  new_value  ) 
 

set value = new_value projected down in each direction independently in the subspace in which the box constraints are satisfied. return true if box constraints have been hit with the update

Definition at line 616 of file Variable.cc.

References allows_partial_update, PLearn::TVec< T >::data(), max_value, min_value, nelems(), PLWARNING, and valuedata.

bool PLearn::Variable::update real  step_size  ) 
 

set value = value + step_size * gradient with step_size possibly scaled down s.t. box constraints are satisfied return true if box constraints have been hit with the update

Definition at line 480 of file Variable.cc.

References allows_partial_update, gradient_status, length(), PLearn::TVec< int >::length(), matGradient, matValue, max_value, min_value, row(), rows_to_update, and width().

bool PLearn::Variable::update Vec  step_sizes,
Vec  direction_vec,
real  coeff = 1.0,
real  b = 0.0
 

set value[i] = value[i] + (step_sizes[i]*coeff + b) * direction[i] with step_size possibly scaled down s.t. box constraints are satisfied return true if box constraints have been hit with the update

Definition at line 448 of file Variable.cc.

References allows_partial_update, PLearn::TVec< T >::data(), max_value, min_value, nelems(), PLWARNING, and valuedata.

bool PLearn::Variable::update real  step_size,
Vec  direction_vec,
real  coeff = 1.0,
real  b = 0.0
 

set value = value + (step_size * coeff + b) * direction with step_size possibly scaled down s.t. box constraints are satisfied return true if box constraints have been hit with the update If (allows_partial_update) the update is done where necessary. // NB: Wrong ?

Definition at line 409 of file Variable.cc.

References allows_partial_update, PLearn::TVec< T >::data(), max_value, min_value, nelems(), PLWARNING, and valuedata.

void PLearn::Variable::updateAndClear  )  [inline]
 

Does value += gradient; gradient.clear();.

Definition at line 418 of file Variable.h.

References PLearn::TVec< T >::clear(), gradient, gradientdata, nelems(), and valuedata.

void PLearn::Variable::updateRow int  row  )  [inline]
 

says that given row has received gradient (should be updated on next call to update)

Definition at line 318 of file Variable.h.

References allows_partial_update, PLearn::TVec< int >::append(), PLearn::TVec< int >::contains(), gradient_status, rows_to_update, and updateRow().

Referenced by updateRow().

void PLearn::Variable::verifyGradient real  step = 0.001  )  [virtual]
 

call verify gradient for the mapping from all the sources to this Variable.

Definition at line 395 of file Variable.cc.

References PLearn::VarArray::nelems(), sources(), and unmarkAncestors().

int PLearn::Variable::width  )  const [inline]
 

Definition at line 158 of file Variable.h.

References matValue, and PLearn::TMat< T >::width().

Referenced by accg(), PLearn::SubMatVariable::bbprop(), PLearn::PlusRowVariable::bbprop(), PLearn::PlusColumnVariable::bbprop(), PLearn::MinusRowVariable::bbprop(), PLearn::MinusColumnVariable::bbprop(), PLearn::TimesRowVariable::bprop(), PLearn::TimesColumnVariable::bprop(), PLearn::SubsampleVariable::bprop(), PLearn::SubMatVariable::bprop(), PLearn::SubMatTransposeVariable::bprop(), PLearn::PlusRowVariable::bprop(), PLearn::PlusColumnVariable::bprop(), PLearn::MinusTransposedColumnVariable::bprop(), PLearn::MinusRowVariable::bprop(), PLearn::MinusColumnVariable::bprop(), PLearn::MatrixAffineTransformVariable::bprop(), PLearn::IndexAtPositionVariable::bprop(), PLearn::ExtendedVariable::bprop(), PLearn::ElementAtPositionVariable::bprop(), PLearn::DuplicateRowVariable::bprop(), PLearn::DuplicateColumnVariable::bprop(), PLearn::ConvolveVariable::bprop(), PLearn::ReshapeVariable::build_(), PLearn::NllSemisphericalGaussianVariable::build_(), PLearn::TimesRowVariable::fprop(), PLearn::TimesColumnVariable::fprop(), PLearn::SubMatVariable::fprop(), PLearn::SubMatTransposeVariable::fprop(), PLearn::PlusRowVariable::fprop(), PLearn::PlusColumnVariable::fprop(), PLearn::MinusTransposedColumnVariable::fprop(), PLearn::MinusRowVariable::fprop(), PLearn::MinusColumnVariable::fprop(), PLearn::MatrixSoftmaxVariable::fprop(), PLearn::MatrixAffineTransformVariable::fprop(), PLearn::IndexAtPositionVariable::fprop(), PLearn::ExtendedVariable::fprop(), PLearn::ElementAtPositionVariable::fprop(), PLearn::DuplicateRowVariable::fprop(), PLearn::DuplicateColumnVariable::fprop(), isColumnVec(), isScalar(), isVec(), recomputeSize(), resizeDiagHessian(), resizeRValue(), PLearn::TimesRowVariable::rfprop(), PLearn::TimesColumnVariable::rfprop(), PLearn::SubMatVariable::rfprop(), PLearn::SubMatTransposeVariable::rfprop(), PLearn::PlusRowVariable::rfprop(), PLearn::PlusColumnVariable::rfprop(), PLearn::ExtendedVariable::rfprop(), PLearn::ElementAtPositionVariable::rfprop(), row(), PLearn::SubMatVariable::symbolicBprop(), PLearn::SubMatTransposeVariable::symbolicBprop(), PLearn::PowVariableVariable::symbolicBprop(), PLearn::IfThenElseVariable::symbolicBprop(), PLearn::ConcatRowsVariable::symbolicBprop(), and update().

void PLearn::Variable::write ostream &  out  )  const [virtual]
 

DEPRECATED (use the declareOption / build_ mecanism instead, that provides automatic serialization) The write method should write a complete description of the object to the given stream, that should be enough to later reconstruct it. (a somewhat human-readable ascii format is usually preferred). The new default version simply calls newwrite(...) which simply writes all the "options" declared in declareOptions, so there is no need to overload write in subclasses. Old classes that still overload write should progressively be moved to the new declareOptions/build mechanism.

Reimplemented from PLearn::Object.

Definition at line 346 of file Variable.cc.

References value, and PLearn::write().


Member Data Documentation

bool PLearn::Variable::allows_partial_update [protected]
 

only if this is true then the following two fields are used.

Definition at line 131 of file Variable.h.

Referenced by allowPartialUpdates(), clearGradient(), disallowPartialUpdates(), update(), updateRow(), and Variable().

Vec PLearn::Variable::diaghessian
 

optionally computed second derivative (see bbprop methods)

Definition at line 148 of file Variable.h.

Referenced by clearDiagHessian(), and resizeDiagHessian().

real* PLearn::Variable::diaghessiandata
 

set to diaghessian.data() or NULL if no diaghessian

Definition at line 149 of file Variable.h.

Referenced by resizeDiagHessian().

bool PLearn::Variable::dont_bprop_here
 

if true, children are encouraged not to bprop gradient in this var (saves computation time)

Definition at line 151 of file Variable.h.

Referenced by setDontBpropHere(), and Variable().

Var PLearn::Variable::g
 

symbolic gradient used for symbolicBprop

Definition at line 147 of file Variable.h.

Referenced by accg(), clearSymbolicGradient(), and makeDeepCopyFromShallowCopy().

Vec PLearn::Variable::gradient
 

Definition at line 137 of file Variable.h.

Referenced by clearGradient(), copyGradientFrom(), copyGradientInto(), copyGradientTo(), defineGradientLocation(), fillGradient(), makeDeepCopyFromShallowCopy(), makeSharedGradient(), resize(), updateAndClear(), and Variable().

int PLearn::Variable::gradient_status [protected]
 

0: no gradient was accumulated, 1: to some rows, 2: everywhere.

Definition at line 132 of file Variable.h.

Referenced by allowPartialUpdates(), clearGradient(), disallowPartialUpdates(), update(), updateRow(), and Variable().

real* PLearn::Variable::gradientdata
 

set to gradient.data()

Definition at line 145 of file Variable.h.

Referenced by defineGradientLocation(), makeDeepCopyFromShallowCopy(), makeSharedGradient(), resize(), updateAndClear(), and Variable().

bool PLearn::Variable::marked [protected]
 

used for building the propagation paths

Definition at line 127 of file Variable.h.

Referenced by clearMark(), isMarked(), setMark(), and Variable().

Mat PLearn::Variable::matDiagHessian
 

optionally computed second derivative (see bbprop methods)

Definition at line 142 of file Variable.h.

Referenced by resizeDiagHessian().

Mat PLearn::Variable::matGradient
 

Definition at line 139 of file Variable.h.

Referenced by clearGradient(), defineGradientLocation(), makeDeepCopyFromShallowCopy(), makeSharedGradient(), resize(), update(), and Variable().

Mat PLearn::Variable::matRValue
 

Definition at line 141 of file Variable.h.

Referenced by makeSharedRValue(), and resizeRValue().

Mat PLearn::Variable::matValue
 

Definition at line 138 of file Variable.h.

Referenced by length(), makeDeepCopyFromShallowCopy(), makeSharedValue(), resize(), size(), update(), Variable(), and width().

real PLearn::Variable::max_value
 

box constraints on values

Reimplemented in PLearn::UniformSampleVariable.

Definition at line 146 of file Variable.h.

Referenced by maxUpdate(), setBoxConstraint(), setMaxValue(), update(), and Variable().

real PLearn::Variable::min_value
 

Reimplemented in PLearn::UniformSampleVariable.

Definition at line 146 of file Variable.h.

Referenced by maxUpdate(), setBoxConstraint(), setKeepPositive(), setMinValue(), update(), and Variable().

int PLearn::Variable::nvars = 0 [static]
 

keeps track of how many vars have been created (also used for the default naming scheme, see getName() )

Definition at line 165 of file Variable.cc.

Referenced by Variable().

TVec<int> PLearn::Variable::rows_to_update [protected]
 

the list of rows to update.

Definition at line 133 of file Variable.h.

Referenced by allowPartialUpdates(), clearGradient(), update(), and updateRow().

Vec PLearn::Variable::rValue
 

Definition at line 140 of file Variable.h.

Referenced by copyRValueFrom(), copyRValueTo(), makeSharedRValue(), and resizeRValue().

real* PLearn::Variable::rvaluedata
 

Definition at line 150 of file Variable.h.

Referenced by makeSharedRValue(), and resizeRValue().

Vec PLearn::Variable::value
 

Definition at line 136 of file Variable.h.

Referenced by copyFrom(), copyTo(), copyValueInto(), makeDeepCopyFromShallowCopy(), makeSharedValue(), oldread(), resize(), Variable(), and write().

real* PLearn::Variable::valuedata
 

Set to value.data().

Definition at line 144 of file Variable.h.

Referenced by makeDeepCopyFromShallowCopy(), makeSharedValue(), maxUpdate(), resize(), update(), updateAndClear(), and Variable().

string PLearn::Variable::varname [protected]
 

used when printing or drawing the var graph (see setName and getName)

Definition at line 128 of file Variable.h.

Referenced by getName(), nameIsSet(), setName(), and Variable().

int PLearn::Variable::varnum
 

number of this variable (the first one created is numbered 1, the second 2, etc...)

Definition at line 124 of file Variable.h.

Referenced by getName(), and Variable().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:25:55 2004 for PLearn by doxygen 1.3.7