PetaVision  Alpha
PV::NormalizeMax Class Reference
Inheritance diagram for PV::NormalizeMax:
PV::NormalizeMultiply PV::NormalizeBase PV::BaseObject PV::CheckpointerDataInterface PV::Observer

NormalizeBase Parameters

List of parameters needed from the NormalizeBase class

virtual void ioParam_normalizeMethod (enum ParamsIOFlag ioFlag)
 normalizeMethod: Specifies the type of weight normalization. More...
 
virtual void ioParam_normalizeArborsIndividually (enum ParamsIOFlag ioFlag)
 
virtual void ioParam_normalizeOnInitialize (enum ParamsIOFlag ioFlag)
 
virtual void ioParam_normalizeOnWeightUpdate (enum ParamsIOFlag ioFlag)
 

NormalizeMultiply Parameters

List of parameters needed from the NormalizeMultiply class

virtual void ioParam_rMinX (enum ParamsIOFlag ioFlag)
 
virtual void ioParam_rMinY (enum ParamsIOFlag ioFlag)
 
virtual void ioParam_nonnegativeConstraintFlag (enum ParamsIOFlag ioFlag)
 
virtual void ioParam_normalize_cutoff (enum ParamsIOFlag ioFlag)
 
virtual void ioParam_normalizeFromPostPerspective (enum ParamsIOFlag ioFlag)
 

Public Member Functions

 NormalizeMax (const char *name, HyPerCol *hc)
 
void addWeightsToList (Weights *weights)
 
bool getDataStructuresAllocatedFlag () const
 
std::string const & getDescription () const
 
char const * getDescription_c () const
 
bool getInitialValuesSetFlag () const
 
bool getInitInfoCommunicatedFlag () const
 
MPIBlock const * getMPIBlock ()
 
char const * getName () const
 
bool getNormalizeArborsIndividuallyFlag () const
 
float getNormalizeCutoff ()
 
bool getNormalizeFromPostPerspectiveFlag ()
 
bool getNormalizeOnInitialize () const
 
bool getNormalizeOnWeightUpdate () const
 
std::string const & getObjectType () const
 
float getRMinX ()
 
float getRMinY ()
 
float getStrength () const
 
void ioParams (enum ParamsIOFlag ioFlag, bool printHeader, bool printFooter)
 
virtual int ioParamsFillGroup (enum ParamsIOFlag ioFlag) override
 
bool isUsingGPU () const
 
char const * lookupKeyword () const
 
virtual int normalizeWeights () override
 
void readParams ()
 
virtual Response::Status registerData (Checkpointer *checkpointer)
 
virtual Response::Status respond (std::shared_ptr< BaseMessage const > message) override
 
void writeParams ()
 

Protected Member Functions

virtual Response::Status allocateDataStructures ()
 
int applyRMin (float *dataPatchStart, float rMinX, float rMinY, int nxp, int nyp, int xPatchStride, int yPatchStride)
 
int applyThreshold (float *dataPatchStart, int weights_in_patch, float wMax)
 
virtual Response::Status cleanup ()
 
virtual Response::Status communicateInitInfo (std::shared_ptr< CommunicateInitInfoMessage const > message) override
 
virtual Response::Status copyInitialStateToGPU ()
 
int initialize (const char *name, HyPerCol *hc)
 
virtual Response::Status initializeState ()
 
virtual void ioParam_minMaxTolerated (enum ParamsIOFlag ioFlag)
 
virtual Response::Status prepareCheckpointWrite ()
 
virtual Response::Status processCheckpointRead ()
 
virtual Response::Status readStateFromCheckpoint (Checkpointer *checkpointer) override
 
Response::Status respondAllocateData (std::shared_ptr< AllocateDataMessage const > message)
 
Response::Status respondCleanup (std::shared_ptr< CleanupMessage const > message)
 
Response::Status respondCommunicateInitInfo (std::shared_ptr< CommunicateInitInfoMessage const > message)
 
Response::Status respondConnectionNormalize (std::shared_ptr< ConnectionNormalizeMessage const > message)
 
Response::Status respondCopyInitialStateToGPU (std::shared_ptr< CopyInitialStateToGPUMessage const > message)
 
Response::Status respondInitializeState (std::shared_ptr< InitializeStateMessage const > message)
 
Response::Status respondPrepareCheckpointWrite (std::shared_ptr< PrepareCheckpointWriteMessage const > message)
 
Response::Status respondProcessCheckpointRead (std::shared_ptr< ProcessCheckpointReadMessage const > message)
 
Response::Status respondReadStateFromCheckpoint (std::shared_ptr< ReadStateFromCheckpointMessage< Checkpointer > const > message)
 
Response::Status respondRegisterData (std::shared_ptr< RegisterDataMessage< Checkpointer > const > message)
 
Response::Status respondSetCudaDevice (std::shared_ptr< SetCudaDeviceMessage const > message)
 
