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.
45 lines
1.5 KiB
45 lines
1.5 KiB
#ifndef __CORTEX_CONVOLUTIONAL_LAYER_HEADER__
|
|
#define __CORTEX_CONVOLUTIONAL_LAYER_HEADER__
|
|
|
|
#include "../base/basicLayer.h"
|
|
#include "../base/basicImage.h"
|
|
#include "../base/basicImageAux.h"
|
|
|
|
|
|
class convolutionalLayer: public cortexLayer{
|
|
private:
|
|
void swapBinary(void);
|
|
void binarizeWeights(float *weights, uint32_t n, uint32_t size, float *binary);
|
|
void binarize(float *input, uint32_t n, float *binary);
|
|
void binarizeInput(float *input, uint32_t n, uint32_t size, float *binary);
|
|
void denormalize(void);
|
|
uint32_t calcWorkspaceSize(void);
|
|
#ifdef GPU
|
|
#ifdef CUDNN
|
|
void cudnn_setup(void);
|
|
#endif
|
|
#endif
|
|
public:
|
|
explicit convolutionalLayer(bool useGPU = true);
|
|
virtual ~convolutionalLayer();
|
|
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);
|
|
|
|
cortexImage * getOutputImage(void);
|
|
cortexImage * getDeltaImage(void);
|
|
|
|
virtual void test(void);
|
|
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);
|
|
virtual bool resize( uint32_t w, uint32_t h);
|
|
|
|
friend class gpuCUDA;
|
|
friend class cpuHOST;
|
|
friend class crnnLayer;
|
|
friend class cortexProcessingUnit;
|
|
friend class cortexLayersFactory;
|
|
};
|
|
|
|
|
|
#endif
|