8 #include "InitGaussianRandomWeights.hpp" 12 InitGaussianRandomWeights::InitGaussianRandomWeights(
char const *name, HyPerCol *hc) {
16 InitGaussianRandomWeights::InitGaussianRandomWeights() {}
18 InitGaussianRandomWeights::~InitGaussianRandomWeights() {
19 pvAssert(dynamic_cast<Random *>(mGaussianRandState) == mRandState);
20 delete mGaussianRandState;
24 int InitGaussianRandomWeights::initialize(
char const *name, HyPerCol *hc) {
25 int status = InitRandomWeights::initialize(name, hc);
31 ioParam_wGaussMean(ioFlag);
32 ioParam_wGaussStdev(ioFlag);
36 void InitGaussianRandomWeights::ioParam_wGaussMean(
enum ParamsIOFlag ioFlag) {
37 parent->parameters()->ioParamValue(ioFlag, name,
"wGaussMean", &mWGaussMean, mWGaussMean);
40 void InitGaussianRandomWeights::ioParam_wGaussStdev(
enum ParamsIOFlag ioFlag) {
41 parent->parameters()->ioParamValue(ioFlag, name,
"wGaussStdev", &mWGaussStdev, mWGaussStdev);
44 int InitGaussianRandomWeights::initRNGs(
bool isKernel) {
45 pvAssert(mRandState ==
nullptr && mGaussianRandState ==
nullptr);
46 int status = PV_SUCCESS;
55 if (mGaussianRandState ==
nullptr) {
57 "InitRandomWeights error in rank %d process: unable to create object of class " 59 parent->getCommunicator()->globalCommRank());
61 mRandState = (
Random *)mGaussianRandState;
71 for (
int n = 0; n < patchSize; n++) {
72 patchDataStart[n] = mGaussianRandState->gaussianDist(patchIndex, mWGaussMean, mWGaussStdev);
int getPatchSizeOverall() const
int getNumDataPatches() const
std::shared_ptr< PatchGeometry > getGeometry() const
virtual void randomWeights(float *patchDataStart, int patchIndex) override
int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override