8 #include "InitUniformWeights.hpp" 12 InitUniformWeights::InitUniformWeights(
char const *name, HyPerCol *hc) { initialize(name, hc); }
14 InitUniformWeights::InitUniformWeights() {}
16 InitUniformWeights::~InitUniformWeights() {}
18 int InitUniformWeights::initialize(
char const *name, HyPerCol *hc) {
19 int status = InitWeights::initialize(name, hc);
31 parent->parameters()->ioParamValue(ioFlag, name,
"weightInit", &mWeightInit, mWeightInit);
35 parent->parameters()->ioParamValue(
38 "connectOnlySameFeatures",
39 &mConnectOnlySameFeatures,
40 mConnectOnlySameFeatures);
46 const int kf = patchIndex % nfp;
48 uniformWeights(dataStart, mWeightInit, kf, mConnectOnlySameFeatures);
51 void InitUniformWeights::uniformWeights(
55 bool connectOnlySameFeatures) {
60 const int sxp = mWeights->
getGeometry()->getPatchStrideX();
61 const int syp = mWeights->
getGeometry()->getPatchStrideY();
62 const int sfp = mWeights->
getGeometry()->getPatchStrideF();
65 for (
int y = 0; y < nyp; y++) {
66 for (
int x = 0; x < nxp; x++) {
67 for (
int f = 0; f < nfp; f++) {
68 if ((connectOnlySameFeatures) and (kf != f)) {
69 dataStart[x * sxp + y * syp + f * sfp] = 0;
72 dataStart[x * sxp + y * syp + f * sfp] = weightInit;
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