Added BatchNorm Layer (Testing still needs to be done)

This commit is contained in:
perseusdg
2022-01-10 18:43:12 +05:30
parent e1eac2d42a
commit bcf0c4eab3
2 changed files with 89 additions and 1 deletions
+22 -1
View File
@@ -32,7 +32,8 @@ enum layerType_t {
LAYER_UPSAMPLE,
LAYER_REGION,
LAYER_YOLO,
LAYER_PADDING
LAYER_PADDING,
LAYER_BATCHNORM
};
#define TKDNN_BN_MIN_EPSILON 1e-5
@@ -89,6 +90,7 @@ public:
case LAYER_REGION: return "Region";
case LAYER_YOLO: return "Yolo";
case LAYER_PADDING: return "Padding";
case LAYER_BATCHNORM: return "BatchNorm";
default: return "unknown";
}
}
@@ -604,6 +606,25 @@ public:
};
class BatchNorm : public LayerBNWgs {
public:
BatchNorm(Network *net,int output,std::string fname_weights);
virtual ~BatchNorm();
virtual layerType_t getLayerType(){return LAYER_BATCHNORM;};
virtual dnnType* infer(dataDim_t& dim,dnnType* srcData);
std::string weights_bin;
protected:
cudnnFilterDescriptor_t filterDesc;
cudnnConvolutionFwdAlgoPerf_t algo;
cudnnConvolutionBwdDataAlgoPerf_t bwAlgo;
cudnnTensorDescriptor_t biasTensorDesc;
void initCUDNN();
void inferCUDNN(dnnType* srcData);
void* workSpace;
size_t ws_sizeInBytes;
};
/**
Softmax layer
*/