PetaVision  Alpha
PV::ImpliedWeights Class Reference

#include <ImpliedWeights.hpp>

Inheritance diagram for PV::ImpliedWeights:
PV::Weights

Public Member Functions

 ImpliedWeights (std::string const &name)
 
 ImpliedWeights (std::string const &name, int patchSizeX, int patchSizeY, int patchSizeF, PVLayerLoc const *preLoc, PVLayerLoc const *postLoc, double timestamp)
 
void allocateDataStructures ()
 
int calcDataIndexFromPatchIndex (int patchIndex) const
 
float calcMaxWeight ()
 
float calcMaxWeight (int arbor)
 
float calcMinWeight ()
 
float calcMinWeight (int arbor)
 
void checkpointWeightPvp (Checkpointer *checkpointer, char const *objectName, char const *bufferName, bool compressFlag)
 
void copyToGPU ()
 
float * getData (int arbor)
 
float * getData (int arbor, double timestamp)
 
float * getDataFromDataIndex (int arbor, int dataIndex)
 
float * getDataFromDataIndex (int arbor, int dataIndex, double timestamp)
 
float * getDataFromPatchIndex (int arbor, int patchIndex)
 
float * getDataFromPatchIndex (int arbor, int patchIndex, double timestamp)
 
float const * getDataReadOnly (int arbor) const
 
PVCuda::CudaBuffer * getDeviceData () const
 
PVCuda::CudaBuffer * getDevicePatchToDataLookup () const
 
std::shared_ptr< PatchGeometrygetGeometry () const
 
std::string const & getName () const
 
int getNumArbors () const
 
int getNumDataPatches () const
 
int getNumDataPatchesF () const
 
int getNumDataPatchesX () const
 
int getNumDataPatchesY () const
 
Patch const & getPatch (int patchIndex) const
 
int getPatchSizeF () const
 
int getPatchSizeOverall () const
 
int getPatchSizeX () const
 
int getPatchSizeY () const
 
int getPatchStrideF () const
 
int getPatchStrideX () const
 
int getPatchStrideY () const
 
bool getSharedFlag () const
 
double getTimestamp () const
 
bool getWeightsArePlastic () const
 
void initialize (std::shared_ptr< PatchGeometry > geometry, int numArbors, bool sharedWeights, double timestamp)
 
void initialize (Weights const *baseWeights)
 
void initialize (int patchSizeX, int patchSizeY, int patchSizeF, PVLayerLoc const *preLoc, PVLayerLoc const *postLoc, int numArbors, bool sharedWeights, double timestamp)
 
bool isUsingGPU ()
 
void setCudaDevice (PVCuda::CudaDevice *device)
 
void setMargins (PVHalo const &preHalo, PVHalo const &postHalo)
 
void setTimestamp (double timestamp)
 
void setWeightsArePlastic ()
 
void useGPU ()
 

Protected Member Functions

void allocateCudaBuffers ()
 
void setName (std::string const &name)
 
void setNumDataPatches (int numDataPatchesX, int numDataPatchesY, int numDataPatchesF)
 

Private Member Functions

virtual void initNumDataPatches () override
 

Detailed Description

ImpliedWeights is derived from the Weights class. It constructs the PatchGeometry the same way as the base class, but the number of data patches is zero in all dimensions, and the Data vector is empty.

ImpliedWeights was motivated by PoolingConn, which uses HyPerConn-style patch geometry, but the weights are all equal.

Since the Data vector is always empty, the getData, getDataFromPatchIndex, and getDataFromDataIndex methods always throw out_of_range exceptions. The calcMinWeight methods return a large-magnitude positive number, and the calcMaxWeight methods return a large-magnitude negative number.

Definition at line 30 of file ImpliedWeights.hpp.

Member Function Documentation

void PV::Weights::allocateDataStructures ( )
inherited

Allocates the patch geometry and the the patch data vector. The Weights object is not completely initialized until this method is called. Once allocateDataStructures() is called once, subsequent calls return immediately and have no effect.

Definition at line 83 of file Weights.cpp.

float PV::Weights::calcMaxWeight ( )
inherited

Calculates the maximum value of the patch data over all arbors. For nonshared weights, only the active regions of the patches are considered when taking the minimum.

Definition at line 277 of file Weights.cpp.

float PV::Weights::calcMaxWeight ( int  arbor)
inherited

Calculates the maximum value of the patch data over the given arbor. For nonshared weights, only the active regions of the patches are considered when taking the minimum.

Definition at line 288 of file Weights.cpp.

float PV::Weights::calcMinWeight ( )
inherited

Calculates the minimum value of the patch data over all arbors. For nonshared weights, only the active regions of the patches are considered when taking the minimum.

Definition at line 238 of file Weights.cpp.

float PV::Weights::calcMinWeight ( int  arbor)
inherited

Calculates the minimum value of the patch data over the given arbor. For nonshared weights, only the active regions of the patches are considered when taking the minimum.

Definition at line 249 of file Weights.cpp.

void PV::Weights::copyToGPU ( )
inherited

If CUDA is being used, copy the weights onto the GPU.

Definition at line 317 of file Weights.cpp.

float * PV::Weights::getData ( int  arbor)
inherited

Returns a pointer to the patch data for the given arbor

Definition at line 196 of file Weights.cpp.

float* PV::Weights::getData ( int  arbor,
double  timestamp 
)
inherited

Returns a modifiable pointer to the patch data for the given arbor, and sets the timestamp to the given value

float * PV::Weights::getDataFromDataIndex ( int  arbor,
int  dataIndex 
)
inherited

Returns a pointer to the patch data for the given data index

Definition at line 200 of file Weights.cpp.

