shared_ptr<Layer<Dtype> > GetBatchNormLayer(const LayerParameter& param) { BatchNormParameter_Engine engine = param.batch_norm_param().engine(); if (engine == BatchNormParameter_Engine_DEFAULT) { engine = BatchNormParameter_Engine_CAFFE; #ifdef USE_CUDNN engine = BatchNormParameter_Engine_CUDNN; #endif } if (engine == BatchNormParameter_Engine_CAFFE) { return shared_ptr<Layer<Dtype> >(new BatchNormLayer<Dtype>(param)); #ifdef USE_CUDNN } else if (engine == BatchNormParameter_Engine_CUDNN) { return shared_ptr<Layer<Dtype> >(new CuDNNBatchNormLayer<Dtype>(param)); #endif } else { LOG(FATAL) << "Layer " << param.name() << " has unknown engine."; } }
shared_ptr<Layer<Dtype> > GetBatchNormLayer(const LayerParameter& param) { BatchNormParameter_Engine engine = param.batch_norm_param().engine(); if (engine == BatchNormParameter_Engine_DEFAULT) { #if defined(USE_MKL2017_AS_DEFAULT_ENGINE) engine = BatchNormParameter_Engine_MKL2017; #else engine = BatchNormParameter_Engine_CAFFE; #endif } if (engine == BatchNormParameter_Engine_CAFFE) { return shared_ptr<Layer<Dtype> >(new BatchNormLayer<Dtype>(param)); #if defined(MKL2017_SUPPORTED) } else if (engine == BatchNormParameter_Engine_MKL2017) { return shared_ptr<Layer<Dtype> >(new MKLBatchNormLayer<Dtype>(param)); #endif } else { LOG(FATAL) << "Layer " << param.name() << " has unknown engine."; } }
shared_ptr<Layer<Dtype> > GetBatchNormLayer(const LayerParameter& param) { BatchNormParameter_Engine engine = param.batch_norm_param().engine(); // New, more flexible way of providing engine if (engine == BatchNormParameter_Engine_DEFAULT && param.engine() != "") { EngineParser ep(param.engine()); if (ep.isEngine("CAFFE")) engine = BatchNormParameter_Engine_CAFFE; #if defined(MKL2017_SUPPORTED) else if (ep.isEngine("MKL2017")) engine = BatchNormParameter_Engine_MKL2017; #endif #if defined(MKLDNN_SUPPORTED) else if (ep.isEngine("MKLDNN")) engine = BatchNormParameter_Engine_MKLDNN; #endif } if (engine == BatchNormParameter_Engine_DEFAULT) { engine = BatchNormParameter_Engine_CAFFE; } if (engine == BatchNormParameter_Engine_CAFFE) { return shared_ptr<Layer<Dtype> >(new BatchNormLayer<Dtype>(param)); #if defined(MKL2017_SUPPORTED) } else if (engine == BatchNormParameter_Engine_MKL2017) { return shared_ptr<Layer<Dtype> >(new MKLBatchNormLayer<Dtype>(param)); #endif #ifdef MKLDNN_SUPPORTED } else if (engine == BatchNormParameter_Engine_MKLDNN) { return shared_ptr<Layer<Dtype> >(new MKLDNNBatchNormLayer<Dtype>(param)); #endif } else { LOG(FATAL) << "Layer " << param.name() << " has unknown engine."; } return shared_ptr<Layer<Dtype> >(); }