PetaVision  Alpha
RescaleLayer.hpp
1 /*
2  * RescaleLayer.cpp
3  * Rescale layer is a cloneVLayer, grabs activity from orig layer and rescales it
4  */
5 
6 #ifndef RESCALELAYER_HPP_
7 #define RESCALELAYER_HPP_
8 
9 #include "CloneVLayer.hpp"
10 
11 namespace PV {
12 
13 // CloneLayer can be used to implement Sigmoid junctions between spiking neurons
14 class RescaleLayer : public CloneVLayer {
15  public:
16  RescaleLayer(const char *name, HyPerCol *hc);
17  virtual ~RescaleLayer();
18  virtual Response::Status
19  communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) override;
20  virtual void allocateV() override;
21  virtual Response::Status updateState(double timef, double dt) override;
22  virtual int setActivity() override;
23 
24  float getTargetMax() { return targetMax; }
25  float getTargetMin() { return targetMin; }
26  float getTargetMean() { return targetMean; }
27  float getTargetStd() { return targetStd; }
28  float getL2PatchSize() { return patchSize; }
29  char const *getRescaleMethod() { return rescaleMethod; }
30 
31  protected:
32  RescaleLayer();
33  int initialize(const char *name, HyPerCol *hc);
34  int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
35 
36  void ioParam_targetMax(enum ParamsIOFlag ioFlag);
37  void ioParam_targetMin(enum ParamsIOFlag ioFlag);
38  void ioParam_targetMean(enum ParamsIOFlag ioFlag);
39  void ioParam_targetStd(enum ParamsIOFlag ioFlag);
40  void ioParam_rescaleMethod(enum ParamsIOFlag ioFlag);
41  void ioParam_patchSize(enum ParamsIOFlag ioFlag);
42 
43  private:
44  int initialize_base();
45 
46  protected:
47  float targetMax;
48  float targetMin;
49  float targetMean;
50  float targetStd;
51  char *rescaleMethod; // can be either maxmin or meanstd
52  int patchSize;
53 }; // class RescaleLayer
54 
55 } // namespace PV
56 
57 #endif /* CLONELAYER_HPP_ */
int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override