float* PV::Weights::getDataFromDataIndex ( int  arbor,
int  dataIndex,
double  timestamp 
)
inherited

Returns a modifiable pointer to the patch data for the given data index, and sets the timestamp to the given value

float * PV::Weights::getDataFromPatchIndex ( int  arbor,
int  patchIndex 
)
inherited

Returns a pointer to the patch data for data index corresponding to the given patch index

Definition at line 205 of file Weights.cpp.

float* PV::Weights::getDataFromPatchIndex ( int  arbor,
int  patchIndex,
double  timestamp 
)
inherited

Returns a modifiable pointer to the patch data for data index corresponding to the given patch index, and sets the timestamp to the give value

float const * PV::Weights::getDataReadOnly ( int  arbor) const
inherited

Returns a read-only pointer to the patch data for the given arbor

Definition at line 198 of file Weights.cpp.

std::shared_ptr<PatchGeometry> PV::Weights::getGeometry ( ) const
inlineinherited

The get-method for the PatchGeometry object

Definition at line 148 of file Weights.hpp.

std::string const& PV::Weights::getName ( ) const
inlineinherited

The get-method for the name of the object

Definition at line 145 of file Weights.hpp.

int PV::Weights::getNumArbors ( ) const
inlineinherited

The get-method for the number of arbors

Definition at line 151 of file Weights.hpp.

int PV::Weights::getNumDataPatches ( ) const
inlineinherited

Returns the overall number of data patches

Definition at line 174 of file Weights.hpp.

int PV::Weights::getNumDataPatchesF ( ) const
inlineinherited

The get-method for the number of data patches in the feature direction. For both shared and nonshared weights, this is the number of features in the presynaptic layer.

Definition at line 171 of file Weights.hpp.

int PV::Weights::getNumDataPatchesX ( ) const
inlineinherited

The get-method for the number of data patches in the x-direction. For shared weights, this is the number of kernels in the x-direction. For nonshared weights, it is the number of neurons in the extended region in the x-direction.

Definition at line 158 of file Weights.hpp.

int PV::Weights::getNumDataPatchesY ( ) const
inlineinherited

The get-method for the number of data patches in the y-direction. For shared weights, this is the number of kernels in the y-direction. For nonshared weights, it is the number of neurons in the extended region in the y-direction.

Definition at line 165 of file Weights.hpp.

Patch const & PV::Weights::getPatch ( int  patchIndex) const
inherited

Returns a nonmutable reference to the patch info for the given patch index.

Definition at line 194 of file Weights.cpp.

int PV::Weights::getPatchSizeF ( ) const
inlineinherited

The get-method for the patch size in the feature dimension

Definition at line 225 of file Weights.hpp.

int PV::Weights::getPatchSizeOverall ( ) const
inlineinherited

Returns getPatchSizeX() * getPatchSizeY() * getPatchSizeF(), the overall number of items in a patch.

Definition at line 231 of file Weights.hpp.

int PV::Weights::getPatchSizeX ( ) const
inlineinherited

The get-method for the patch size in the x-dimension

Definition at line 219 of file Weights.hpp.

int PV::Weights::getPatchSizeY ( ) const
inlineinherited

The get-method for the patch size in the y-dimension

Definition at line 222 of file Weights.hpp.

int PV::Weights::getPatchStrideF ( ) const
inlineinherited

Returns the memory stride between adjacent feature indices with the same x- and y- coordinates

Definition at line 236 of file Weights.hpp.

int PV::Weights::getPatchStrideX ( ) const
inlineinherited

Returns the memory stride between adjacent x-coordinates with the same y-coordinate and feature index

Definition at line 242 of file Weights.hpp.

int PV::Weights::getPatchStrideY ( ) const
inlineinherited

Returns the memory stride between adjacent y-coordinates with the same x-coordinate and feature index

Definition at line 248 of file Weights.hpp.

bool PV::Weights::getSharedFlag ( ) const
inlineinherited

The get-method for the sharedWeights flag

Definition at line 142 of file Weights.hpp.

double PV::Weights::getTimestamp ( ) const
inlineinherited

Retrieves a previously set timestamp

Definition at line 216 of file Weights.hpp.

void PV::Weights::initialize ( std::shared_ptr< PatchGeometry geometry,
int  numArbors,
bool  sharedWeights,
double  timestamp 
)
inherited

An initializer that uses the specified PatchGeometry object as its patch geometry. This method allows two Weights objects to share the same PatchGeometry object.

Definition at line 34 of file Weights.cpp.

void PV::Weights::initialize ( Weights const *  baseWeights)
inherited

A constructor that uses the geometry of an existing Weights object. The PatchGeometry object is shared, and the other data members are copied.

Definition at line 55 of file Weights.cpp.

void PV::Weights::initialize ( int  patchSizeX,
int  patchSizeY,
int  patchSizeF,
PVLayerLoc const *  preLoc,
PVLayerLoc const *  postLoc,
int  numArbors,
bool  sharedWeights,
double  timestamp 
)
inherited

An initializer that takes the patch size and pre- and post-synaptic PVLayerLoc arguments to define the PatchGeometry object.

Definition at line 64 of file Weights.cpp.

void PV::Weights::setMargins ( PVHalo const &  preHalo,
PVHalo const &  postHalo 
)
inherited

Copies the given halos into the halos of the PatchGeometry object. in the PatchIt is an error to call this method after the PatchGeometry object's allocateDataStructures method has been called. (Recall that multiple Weights objects can share a PatchGeometry object).

Definition at line 78 of file Weights.cpp.

void PV::Weights::setTimestamp ( double  timestamp)
inlineinherited

Sets the timestamp

Definition at line 213 of file Weights.hpp.


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