virtual Response::Status setCudaDevice (std::shared_ptr< SetCudaDeviceMessage const > message)
 
void setDataStructuresAllocatedFlag ()
 
void setDescription ()
 
void setInitialValuesSetFlag ()
 
void setInitInfoCommunicatedFlag ()
 
int setName (char const *name)
 
virtual void setObjectType () override
 
int setParent (HyPerCol *hc)
 
bool weightsHaveUpdated () const
 

Static Protected Member Functions

static int accumulateMax (float *dataPatchStart, int weights_in_patch, float *max)
 
static int accumulateMaxAbs (float *dataPatchStart, int weights_in_patch, float *max)
 
static int accumulateMin (float *dataPatchStart, int weights_in_patch, float *max)
 
static int accumulateSum (float *dataPatchStart, int weights_in_patch, float *sum)
 
static int accumulateSumShrunken (float *dataPatchStart, float *sum, int nxpShrunken, int nypShrunken, int offsetShrunken, int xPatchStride, int yPatchStride)
 
static int accumulateSumSquared (float *dataPatchStart, int weights_in_patch, float *sumsq)
 
static int accumulateSumSquaredShrunken (float *dataPatchStart, float *sumsq, int nxpShrunken, int nypShrunken, int offsetShrunken, int xPatchStride, int yPatchStride)
 
static void normalizePatch (float *patchData, int weightsPerPatch, float multiplier)
 

Protected Attributes

std::string description
 
PVCuda::CudaDevice * mCudaDevice = nullptr
 
bool mDataStructuresAllocatedFlag = false
 
bool mInitialValuesSetFlag = false
 
bool mInitInfoCommunicatedFlag = false
 
float minMaxTolerated
 
double mLastTimeNormalized = 0.0
 
bool mNonnegativeConstraintFlag = false
 
bool mNormalizeArborsIndividually = false
 
float mNormalizeCutoff = 0.0f
 
bool mNormalizeFromPostPerspective = false
 
char * mNormalizeMethod = nullptr
 
bool mNormalizeOnInitialize = true
 
bool mNormalizeOnWeightUpdate = true
 
std::string mObjectType
 
float mRMinX = 0.0f
 
float mRMinY = 0.0f
 
float mStrength = 1.0f
 
bool mUsingGPUFlag = false
 
std::vector< Weights * > mWeightsList
 
char * name = nullptr
 
HyPerColparent = nullptr
 

Private Member Functions

int initialize_base ()
 

Detailed Description

Definition at line 15 of file NormalizeMax.hpp.

Member Function Documentation

int PV::NormalizeMultiply::applyRMin ( float *  dataPatchStart,
float  rMinX,
float  rMinY,
int  nxp,
int  nyp,
int  xPatchStride,
int  yPatchStride 
)
protectedinherited

Zeroes out all weights in a rectangle defined by the member variables rMinX, rMinY. dataPatchStart is a pointer to a patch. nxp and nyp are the dimensions of the patch xPatchStride, yPatchStride are the strides in the x- and y-directions. nfp is implicitly the same as xPatchStride rMinX and rMinY are the half-width and half-height of the rectangle to be zeroed out. The rectangle to be zeroed out is centered at the center of the patch. Pixels in the interior of the rectangle are set to zero, but pixels exactly on the edge of the rectangle are not changed.

Definition at line 224 of file NormalizeMultiply.cpp.

int PV::NormalizeMultiply::applyThreshold ( float *  dataPatchStart,
int  weights_in_patch,
float  wMax 
)
protectedinherited

Sets all weights in a patch whose absolute value is below a certain value, to zero dataPatchStart is a pointer to a buffer of weights weights_in_patch is the number of weights in the dataPatchStart buffer wMax defines the threshold. If |w| < wMax * normalize_cutoff, the weight will be zeroed.

Definition at line 209 of file NormalizeMultiply.cpp.

bool PV::BaseObject::getDataStructuresAllocatedFlag ( ) const
inlineinherited

Get-method for mDataStructuresAllocatedFlag, which is false on initialization and then becomes true once setDataStructuresAllocatedFlag() is called.

Definition at line 102 of file BaseObject.hpp.

bool PV::BaseObject::getInitialValuesSetFlag ( ) const
inlineinherited

Get-method for mInitialValuesSetFlag, which is false on initialization and then becomes true once setInitialValuesSetFlag() is called.

Definition at line 108 of file BaseObject.hpp.

bool PV::BaseObject::getInitInfoCommunicatedFlag ( ) const
inlineinherited

Get-method for mInitInfoCommunicatedFlag, which is false on initialization and then becomes true once setInitInfoCommunicatedFlag() is called.

Definition at line 95 of file BaseObject.hpp.

void PV::NormalizeMultiply::ioParam_nonnegativeConstraintFlag ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

If set to true, negative weights are replaced by zero

Definition at line 41 of file NormalizeMultiply.cpp.

void PV::NormalizeMultiply::ioParam_normalize_cutoff ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

