eric-haibin-lin commented on a change in pull request #7931: MKL-DNN 
integration: request for reviews
URL: https://github.com/apache/incubator-mxnet/pull/7931#discussion_r143025769
 
 

 ##########
 File path: src/operator/mkl/mkldnn_memory.cc
 ##########
 @@ -0,0 +1,285 @@
+/*******************************************************************************
+* Copyright 2016-2017 Intel Corporation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* \file mkldnn_memory.cc
+* \brief
+* \author young.jin....@intel.com
+*         ashok.em...@intel.com
+*         deepthi.kark...@intel.com
+*         louis.f...@intel.com
+*         adam.d.st...@intel.com
+*
+*******************************************************************************/
+
+
+#include <mxnet/base.h>
+#if MXNET_USE_MKLDNN == 1
+#include <mkl_memory.h>
+#include "mkldnn_memory-inl.h"
+
+namespace mxnet {
+
+template <typename Dtype>
+MKLDNNMemoryDescriptorBase<Dtype>::MKLDNNMemoryDescriptorBase(
+        std::shared_ptr<memory::primitive_desc> usr_memory_pd
+        , std::shared_ptr<memory::primitive_desc> prv_memory_pd)
+                                    : name("MKLDNNMemoryDescriptorBase"),
+                                    _prv_memory(NULL), _internal_ptr(NULL), 
_internal_size(0),
+                                    _usr_memory(NULL), _dbg_cpu_ptr(NULL) {
+    _usr_memory_pd_not_null = false;
+    _prv_memory_pd_not_null = false;
+    set_usr_memory_pd(usr_memory_pd);
+    set_prv_memory_pd(prv_memory_pd);
+}
+
+template <typename Dtype>
+void MKLDNNMemoryDescriptorBase<Dtype>::check_usr_with_prv_descriptors() {
+    CHECK(_usr_memory_pd);
+    CHECK(_prv_memory_pd);
+    int32_t ndims = _usr_memory_pd->desc().data.ndims;
+    CHECK_EQ(ndims, _prv_memory_pd->desc().data.ndims)
+            << "MKLDNNMemoryDescriptorBase: Usr and Prv memory must have same 
dimensions number";
+    for (int32_t dim = 0; dim < ndims; ++dim) {
+        CHECK_EQ(_usr_memory_pd->desc().data.dims[dim]
+                , _prv_memory_pd->desc().data.dims[dim])
+                << "MKLDNNMemoryDescriptorBase: Usr and Prv memory must have 
same dimensions";
+    }
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 Review comment:
   Does this pass lint?
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to