PetaVision  Alpha
InitUniformWeights.hpp
1 /*
2  * InitUniformWeights.hpp
3  *
4  * Created on: Aug 23, 2011
5  * Author: kpeterson
6  */
7 
8 #ifndef INITUNIFORMWEIGHTS_HPP_
9 #define INITUNIFORMWEIGHTS_HPP_
10 
11 #include "InitWeights.hpp"
12 
13 namespace PV {
14 
19  protected:
29  virtual void ioParam_weightInit(enum ParamsIOFlag ioFlag);
30 
37  virtual void ioParam_connectOnlySameFeatures(enum ParamsIOFlag ioFlag);
40  public:
41  InitUniformWeights(const char *name, HyPerCol *hc);
42  virtual ~InitUniformWeights();
43 
44  virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
45 
46  float getWeightInit() const { return mWeightInit; }
47  bool getConnectOnlySameFeatures() const { return mConnectOnlySameFeatures; }
48 
49  protected:
51  int initialize(const char *name, HyPerCol *hc);
52  virtual void calcWeights(int patchIndex, int arborId) override;
53 
54  private:
55  void uniformWeights(float *dataStart, float weightInit, int kf, bool connectOnlySameFeatures);
56 
57  private:
58  float mWeightInit = 0.0f;
59  bool mConnectOnlySameFeatures = false;
60 
61 }; // class InitUniformWeights
62 
63 } /* namespace PV */
64 #endif /* INITUNIFORMWEIGHTS_HPP_ */
virtual void ioParam_weightInit(enum ParamsIOFlag ioFlag)
weightInit: The value of each weight.
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual void ioParam_connectOnlySameFeatures(enum ParamsIOFlag ioFlag)
connectOnlySameFeatures: If this flag is set to false, all weights are set to the weightInit value...
virtual void calcWeights()