If positive, all weights whose absolute value is less than (normalize_cutoff * (max weight over all patches and all arbors)) are set to zero. The maximum weight is calculated after applying the behavior defined by rMinX, rMinY and nonnegativeConstraintFlag.

Definition at line 50 of file NormalizeMultiply.cpp.

void PV::NormalizeMultiply::ioParam_normalizeFromPostPerspective ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

If set to true, the weights are group based on the index of the post-synaptic neuron. If false, the index of the pre-synaptic neuron is used.

Currently only meaningfull if sharedWeights is true and normalizeMethod is normalizeSum or normalizeL2.

Definition at line 55 of file NormalizeMultiply.cpp.

void PV::NormalizeBase::ioParam_normalizeMethod ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

normalizeMethod: Specifies the type of weight normalization.

This parameter is not used directly inside the NormalizeBase class, except to include the parameter in generated params files. Generally, instantiation should proceed by separately reading the NormalizeMethod and using the Factory::createByKeyword template to instantiate the function.

Definition at line 38 of file NormalizeBase.cpp.

void PV::NormalizeMultiply::ioParam_rMinX ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

Sets the size in the x-direction of the rectangle zeroed out by applyRMin

Definition at line 33 of file NormalizeMultiply.cpp.

void PV::NormalizeMultiply::ioParam_rMinY ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

Sets the size in the y-direction of the rectangle zeroed out by applyRMin

Definition at line 37 of file NormalizeMultiply.cpp.

void PV::BaseObject::ioParams ( enum ParamsIOFlag  ioFlag,
bool  printHeader,
bool  printFooter 
)
inherited

Method for reading or writing the params from group in the parent HyPerCol's parameters. The group from params is selected using the name of the connection.

If ioFlag is set to write, the printHeader and printFooter flags control whether a header and footer for the parameter group is produces. These flags are set to true for layers, connections, and probes; and set to false for weight initializers and normalizers. If ioFlag is set to read, the printHeader and printFooter flags are ignored.

Note that ioParams is not virtual. To add parameters in a derived class, override ioParamFillGroup.

Definition at line 74 of file BaseObject.cpp.

int PV::NormalizeMax::ioParamsFillGroup ( enum ParamsIOFlag  ioFlag)
overridevirtual

The virtual method for reading parameters from the parent HyPerCol's parameters, and writing to the output params file.

Derived classes with additional parameters typically override ioParamsFillGroup to call the base class's ioParamsFillGroup method and then call ioParam_[parametername] for each of their parameters. The ioParam_[parametername] methods should call the parent HyPerCol's ioParamValue() and related methods, to ensure that all parameters that get read also get written to the outputParams-generated file.

Reimplemented from PV::NormalizeMultiply.

Definition at line 25 of file NormalizeMax.cpp.

bool PV::BaseObject::isUsingGPU ( ) const
inlineinherited

Returns true if the object requires the GPU; false otherwise. HyPerCol will not initialize the GPU unless one of the objects in its hierarchy returns true

Definition at line 116 of file BaseObject.hpp.

char const * PV::BaseObject::lookupKeyword ( ) const
inherited

Look up the keyword of the params group with the same name as the object.

Definition at line 42 of file BaseObject.cpp.

void PV::BaseObject::readParams ( )
inlineinherited

A method that reads the parameters for the group whose name matches the name of the object. It, along with writeParams(), is a wrapper around ioParams, so that readParams and writeParams automatically run through the same parameters in the same order.

Definition at line 62 of file BaseObject.hpp.

Response::Status PV::NormalizeBase::respondConnectionNormalize ( std::shared_ptr< ConnectionNormalizeMessage const >  message)
protectedinherited

If the normalizeOnInitialize flag is set and the simulation time is startTime(), or if the normalizeOnWeightUpdate flag is set and the weight updater's LastUpdateTime is greater than the normalizer's LastUpdateTime, this method calls the (virtual protected) method normalizeWeights(). Otherwise, this method does nothing.

Definition at line 80 of file NormalizeBase.cpp.

void PV::BaseObject::setDataStructuresAllocatedFlag ( )
inlineprotectedinherited

This method sets mDataStructuresAllocatedFlag to true.

Definition at line 175 of file BaseObject.hpp.

void PV::BaseObject::setInitialValuesSetFlag ( )
inlineprotectedinherited

This method sets the flag returned by getInitialValuesSetFlag to true.

Definition at line 180 of file BaseObject.hpp.

void PV::BaseObject::setInitInfoCommunicatedFlag ( )
inlineprotectedinherited

This method sets mInitInfoCommunicatedFlag to true.

Definition at line 170 of file BaseObject.hpp.

void PV::BaseObject::writeParams ( )
inlineinherited

A method that writes the parameters for the group whose name matches the name of the object. It, along with readParams(), is a wrapper around ioParams, so that readParams and writeParams automatically run through the same parameters in the same order.

Definition at line 69 of file BaseObject.hpp.


The documentation for this class was generated from the following files: