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.

54 lines
1.8 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef LOCAL_LAYER_H
  2. #define LOCAL_LAYER_H
  3. #include "../base/basicImage.h"
  4. #include "../base/basicLayer.h"
  5. #include "../base/basicCortex.h"
  6. #ifdef GPU
  7. class gpuCUDA;
  8. #endif
  9. class cpuHOST;
  10. class localLayer : public cortexLayer{
  11. private:
  12. uint32_t m_nColImage;
  13. float * m_pColImage;
  14. float * m_pGpuColImage;
  15. public:
  16. explicit localLayer(bool useGPU);
  17. virtual ~localLayer();
  18. bool create(uint32_t batch, uint32_t w, uint32_t h, uint32_t c, uint32_t n, uint32_t size, uint32_t stride, uint32_t pad, ACTIVATION activation);
  19. /* Virtual Methods */
  20. virtual void forward( cortexSTATE state);
  21. virtual void backward( cortexSTATE state);
  22. virtual void loadWeights(FILE * Ptr, bool trans = false);
  23. virtual void update( uint32_t batch, float learning_rate, float momentum, float decay);
  24. //virtual bool resize( uint32_t w, uint32_t h);
  25. #ifdef GPU
  26. friend class gpuCUDA;
  27. #endif
  28. friend class cpuHOST;
  29. friend class cortexProcessingUnit;
  30. };
  31. #ifdef GPU
  32. //void forward_local_layer_gpu(local_layer layer, network_state state);
  33. //void backward_local_layer_gpu(local_layer layer, network_state state);
  34. //void update_local_layer_gpu(local_layer layer, int batch, float learning_rate, float momentum, float decay);
  35. //void push_local_layer(local_layer layer);
  36. //void pull_local_layer(local_layer layer);
  37. #endif
  38. /*
  39. local_layer make_local_layer(int batch, int h, int w, int c, int n, int size, int stride, int pad, ACTIVATION activation);
  40. void forward_local_layer(const local_layer layer, network_state state);
  41. void backward_local_layer(local_layer layer, network_state state);
  42. void update_local_layer(local_layer layer, int batch, float learning_rate, float momentum, float decay);
  43. void bias_output(float *output, float *biases, int batch, int n, int size);
  44. void backward_bias(float *bias_updates, float *delta, int batch, int n, int size);
  45. */
  46. #endif