Repository: pytorch
Issue: Build fails for caffe2/CMakeFiles/caffe2.dir/__/aten/src/ATen/native/mkldnn/Conv.cpp.o; possibly MKL-DNN issue
Labels: caffe2

## 🐛 Bug

PyTorch fails to build with an issue related to MKL-DNN. I previously built MKL-DNN by `cmake`ing from their GitHub repo.

Error trace is below:

```bash
[91mIn file included from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/opt/pytorch/aten/src/ATen/mkldnn/Runtime.h: In constructor ‘at::native::Stream::Stream()’:
/opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:42:40: error: ‘mkldnn::stream::kind’ has not been declared
   Stream():_cpu_stream(mkldnn::stream::kind::eager) {}
                                        ^~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp: In function ‘at::Tensor at::native::mkldnn_convolution(const at::Tensor&, const at::Tensor&, const at::Tensor&, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, int64_t)’:
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:98:29: error: ‘mkldnn::memory::format’ has not been declared
   auto format_any = memory::format::any;
                             ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:99:30: error: ‘mkldnn::memory::format’ has not been declared
   auto format_nchw = memory::format::nchw;
                              ^~~~~~
[0m[91m/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:100:42: error: ‘mkldnn::memory::format’ has not been declared
   auto format_weight = (g!= 1) ? memory::format::goihw : memory::format::oihw;
                                          ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:100:66: error: ‘mkldnn::memory::format’ has not been declared
   auto format_weight = (g!= 1) ? memory::format::goihw : memory::format::oihw;
                                                                  ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:101:27: error: ‘mkldnn::memory::format’ has not been declared
   auto format_x = memory::format::x;
                           ^~~~~~
[0m[91m/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:131:21: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
     input.data_ptr());
                     ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:133:22: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
     weight.data_ptr());
                      ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:135:22: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
     output.data_ptr());
                      ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
[0m[91m/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:139:36: error: ‘using element_type = struct mkldnn::convolution_forward::primitive_desc’ {aka ‘struct mkldnn::convolution_forward::primitive_desc’} has no member named ‘src_primitive_desc’; did you mean ‘primitive_desc’?
   auto input_pd = conv_forward_pd->src_primitive_desc();
                                    ^~~~~~~~~~~~~~~~~~
                                    primitive_desc
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:140:23: error: unable to deduce ‘auto’ from ‘input_usr_memory’
   auto input_memory = input_usr_memory;
                       ^~~~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:141:56: error: ‘primitive_desc’ is not a member of ‘mkldnn::memory’
   if (input_usr_memory.get_primitive_desc() != memory::primitive_desc(input_pd)) {
                                                        ^~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:146:37: error: ‘using element_type = struct mkldnn::convolution_forward::primitive_desc’ {aka ‘struct mkldnn::convolution_forward::primitive_desc’} has no member named ‘weights_primitive_desc’; did you mean ‘primitive_desc’?
   auto weight_pd = conv_forward_pd->weights_primitive_desc();
                                     ^~~~~~~~~~~~~~~~~~~~~~
                                     primitive_desc
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:147:24: error: unable to deduce ‘auto’ from ‘weight_usr_memory’
   auto weight_memory = weight_usr_memory;
                        ^~~~~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:148:57: error: ‘primitive_desc’ is not a member of ‘mkldnn::memory’
   if (weight_usr_memory.get_primitive_desc() != memory::primitive_desc(weight_pd)) {
                                                         ^~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:153:37: error: ‘using element_type = struct mkldnn::convolution_forward::primitive_desc’ {aka ‘struct mkldnn::convolution_forward::primitive_desc’} has no member named ‘dst_primitive_desc’; did you mean ‘primitive_desc’?
   auto output_pd = conv_forward_pd->dst_primitive_desc();
                                     ^~~~~~~~~~~~~~~~~~
                                     primitive_desc
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:154:24: error: unable to deduce ‘auto’ from ‘output_usr_memory’
   auto output_memory = output_usr_memory;
                        ^~~~~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:155:57: error: ‘primitive_desc’ is not a member of ‘mkldnn::memory’
   if (output_usr_memory.get_primitive_desc() != memory::primitive_desc(output_pd)) {
                                                         ^~~~~~~~~~~~~~
[0m[91m/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:163:22: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
       bias.data_ptr()));
                      ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:176:35: error: ‘struct mkldnn::stream’ has no member named ‘submit’
   Stream::Instance().get_stream().submit(net);
                                   ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp: In function ‘at::Tensor at::native::mkldnn_convolution_backward_input(c10::IntArrayRef, const at::Tensor&, const at::Tensor&, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, int64_t, bool)’:
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:209:29: error: ‘mkldnn::memory::format’ has not been declared
   auto format_any = memory::format::any;
                             ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:210:30: error: ‘mkldnn::memory::format’ has not been declared
   auto format_nchw = memory::format::nchw;
                              ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:211:42: error: ‘mkldnn::memory::format’ has not been declared
   auto format_weight = (g!= 1) ? memory::format::goihw : memory::format::oihw;
                                          ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:211:66: error: ‘mkldnn::memory::format’ has not been declared
   auto format_weight = (g!= 1) ? memory::format::goihw : memory::format::oihw;
                                                                  ^~~~~~
[0m[91m/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:251:27: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
     grad_output.data_ptr());
                           ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:253:22: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
     weight.data_ptr());
                      ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:255:26: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
     grad_input.data_ptr());
                          ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:259:48: error: ‘using element_type = struct mkldnn::convolution_backward_data::primitive_desc’ {aka ‘struct mkldnn::convolution_backward_data::primitive_desc’} has no member named ‘diff_dst_primitive_desc’; did you mean ‘primitive_desc’?
   auto grad_output_pd = conv_backward_data_pd->diff_dst_primitive_desc();
                                                ^~~~~~~~~~~~~~~~~~~~~~~
                                                primitive_desc
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:260:29: error: unable to deduce ‘auto’ from ‘grad_output_usr_memory’
   auto grad_output_memory = grad_output_usr_memory;
                             ^~~~~~~~~~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:261:62: error: ‘primitive_desc’ is not a member of ‘mkldnn::memory’
   if (grad_output_usr_memory.get_primitive_desc() != memory::primitive_desc(grad_output_pd)) {
                                                              ^~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:266:43: error: ‘using element_type = struct mkldnn::convolution_backward_data::primitive_desc’ {aka ‘struct mkldnn::convolution_backward_data::primitive_desc’} has no member named ‘weights_primitive_desc’; did you mean ‘primitive_desc’?
   auto weight_pd = conv_backward_data_pd->weights_primitive_desc();
                                           ^~~~~~~~~~~~~~~~~~~~~~
                                           primitive_desc
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:267:24: error: unable to deduce ‘auto’ from ‘weight_usr_memory’
   auto weight_memory = weight_usr_memory;
                        ^~~~~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:268:57: error: ‘primitive_desc’ is not a member of ‘mkldnn::memory’
   if (weight_usr_memory.get_primitive_desc() != memory::primitive_desc(weight_pd)) {
                                                         ^~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:273:47: error: ‘using element_type = struct mkldnn::convolution_backward_data::primitive_desc’ {aka ‘struct mkldnn::convolution_backward_data::primitive_desc’} has no member named ‘diff_src_primitive_desc’; did you mean ‘primitive_desc’?
   auto grad_input_pd = conv_backward_data_pd->diff_src_primitive_desc();
                                               ^~~~~~~~~~~~~~~~~~~~~~~
                                               primitive_desc
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:274:28: error: unable to deduce ‘auto’ from ‘grad_input_usr_memory’
   auto grad_input_memory = grad_input_usr_memory;
                            ^~~~~~~~~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:275:57: error: ‘primitive_desc’ is not a member of ‘mkldnn::memory’
   if (grad_input_memory.get_primitive_desc() != memory::primitive_desc(grad_input_pd)) {
                                                         ^~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:288:35: error: ‘struct mkldnn::stream’ has no member named ‘submit’
   Stream::Instance().get_stream().submit(net);
                                   ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp: In function ‘std::tuple<at::Tensor, at::Tensor> at::native::mkldnn_convolution_backward_weights(c10::IntArrayRef, const at::Tensor&, const at::Tensor&, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, int64_t, bool)’:
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:326:29: error: ‘mkldnn::memory::format’ has not been declared
   auto format_any = memory::format::any;
                             ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:327:30: error: ‘mkldnn::memory::format’ has not been declared
   auto format_nchw = memory::format::nchw;
                              ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:328:42: error: ‘mkldnn::memory::format’ has not been declared
   auto format_weight = (g!= 1) ? memory::format::goihw : memory::format::oihw;
                                          ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:328:66: error: ‘mkldnn::memory::format’ has not been declared
   auto format_weight = (g!= 1) ? memory::format::goihw : memory::format::oihw;
                                                                  ^~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:329:27: error: ‘mkldnn::memory::format’ has not been declared
   auto format_x = memory::format::x;
                           ^~~~~~
[0m[91m/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:375:21: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
     input.data_ptr());
                     ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:377:27: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
     grad_output.data_ptr());
                           ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:379:27: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
     grad_weight.data_ptr());
                           ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:384:44: error: ‘using element_type = struct mkldnn::convolution_backward_weights::primitive_desc’ {aka ‘struct mkldnn::convolution_backward_weights::primitive_desc’} has no member named ‘src_primitive_desc’; did you mean ‘primitive_desc’?
   auto input_pd = conv_backward_weight_pd->src_primitive_desc();
                                            ^~~~~~~~~~~~~~~~~~
                                            primitive_desc
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:385:23: error: unable to deduce ‘auto’ from ‘input_usr_memory’
   auto input_memory = input_usr_memory;
                       ^~~~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:386:56: error: ‘primitive_desc’ is not a member of ‘mkldnn::memory’
   if (input_usr_memory.get_primitive_desc() != memory::primitive_desc(input_pd)) {
                                                        ^~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:391:50: error: ‘using element_type = struct mkldnn::convolution_backward_weights::primitive_desc’ {aka ‘struct mkldnn::convolution_backward_weights::primitive_desc’} has no member named ‘diff_dst_primitive_desc’; did you mean ‘primitive_desc’?
   auto grad_output_pd = conv_backward_weight_pd->diff_dst_primitive_desc();
                                                  ^~~~~~~~~~~~~~~~~~~~~~~
                                                  primitive_desc
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:392:29: error: unable to deduce ‘auto’ from ‘grad_output_usr_memory’
   auto grad_output_memory = grad_output_usr_memory;
                             ^~~~~~~~~~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:393:62: error: ‘primitive_desc’ is not a member of ‘mkldnn::memory’
   if (grad_output_usr_memory.get_primitive_desc() != memory::primitive_desc(grad_output_pd)) {
                                                              ^~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:398:50: error: ‘using element_type = struct mkldnn::convolution_backward_weights::primitive_desc’ {aka ‘struct mkldnn::convolution_backward_weights::primitive_desc’} has no member named ‘diff_weights_primitive_desc’; did you mean ‘diff_weights_desc’?
   auto grad_weight_pd = conv_backward_weight_pd->diff_weights_primitive_desc();
                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                  diff_weights_desc
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:399:29: error: unable to deduce ‘auto’ from ‘grad_weight_usr_memory’
   auto grad_weight_memory = grad_weight_usr_memory;
                             ^~~~~~~~~~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:400:62: error: ‘primitive_desc’ is not a member of ‘mkldnn::memory’
   if (grad_weight_usr_memory.get_primitive_desc() != memory::primitive_desc(grad_weight_pd)) {
                                                              ^~~~~~~~~~~~~~
/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:407:27: error: no matching function for call to ‘mkldnn::memory::memory(<brace-enclosed initializer list>, void*)’
       grad_bias.data_ptr()));
                           ^
In file included from /opt/pytorch/aten/src/ATen/mkldnn/Runtime.h:3,
                 from /opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:37:
/usr/local/include/mkldnn.hpp:900:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&)’
     memory(const desc &md, const engine &aengine)
     ^~~~~~
/usr/local/include/mkldnn.hpp:900:5: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const mkldnn::memory::desc&’
/usr/local/include/mkldnn.hpp:889:5: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory::desc&, const mkldnn::engine&, void*)’
     memory(const desc &md, const engine &aengine, void *ahandle) {
     ^~~~~~
/usr/local/include/mkldnn.hpp:889:5: note:   candidate expects 3 arguments, 2 provided
/usr/local/include/mkldnn.hpp:577:8: note: candidate: ‘mkldnn::memory::memory(const mkldnn::memory&)’
 struct memory: public handle<mkldnn_memory_t> {
        ^~~~~~
/usr/local/include/mkldnn.hpp:577:8: note:   candidate expects 1 argument, 2 provided
[0m[91m/opt/pytorch/aten/src/ATen/native/mkldnn/Conv.cpp:421:35: error: ‘struct mkldnn::stream’ has no member named ‘submit’
   Stream::Instance().get_stream().submit(net);
                                   ^~~~~~
[0m[ 64%] Building CXX object caffe2/CMakeFiles/caffe2.dir/__/aten/src/ATen/CPUFloatType.cpp.o
caffe2/CMakeFiles/caffe2.dir/build.make:2841: recipe for target 'caffe2/CMakeFiles/caffe2.dir/__/aten/src/ATen/native/mkldnn/Conv.cpp.o' failed
[91mmake[2]: *** [caffe2/CMakeFiles/caffe2.dir/__/aten/src/ATen/native/mkldnn/Conv.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[0m[91mmake[1]: *** [caffe2/CMakeFiles/caffe2.dir/all] Error 2
[0mCMakeFiles/Makefile2:2107: recipe for target 'caffe2/CMakeFiles/caffe2.dir/all' failed
Makefile:138: recipe for target 'all' failed
[91mmake: *** [all] Error 2
[0mBuilding wheel torch-1.1.0a0+742568e
-- Building version 1.1.0a0+742568e
```

