8 #include "InitOneToOneWeights.hpp" 12 InitOneToOneWeights::InitOneToOneWeights(
char const *name, HyPerCol *hc) { initialize(name, hc); }
14 InitOneToOneWeights::InitOneToOneWeights() {}
16 InitOneToOneWeights::~InitOneToOneWeights() {}
18 int InitOneToOneWeights::initialize(
char const *name, HyPerCol *hc) {
19 int status = InitWeights::initialize(name, hc);
25 ioParam_weightInit(ioFlag);
29 void InitOneToOneWeights::ioParam_weightInit(
enum ParamsIOFlag ioFlag) {
30 parent->parameters()->ioParamValue(ioFlag, getName(),
"weightInit", &mWeightInit, mWeightInit);
35 createOneToOneConnection(dataStart, patchIndex, mWeightInit);
38 int InitOneToOneWeights::createOneToOneConnection(
43 int unitCellIndex = dataIndexToUnitCellIndex(dataPatchIndex);
49 int sxp = mWeights->
getGeometry()->getPatchStrideX();
50 int syp = mWeights->
getGeometry()->getPatchStrideY();
51 int sfp = mWeights->
getGeometry()->getPatchStrideF();
54 memset(dataStart, 0, nxp * nyp * nfp);
56 int x = (int)(nxp / 2);
57 int y = (int)(nyp / 2);
58 for (
int f = 0; f < nfp; f++) {
59 dataStart[x * sxp + y * syp + f * sfp] = f == unitCellIndex ? weightInit : 0;
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
int getPatchSizeX() const
float * getDataFromDataIndex(int arbor, int dataIndex)
int getPatchSizeY() const
std::shared_ptr< PatchGeometry > getGeometry() const
virtual void calcWeights()
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
int getPatchSizeF() const