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.

49 lines
1.5 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __RNN_LAYER_HEADERS__
  2. #define __RNN_LAYER_HEADERS__
  3. //#include "activations.h"
  4. //#include "layer.h"
  5. //#include "network.h"
  6. //#define USET
  7. #include "../base/basicLayer.h"
  8. #include "connectedLayer.h"
  9. class rnnLayer : public cortexLayer{
  10. private:
  11. void increment( connectedLayer * tPtr, int steps );
  12. connectedLayer * inputLayer;
  13. connectedLayer * selfLayer;
  14. connectedLayer * outputLayer;
  15. float * m_pState;
  16. #ifdef GPU
  17. float * m_pGpuState;
  18. #endif
  19. public:
  20. explicit rnnLayer(bool useGPU = true);
  21. virtual ~rnnLayer();
  22. bool create( uint32_t batch, uint32_t inputs, uint32_t hidden, uint32_t outputs, uint32_t steps, ACTIVATION activation, bool batch_normalize, int logic);
  23. virtual void forward( cortexSTATE state);
  24. virtual void backward( cortexSTATE state);
  25. virtual void loadWeights(FILE * Ptr, bool trans = false);
  26. virtual void update( uint32_t batch, float learning_rate, float momentum, float decay);
  27. friend class gpuCUDA;
  28. friend class cpuHOST;
  29. };
  30. /*
  31. void forward_rnn_layer(layer l, network_state state);
  32. void backward_rnn_layer(layer l, network_state state);
  33. void update_rnn_layer(layer l, int batch, float learning_rate, float momentum, float decay);
  34. #ifdef GPU
  35. void forward_rnn_layer_gpu(layer l, network_state state);
  36. void backward_rnn_layer_gpu(layer l, network_state state);
  37. void update_rnn_layer_gpu(layer l, int batch, float learning_rate, float momentum, float decay);
  38. void push_rnn_layer(layer l);
  39. void pull_rnn_layer(layer l);
  40. #endif
  41. */
  42. #endif