You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.8 KiB
64 lines
1.8 KiB
#ifndef __GRU_LAYER_HEADERS__
|
|
#define __GRU_LAYER_HEADERS__
|
|
|
|
//#include "activations.h"
|
|
//#include "layer.h"
|
|
//#include "network.h"
|
|
|
|
#include "../base/basicLayer.h"
|
|
|
|
#include "connectedLayer.h"
|
|
|
|
class gruLayer : public cortexLayer{
|
|
private:
|
|
void increment(connectedLayer * tPtr, int steps);
|
|
connectedLayer * inputZLayer;
|
|
connectedLayer * inputRLayer;
|
|
connectedLayer * inputHLayer;
|
|
connectedLayer * stateZLayer;
|
|
connectedLayer * stateRLayer;
|
|
connectedLayer * stateHLayer;
|
|
float * m_pState;
|
|
float * m_pPrevState;
|
|
float * m_pForgotState;
|
|
float * m_pForgotDelta;
|
|
float * m_pR;
|
|
float * m_pZ;
|
|
float * m_pH;
|
|
#ifdef GPU
|
|
float * m_pGpuState;
|
|
float * m_pGpuPrevState;
|
|
float * m_pGpuForgotState;
|
|
float * m_pGpuForgotDelta;
|
|
float * m_pGpuR;
|
|
float * m_pGpuZ;
|
|
float * m_pGpuH;
|
|
#endif
|
|
public:
|
|
explicit gruLayer(bool useGPU = true);
|
|
virtual ~gruLayer();
|
|
bool create( uint32_t batch, uint32_t inputs, uint32_t outputs, uint32_t steps, bool batch_normalize);
|
|
virtual void forward( cortexSTATE state);
|
|
virtual void backward( cortexSTATE state);
|
|
virtual void loadWeights(FILE * Ptr, bool trans = false);
|
|
virtual void update( uint32_t batch, float learning_rate, float momentum, float decay);
|
|
|
|
friend class gpuCUDA;
|
|
friend class cpuHOST;
|
|
};
|
|
|
|
/*
|
|
void forward_gru_layer(layer l, network_state state);
|
|
void backward_gru_layer(layer l, network_state state);
|
|
void update_gru_layer(layer l, int batch, float learning_rate, float momentum, float decay);
|
|
|
|
#ifdef GPU
|
|
void forward_gru_layer_gpu(layer l, network_state state);
|
|
void backward_gru_layer_gpu(layer l, network_state state);
|
|
void update_gru_layer_gpu(layer l, int batch, float learning_rate, float momentum, float decay);
|
|
void push_gru_layer(layer l);
|
|
void pull_gru_layer(layer l);
|
|
#endif
|
|
*/
|
|
#endif
|
|
|