TaoLv commented on a change in pull request #13530: Integrate MKLDNN Conv1d and
support 3d layout
URL: https://github.com/apache/incubator-mxnet/pull/13530#discussion_r239698090
##########
File path: src/operator/nn/mkldnn/mkldnn_base.cc
##########
@@ -238,39 +238,44 @@ const mkldnn::memory *GetWeights(const NDArray &arr,
return mem;
mkldnn::memory::data_type type = get_mkldnn_type(arr.dtype());
+ mkldnn::memory::dims tz = mkldnn::memory::dims{0};
+ mkldnn::memory::format format = mkldnn::memory::format::format_undef;
auto engine = CpuEngine::Get()->get_engine();
if (arr.shape().ndim() == 2) {
- mkldnn::memory::dims tz = mkldnn::memory::dims{
+ tz = mkldnn::memory::dims{
static_cast<int>(arr.shape()[0]), static_cast<int>(arr.shape()[1])};
- mkldnn::memory::desc md =
- mkldnn::memory::desc{tz, type, mkldnn::memory::format::oi};
- mkldnn::memory::primitive_desc pd =
- mkldnn::memory::primitive_desc{md, engine};
- mem = arr.GetMKLDNNData(pd);
- } else if (arr.shape().ndim() == 4 && num_groups == 1) {
- mkldnn::memory::dims tz = mkldnn::memory::dims{
- static_cast<int>(arr.shape()[0]), static_cast<int>(arr.shape()[1]),
- static_cast<int>(arr.shape()[2]), static_cast<int>(arr.shape()[3])};
- mkldnn::memory::desc md =
- mkldnn::memory::desc{tz, type, mkldnn::memory::format::oihw};
- mkldnn::memory::primitive_desc pd =
- mkldnn::memory::primitive_desc{md, engine};
- mem = arr.GetMKLDNNData(pd);
+ format = mkldnn::memory::format::oi;
+ } else if (arr.shape().ndim() == 3) {
+ tz = num_groups > 1 ? mkldnn::memory::dims{ num_groups,
+ static_cast<int>(arr.shape()[0] / num_groups),
Review comment:
fix indents.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services