#ifndef CLAYER_HPP #define CLAYER_HPP 1 #include #include #include "block.hpp" #include "neuron.hpp" #include "util.hpp" using namespace std; const int BLOCK_GATE_NUM = 3; class CLayer { private: // Layer size information - number of blocks in the layer, and the // size of each block. (Each block in the layer has the same size; further // flexibility here isn't really necessary). int blockNum; int blockSize; int inputNum; // Total number of inputs to a given element in the layer, including all // recurrent connections. int inputVectorSize; // blockNum * blockSize int outputVectorSize; vector blocks; vector layerOutput; vector layerInput; // Too lazy to write copy constructor/assignment operator CLayer& operator=(const CLayer rhs); CLayer(CLayer& l); public: // Constructor/Destructor CLayer(int input_num, int block_num, int block_size); ~CLayer(); // Forward pass vector calcLayerOutput(vector inputs); // Backward pass vector calcSignals(vector outputSignals, vector< vector > outputWeights); void updateWeights(double eta); void clear(); vector getInputVector(vector inputs); vector< vector > getInputWeights(); int getOutputSize(); ostream& print(ostream& out); }; ostream& operator<<(ostream& out, CLayer& l); #endif // CLAYER_HPP