PetaVision  Alpha
PoolingIndexLayer.cpp
1 /*
2  * PoolingIndexLayer.cpp
3  *
4  * Created on: Dec 21, 2010
5  * Author: pschultz
6  */
7 
8 #include "PoolingIndexLayer.hpp"
9 #include "../layers/updateStateFunctions.h"
10 
11 namespace PV {
12 
13 PoolingIndexLayer::PoolingIndexLayer() { initialize_base(); }
14 
15 PoolingIndexLayer::PoolingIndexLayer(const char *name, HyPerCol *hc) {
16  initialize_base();
17  initialize(name, hc);
18 }
19 
20 PoolingIndexLayer::~PoolingIndexLayer() {}
21 
22 int PoolingIndexLayer::initialize_base() {
23  this->numChannels = 1;
24  return PV_SUCCESS;
25 }
26 
27 int PoolingIndexLayer::initialize(const char *name, HyPerCol *hc) {
28  int status = HyPerLayer::initialize(name, hc);
29  // This layer is storing it's buffers as ints. This is a check to make sure the sizes are the
30  // same
31  assert(sizeof(int) == sizeof(float));
32  assert(status == PV_SUCCESS);
33  return status;
34 }
35 
36 int PoolingIndexLayer::ioParamsFillGroup(enum ParamsIOFlag ioFlag) {
37  int status = HyPerLayer::ioParamsFillGroup(ioFlag);
38  return status;
39 }
40 
41 void PoolingIndexLayer::ioParam_dataType(enum ParamsIOFlag ioFlag) {
42  if (ioFlag == PARAMS_IO_READ) {
43  parent->parameters()->handleUnnecessaryParameter(name, "dataType");
44  dataType = PV_INT;
45  }
46 }
47 
48 // This function should never be called, since this layer should never be a post layer and only
49 // accessed from PoolingConn.
50 int PoolingIndexLayer::requireChannel(int channelNeeded, int *numChannelsResult) {
51  Fatal() << "PoolingIndexLayer cannot be a post layer\n";
52  return PV_SUCCESS;
53 }
54 
55 // This is a function that's overwriting HyPerCol
56 int PoolingIndexLayer::resetGSynBuffers(double timef, double dt) {
57  // Reset GSynBuffers does nothing, as the orig pooling connection deals with clearing this buffer
58  return PV_SUCCESS;
59 }
60 
61 } // end namespace PV
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
Definition: HyPerLayer.cpp:571
int initialize(const char *name, HyPerCol *hc)
Definition: HyPerLayer.cpp:129
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override