1 #include "caffe2/mkl/mkl_utils.h" 3 #include "caffe2/core/init.h" 4 #include "caffe2/core/tensor.h" 6 #ifdef CAFFE2_HAS_MKL_DNN 9 caffe2_mkl_implicit_layout_change,
false,
10 "Controls the behavior when we call View() on an MKLMemory: if it is set " 11 "true, then the View() function will actually change the underlying " 12 "storage. If it is set false, an implicit copy is triggered but the " 13 "original storage is not affected." 18 CAFFE_KNOWN_TYPE(mkl::MKLMemory<float>);
19 CAFFE_KNOWN_TYPE(mkl::MKLMemory<double>);
22 static vector<TIndex> GetMKLTensorInfo(
26 DeviceOption* device) {
27 const mkl::MKLMemory<T>* tc =
static_cast<const mkl::MKLMemory<T>*
>(c);
30 *capacity = tc->size() *
sizeof(T);
31 device->set_device_type(MKLDNN);
32 device->set_cuda_gpu_id(0);
37 static TypeMeta GetMKLTensorType(
const void*) {
38 return TypeMeta::Make<T>();
42 static void RegisterForType() {
43 RegisterTypeCallFunction(
45 RegisterTensorInfoFunction(
49 static bool Caffe2InitializeMKL(
int*,
char***) {
50 RegisterForType<float>();
51 RegisterForType<double>();
55 REGISTER_CAFFE2_INIT_FUNCTION(
58 "Register wrappers for MKLContext");
62 #endif // CAFFE2_HAS_MKL_DNN
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...