Пример #1
0
shared_ptr<Layer<Dtype> > GetConcatLayer(const LayerParameter& param) {
  ConcatParameter_Engine engine = param.concat_param().engine();
  if (engine == ConcatParameter_Engine_DEFAULT) {
    engine = ConcatParameter_Engine_CAFFE;
#if defined(USE_MKL2017_AS_DEFAULT_ENGINE)
    if (param.concat_param().axis() == 1)
      engine = ConcatParameter_Engine_MKL2017;
#endif
  }
  if (engine == ConcatParameter_Engine_CAFFE) {
    return shared_ptr<Layer<Dtype> >(new ConcatLayer<Dtype>(param));
#if defined(MKL2017_SUPPORTED)
  } else if (engine == ConcatParameter_Engine_MKL2017) {
    return shared_ptr<Layer<Dtype> >(new MKLConcatLayer<Dtype>(param));
#endif
  } else {
    LOG(FATAL) << "Layer " << param.name() << " has unknow engine.";
  }
}
Пример #2
0
shared_ptr<Layer<Dtype> > GetConcatLayer(const LayerParameter& param) {
  ConcatParameter_Engine engine = param.concat_param().engine();

  // New, more flexible way of providing engine
  if (engine == ConcatParameter_Engine_DEFAULT && param.engine() != "") {
    EngineParser ep(param.engine());

    if (ep.isEngine("CAFFE"))
      engine = ConcatParameter_Engine_CAFFE;
#if defined(MKL2017_SUPPORTED)
    else if (ep.isEngine("MKL2017") && param.concat_param().axis() == 1)
      engine = ConcatParameter_Engine_MKL2017;
#endif
#if defined(MKLDNN_SUPPORTED)
    else if (ep.isEngine("MKLDNN"))
      engine = ConcatParameter_Engine_MKLDNN;
#endif
  }

  if (engine == ConcatParameter_Engine_DEFAULT) {
    engine = ConcatParameter_Engine_CAFFE;
  }
  if (engine == ConcatParameter_Engine_CAFFE) {
    return shared_ptr<Layer<Dtype> >(new ConcatLayer<Dtype>(param));
#if defined(MKL2017_SUPPORTED)
  } else if (engine == ConcatParameter_Engine_MKL2017) {
    return shared_ptr<Layer<Dtype> >(new MKLConcatLayer<Dtype>(param));
#endif
#ifdef MKLDNN_SUPPORTED
  } else if (engine == ConcatParameter_Engine_MKLDNN) {
    return shared_ptr<Layer<Dtype> >(new MKLDNNConcatLayer<Dtype>(param));
#endif
  } else {
    LOG(FATAL) << "Layer " << param.name() << " has unknow engine.";
  }
  return shared_ptr<Layer<Dtype> >();
}