PetaVision
Alpha
|
#include <WeightsFileIO.hpp>
Public Member Functions | |
WeightsFileIO (FileStream *fileStream, MPIBlock const *mpiBlock, Weights *weights) | |
double | readWeights (int frameNumber) |
void | writeWeights (double timestamp, bool compress) |
Static Public Member Functions | |
static void | moveToFrame (BufferUtils::WeightHeader &header, FileStream &fileStream, int frameNumber) |
Private Member Functions | |
long | calcArborSizeFile (bool compressed) |
long | calcArborSizeLocal (bool compressed) |
int | calcNeededBorder (int nPre, int nPost, int patchSize) |
void | calcPatchBox (int &startPatchX, int &endPatchX, int &startPatchY, int &endPatchY) |
void | calcPatchRange (int nPre, int nPost, int preStartBorder, int preEndBorder, int patchSize, int &startPatch, int &endPatch) |
void | checkHeader (BufferUtils::WeightHeader const &header) |
void | compressPatch (unsigned char *dataForFile, float const *sourceWeights, int count, float minValue, float maxValue) |
void | decompressPatch (unsigned char const *dataFromFile, float *destWeights, int count, float minValue, float maxValue) |
bool | isCompressedHeader (BufferUtils::WeightHeader const &header) |
void | loadWeightsFromBuffer (std::vector< unsigned char > const &dataFromFile, int arbor, float minValue, float maxValue, bool compressed) |
BufferUtils::WeightHeader | readHeader (int frameNumber) |
double | readNonsharedWeights (int frameNumber, BufferUtils::WeightHeader const &header) |
double | readSharedWeights (int frameNumber, BufferUtils::WeightHeader const &header) |
void | storeNonsharedPatches (std::vector< unsigned char > &dataFromFile, int arbor, float minValue, float maxValue, bool compressed) |
void | storeSharedPatches (std::vector< unsigned char > &dataFromFile, int arbor, float minValue, float maxValue, bool compressed) |
void | writeNonsharedWeights (double timestamp, bool compress) |
void | writePatch (unsigned char const *patchBuffer, bool compressed) |
void | writeSharedWeights (double timestamp, bool compress) |
Private Attributes | |
FileStream * | mFileStream = nullptr |
MPIBlock const * | mMPIBlock = nullptr |
int const | mRootProcess = 0 |
Weights * | mWeights = nullptr |
int const | tagbase = 500 |
A class for reading from a weight pvp file stream into a patch atlas, or writing a patch atlas into a weight pvp file stream.
Definition at line 17 of file WeightsFileIO.hpp.
|
private |
The size in bytes of one arbor in the PVP file. This is the number of patches times the patch size in bytes. For shared weights, the number of patches is mWeights * getNumDataPatches(). For nonshared weights, the number of patches is the number of global presynaptic neurons required by a connection of the specified size. (that is, the computation does not use the preLoc.halo, but computes the margin from PatchSizeX and PatchSizeY.
In both cases, the patch size in bytes is 8 + nxp*nyp*nfp*dataSize, where dataSize is 1 for compressed weights and 4 for noncompressed weights nxp = mWeights->getPatchSizeX() nyp = mWeights->getPatchSizeY() nfp = mWeights->getPatchSizeF()
Definition at line 492 of file WeightsFileIO.cpp.
|
private |
The size in bytes of one arbor, in PVP format, of the weights on one MPI process. For shared weights, this is the same as the value returned by calcArborSizeGlobal. For nonshared weights, the number of patches is the local number of extended presynaptic neurons
Definition at line 519 of file WeightsFileIO.cpp.
|
static |
Positions a weight pvp file to the start of the data (i.e. just past the end of the header) of the indicated frame. The header for that frame is read into the buffer pointed by the first argument.
Definition at line 479 of file WeightsFileIO.cpp.
|
private |
Writes a patch from the buffer to the current position of the FileStream. patchBuffer contains the patch header; only the active region of the patch is written; bytes outside the active region are left unchanged in the file stream. After the call, the FileStream's write position is at the end of the patch (even if the active region does not extend all the way to the end).
Definition at line 423 of file WeightsFileIO.cpp.