## Build command
```bash 
cd /opt && git clone --recursive https://github.com/pytorch/pytorch && \
    cd /opt/pytorch && \
    git submodule update --init && \
    cd /opt/pytorch && ls && \
    sed -i 's/"Use MKLDNN" OFF/"Use MKLDNN" ON/g' CMakeLists.txt && \
    sed -i 's/"Use DISTRIBUTED" OFF/"Use DISTRIBUTED" ON /g' CMakeLists.txt && \
    sed -i 's/for parallel code" OFF/for parallel code" ON /g' CMakeLists.txt && \
    PYTHON_EXECUTABLE=/opt/conda/bin/python \
    PYTHON_LIBRARY=/opt/conda/lib/libpython3.6m.so \
    PYTHON_INCLUDE_DIR=/opt/conda/include/python3.6m \
    FULL_CAFFE2=1 \
    USE_OPENMP=1 \
    USE_MKL=1 \
    USE_MKLDNN=1 \
    USE_MKLML=1 \
    USE_SYSTEM_EIGEN_INSTALL=1 \
    USE_ZMQ=1 \
    USE_DISTRIBUTED=1 \
    BUILD_TEST=0 \
    MKLDNN_LIBRARY=/usr/local/lib \
    MKLDNN_INCLUDE_DIR=/usr/local/include \
    MKLDNN_LIB_DIR=/usr/local/lib \
    python setup.py install 
```

## Environment

 - PyTorch Version (e.g., 1.0): Master branch
 - OS (e.g., Linux): Debian:Stretch
 - How you installed PyTorch (`conda`, `pip`, source): source
 - Build command you used (if compiling from source): see above
 - Python version: 3.6.5
 - CUDA/cuDNN version: NA
 - GPU models and configuration: NA
 - Any other relevant information: NA