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.

44 lines
1.5 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __CORTEX_CONVOLUTIONAL_LAYER_HEADER__
  2. #define __CORTEX_CONVOLUTIONAL_LAYER_HEADER__
  3. #include "../base/basicLayer.h"
  4. #include "../base/basicImage.h"
  5. #include "../base/basicImageAux.h"
  6. class convolutionalLayer: public cortexLayer{
  7. private:
  8. void swapBinary(void);
  9. void binarizeWeights(float *weights, uint32_t n, uint32_t size, float *binary);
  10. void binarize(float *input, uint32_t n, float *binary);
  11. void binarizeInput(float *input, uint32_t n, uint32_t size, float *binary);
  12. void denormalize(void);
  13. uint32_t calcWorkspaceSize(void);
  14. #ifdef GPU
  15. #ifdef CUDNN
  16. void cudnn_setup(void);
  17. #endif
  18. #endif
  19. public:
  20. explicit convolutionalLayer(bool useGPU = true);
  21. virtual ~convolutionalLayer();
  22. virtual bool create( uint32_t batch, uint32_t h, uint32_t w, uint32_t c, uint32_t n, uint32_t size, uint32_t stride, uint32_t padding, ACTIVATION activation, bool batch_normalize, bool binary, bool xnor, bool adam);
  23. cortexImage * getOutputImage(void);
  24. cortexImage * getDeltaImage(void);
  25. virtual void test(void);
  26. virtual void forward( cortexSTATE state);
  27. virtual void backward( cortexSTATE state);
  28. virtual void loadWeights(FILE * Ptr, bool trans = false);
  29. virtual void update( uint32_t batch, float learning_rate, float momentum, float decay);
  30. virtual bool resize( uint32_t w, uint32_t h);
  31. friend class gpuCUDA;
  32. friend class cpuHOST;
  33. friend class crnnLayer;
  34. friend class cortexProcessingUnit;
  35. friend class cortexLayersFactory;
  36. };
  37. #endif