#include <Func.h>
Inheritance diagram for PLearn::Function:
Public Types | |
typedef Object | inherited |
Public Member Functions | |
Function () | |
Function *. | |
Function (const VarArray &the_inputs, const VarArray &the_outputs) | |
Function (const VarArray &the_inputs, const VarArray ¶meters_to_optimize, const VarArray &the_outputs) | |
virtual void | build () |
simply calls inherited::build() then build_() | |
virtual void | makeDeepCopyFromShallowCopy (map< const void *, void * > &copies) |
Transforms a shallow copy into a deep copy. | |
PLEARN_DECLARE_OBJECT (Function) | |
void | fprop (const Vec &in, const Vec &out) const |
void | fprop (const Array< Vec > &in, const Array< Vec > &out) const |
void | fbprop (const Vec &in, const Vec &out, const Vec &input_gradient, const Vec &output_gradient) |
void | fbprop (const Array< Vec > &in, const Array< Vec > &out, const Array< Vec > &input_gradient, const Array< Vec > &output_gradient) |
void | fbbprop (const Vec &in, const Vec &out, const Vec &gradient, const Mat &hessian) |
given input, compute output, gradient (=doutput/dinput) and hessian (=d^2output/dinput^2) | |
void | fbbpropAcc (const Vec &in, const Vec &out, const Vec &gradient, const Mat &hessian) |
same thing but accumulate output, gradient and hessian | |
void | rfprop (const Vec &in, const Vec &out, const Vec &input_rvalue, const Vec &output_rvalue, bool do_fprop=true) |
void | recomputeParents () |
recomputes the value of all the vars that influence the output but do not depend on the declared inputs (shared parameters for instance...) | |
Func | differentiate () |
Vec | operator() (const Vec &input) const |
real | operator() (const Vec &input1, const Vec &input2) const |
VarArray | operator() (const VarArray &new_inputs) const |
void | verifyGradient (const Vec &in, real step=0.01) |
take the values given in the in Vec | |
void | verifyHessian (const Vec &in, real step=0.01) |
void | verifyGradient (real minval, real maxval, real step=0.01) |
take the values randomly between minval and maxval | |
void | verifyGradient (real step=0.01) |
take the current values of the inputs variables | |
void | verifySymbolicGradient (const Vec &in) |
void | verifyrfprop (const Vec &in, real step=0.01) |
Public Attributes | |
VarArray | inputs |
VarArray | parameters |
nonInputSources | |
VarArray | outputs |
int | inputsize |
int | outputsize |
VarArray | fproppath |
VarArray | bproppath |
VarArray | parentspath |
path on which to do a fprop to update the values of all the non-input direct parents on the fproppath (this will be called by method recomputeParents() ) | |
Func | df |
remembers the symbolic derivative | |
Static Protected Member Functions | |
void | declareOptions (OptionList &ol) |
Declares this class' options. | |
Private Member Functions | |
void | build_ () |
This does the actual building. |
|
Reimplemented from PLearn::Object. |
|
Function *.
|
|
Definition at line 108 of file Func.cc. References build_(). |
|
Definition at line 114 of file Func.cc. References build_(). |
|
simply calls inherited::build() then build_()
Reimplemented from PLearn::Object. Definition at line 181 of file Func.cc. References build_(). |
|
This does the actual building.
Reimplemented from PLearn::Object. Definition at line 141 of file Func.cc. References bproppath, fproppath, inputs, inputsize, PLearn::TVec< Var >::isEmpty(), PLearn::TVec< Var >::length(), PLearn::VarArray::nelems(), PLearn::nonInputSources(), outputs, outputsize, parameters, parentspath, PLearn::propagationPath(), and PLearn::propagationPathToParentsOfPath(). Referenced by build(), and Function(). |
|
Declares this class' options.
Reimplemented from PLearn::Object. Definition at line 128 of file Func.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
Returns a Func that will compute the derivative of this function's output (expected to be a scalar) relative to the given input (of length inputsize) The computed derivative has (logically) also a length of inputsize. (This call uses symbolic gradient computation) Definition at line 329 of file Func.cc. References PLearn::VarArray::clearSymbolicGradient(), df, PLearn::endl(), fproppath, inputs, PLearn::TVec< Var >::isNull(), PLearn::VarArray::nelems(), outputs, PLearn::VarArray::parents(), PLERROR, PLearn::propagationPath(), PLearn::TVec< Var >::size(), PLearn::VarArray::symbolicBprop(), and PLearn::VarArray::symbolicGradient(). Referenced by fbbprop(), fbbpropAcc(), verifyrfprop(), and verifySymbolicGradient(). |
|
given input, compute output, gradient (=doutput/dinput) and hessian (=d^2output/dinput^2)
Definition at line 259 of file Func.cc. References df, differentiate(), PLearn::VarArray::fprop(), fproppath, inputs, PLearn::Mat, and outputs. Referenced by verifyHessian(), and verifyrfprop(). |
|
same thing but accumulate output, gradient and hessian
Definition at line 288 of file Func.cc. References PLearn::VarArray::accumulateTo(), df, differentiate(), PLearn::VarArray::fprop(), fproppath, inputs, and outputs. |
|
Definition at line 243 of file Func.cc. References PLearn::VarArray::clearGradient(), PLearn::VarArray::copyGradientFrom(), PLearn::VarArray::copyGradientTo(), PLearn::VarArray::fbprop(), fproppath, inputs, outputs, and PLERROR. |
|
when put_gradient_on_first_element_only, a gradient of 1 is put in only the first element of the output gradient this is a hack that is useful for having a SumOfVariable computing several costs in parallel, but backpropagating only through the first Definition at line 223 of file Func.cc. References PLearn::VarArray::clearGradient(), PLearn::VarArray::copyGradientFrom(), PLearn::VarArray::copyGradientTo(), PLearn::displayVarGraph(), PLearn::VarArray::fbprop(), fproppath, inputs, outputs, and PLERROR. Referenced by verifyGradient(), and verifySymbolicGradient(). |
|
Definition at line 206 of file Func.cc. References PLearn::VarArray::fprop(), fproppath, inputs, and outputs. |
|
Definition at line 199 of file Func.cc. References PLearn::VarArray::fprop(), fproppath, inputs, outputs, and PLearn::Vec. Referenced by operator()(), rfprop(), verifyGradient(), and verifyHessian(). |
|
Transforms a shallow copy into a deep copy.
Definition at line 187 of file Func.cc. References bproppath, PLearn::deepCopyField(), df, fproppath, inputs, outputs, parameters, and parentspath. |
|
builds a whole new Var graph modeled after the current one but starting from new_inputs (instead of inputs) the resulting new_outputs var array is returned by the call All variables on the direct path from inputs to outputs are cloned but the parents of the cloned variables are the same as the originals (parents of the variables in the path are shared). Definition at line 382 of file Func.cc. References PLearn::CopiesMap, inputs, PLearn::TVec< Var >::length(), PLearn::VarArray::makeDeepCopyFromShallowCopy(), PLearn::nonInputParentsOfPath(), outputs, PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 213 of file Func.cc. References PLearn::VarArray::copyFrom(), PLearn::VarArray::fprop(), fproppath, inputs, outputs, outputsize, PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 373 of file Func.cc. References fprop(), and outputsize. |
|
|
|
recomputes the value of all the vars that influence the output but do not depend on the declared inputs (shared parameters for instance...)
Definition at line 326 of file Func.cc. References PLearn::VarArray::fprop(), and parentspath. |
|
Definition at line 317 of file Func.cc. References PLearn::VarArray::copyRValueFrom(), PLearn::VarArray::copyRValueTo(), fprop(), fproppath, inputs, outputs, and PLearn::VarArray::rfprop(). |
|
take the current values of the inputs variables
Definition at line 576 of file Func.cc. References inputs, inputsize, and verifyGradient(). |
|
take the values randomly between minval and maxval
Definition at line 569 of file Func.cc. References PLearn::fill_random_uniform(), inputsize, and verifyGradient(). |
|
take the values given in the in Vec
Definition at line 519 of file Func.cc. References PLearn::apply(), PLearn::TVec< T >::copy(), PLearn::dot(), PLearn::endl(), PLearn::FABS(), fbprop(), fprop(), inputsize, PLearn::max(), PLearn::norm(), outputsize, PLWARNING, and PLearn::tRealFunc. Referenced by verifyGradient(). |
|
Definition at line 439 of file Func.cc. References PLearn::TMat< T >::copy(), PLearn::endl(), fbbprop(), fprop(), inputsize, PLearn::max(), outputsize, and PLERROR. |
|
Definition at line 602 of file Func.cc. References df, differentiate(), PLearn::endl(), fbbprop(), inputsize, PLearn::max(), outputsize, and PLearn::transposeProduct(). |
|
Checks that the gradient computed by a bprop on the function and the gradient computed by a fprop on the symbolic derivative of the function give the same results Definition at line 583 of file Func.cc. References df, differentiate(), PLearn::displayFunction(), PLearn::endl(), fbprop(), inputsize, PLearn::TVec< T >::length(), outputsize, and PLERROR. |
|
Definition at line 98 of file Func.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
remembers the symbolic derivative
Definition at line 101 of file Func.h. Referenced by differentiate(), fbbprop(), fbbpropAcc(), makeDeepCopyFromShallowCopy(), verifyrfprop(), and verifySymbolicGradient(). |
|
Definition at line 97 of file Func.h. Referenced by build_(), differentiate(), fbbprop(), fbbpropAcc(), fbprop(), fprop(), makeDeepCopyFromShallowCopy(), operator()(), and rfprop(). |
|
Definition at line 90 of file Func.h. Referenced by build_(), differentiate(), fbbprop(), fbbpropAcc(), fbprop(), fprop(), makeDeepCopyFromShallowCopy(), operator()(), rfprop(), and verifyGradient(). |
|
Definition at line 95 of file Func.h. Referenced by build_(), verifyGradient(), verifyHessian(), verifyrfprop(), and verifySymbolicGradient(). |
|
Definition at line 92 of file Func.h. Referenced by build_(), differentiate(), fbbprop(), fbbpropAcc(), fbprop(), fprop(), makeDeepCopyFromShallowCopy(), operator()(), and rfprop(). |
|
Definition at line 96 of file Func.h. Referenced by build_(), operator()(), verifyGradient(), verifyHessian(), verifyrfprop(), and verifySymbolicGradient(). |
|
nonInputSources
Definition at line 91 of file Func.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
path on which to do a fprop to update the values of all the non-input direct parents on the fproppath (this will be called by method recomputeParents() )
Definition at line 99 of file Func.h. Referenced by build_(), makeDeepCopyFromShallowCopy(), and recomputeParents(). |