PLearn 0.1
|
The first sentence should be a BRIEF DESCRIPTION of what the class does. More...
#include <NullModule.h>
Public Member Functions | |
NullModule (const string &name="", bool call_build_=true) | |
### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //! | |
virtual void | fprop (const Vec &input, Vec &output) const |
given the input, compute the output (possibly resize it appropriately) | |
virtual void | forget () |
Reset the parameters to the state they would be BEFORE starting training. | |
virtual void | fprop (const TVec< Mat * > &ports_value) |
Does nothing. | |
virtual void | bpropAccUpdate (const TVec< Mat * > &ports_value, const TVec< Mat * > &ports_gradient) |
If required, the gradient w.r.t. the port is 0. | |
virtual const TVec< string > & | getPorts () |
One single port: 'null'. | |
virtual const TMat< int > & | getPortSizes () |
The port size is undefined. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual NullModule * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Post-constructor. | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
Static Public Member Functions | |
static string | _classname_ () |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static Object * | _new_instance_for_typemap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Private Types | |
typedef OnlineLearningModule | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
The first sentence should be a BRIEF DESCRIPTION of what the class does.
Place the rest of the class programmer documentation here. Doxygen supports Javadoc-style comments. See http://www.doxygen.org/manual.html
Definition at line 57 of file NullModule.h.
typedef OnlineLearningModule PLearn::NullModule::inherited [private] |
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 59 of file NullModule.h.
PLearn::NullModule::NullModule | ( | const string & | name = "" , |
bool | call_build_ = true |
||
) |
### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //!
Constructor.
Definition at line 59 of file NullModule.cc.
References build_().
string PLearn::NullModule::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 54 of file NullModule.cc.
OptionList & PLearn::NullModule::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 54 of file NullModule.cc.
RemoteMethodMap & PLearn::NullModule::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 54 of file NullModule.cc.
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 54 of file NullModule.cc.
Object * PLearn::NullModule::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Definition at line 54 of file NullModule.cc.
StaticInitializer NullModule::_static_initializer_ & PLearn::NullModule::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 54 of file NullModule.cc.
void PLearn::NullModule::bpropAccUpdate | ( | const TVec< Mat * > & | ports_value, |
const TVec< Mat * > & | ports_gradient | ||
) | [virtual] |
If required, the gradient w.r.t. the port is 0.
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 136 of file NullModule.cc.
References PLearn::TVec< T >::length(), PLearn::OnlineLearningModule::nPorts(), and PLASSERT.
{ PLASSERT( ports_gradient.length() == nPorts() ); Mat* null_grad = ports_gradient[0]; if (null_grad) { // Noone should ever provide us with a gradient w.r.t. 'null'. PLASSERT( null_grad->isEmpty() ); // All we need to do is resize the gradient matrix. PLASSERT( ports_value[0] ); PLASSERT( null_grad->width() == ports_value[0]->width() ); null_grad->resize(ports_value[0]->length(), null_grad->width()); } }
void PLearn::NullModule::build | ( | ) | [virtual] |
Post-constructor.
The normal implementation 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::OnlineLearningModule.
Definition at line 103 of file NullModule.cc.
References PLearn::OnlineLearningModule::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::NullModule::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 86 of file NullModule.cc.
Referenced by build(), and NullModule().
{ // ### This method should do the real building of the object, // ### according to set 'options', in *any* situation. // ### Typical situations include: // ### - Initial building of an object from a few user-specified options // ### - Building of a "reloaded" object: i.e. from the complete set of // ### all serialised options. // ### - Updating or "re-building" of an object after a few "tuning" // ### options have been modified. // ### You should assume that the parent class' build_() has already been // ### called. }
string PLearn::NullModule::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 54 of file NullModule.cc.
void PLearn::NullModule::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 66 of file NullModule.cc.
References PLearn::OnlineLearningModule::declareOptions().
{ // ### Declare all of this object's options here. // ### For the "flags" of each option, you should typically specify // ### one of OptionBase::buildoption, OptionBase::learntoption or // ### OptionBase::tuningoption. If you don't provide one of these three, // ### this option will be ignored when loading values from a script. // ### You can also combine flags, for example with OptionBase::nosave: // ### (OptionBase::buildoption | OptionBase::nosave) // ### ex: // declareOption(ol, "myoption", &NullModule::myoption, // OptionBase::buildoption, // "Help text describing this option"); // ... // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::NullModule::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 179 of file NullModule.h.
:
//##### Protected Member Functions ######################################
NullModule * PLearn::NullModule::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 54 of file NullModule.cc.
void PLearn::NullModule::forget | ( | ) | [virtual] |
Reset the parameters to the state they would be BEFORE starting training.
Note that this method is necessarily called from build().
Implements PLearn::OnlineLearningModule.
Definition at line 217 of file NullModule.cc.
{ }
given the input, compute the output (possibly resize it appropriately)
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 120 of file NullModule.cc.
{
// Nothing to do.
}
Does nothing.
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 125 of file NullModule.cc.
References PLearn::TVec< T >::length(), PLearn::OnlineLearningModule::nPorts(), and PLASSERT.
{ // Nothing to do. PLASSERT( ports_value.length() == nPorts() ); // Ensure we are not asking for the value of the 'null' port. PLASSERT( !ports_value[0] || !ports_value[0]->isEmpty() ); }
OptionList & PLearn::NullModule::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 54 of file NullModule.cc.
OptionMap & PLearn::NullModule::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 54 of file NullModule.cc.
const TVec< string > & PLearn::NullModule::getPorts | ( | ) | [virtual] |
One single port: 'null'.
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 154 of file NullModule.cc.
References PLearn::TVec< T >::append(), and PLearn::TVec< T >::isEmpty().
{ static TVec<string> null_port; if (null_port.isEmpty()) null_port.append("null"); return null_port; }
The port size is undefined.
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 164 of file NullModule.cc.
References PLearn::TMat< T >::fill(), PLearn::TMat< T >::isEmpty(), and PLearn::TMat< T >::resize().
{ static TMat<int> null_size; if (null_size.isEmpty()) { null_size.resize(1, 2); null_size.fill(-1); } return null_size; }
RemoteMethodMap & PLearn::NullModule::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 54 of file NullModule.cc.
void PLearn::NullModule::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 112 of file NullModule.cc.
References PLearn::OnlineLearningModule::makeDeepCopyFromShallowCopy().
{ inherited::makeDeepCopyFromShallowCopy(copies); }
Reimplemented from PLearn::OnlineLearningModule.
Definition at line 179 of file NullModule.h.