From 7da61dd2b31e7d3288d4a4cd7bc9300589a9c058 Mon Sep 17 00:00:00 2001 From: Maksim Kutakov Date: Fri, 9 Jul 2021 14:51:58 +0300 Subject: [PATCH] Deconvolution getDstMemDesc fix --- .../src/mkldnn_plugin/cpu_blocked_memory_desc.cpp | 5 ++--- inference-engine/src/mkldnn_plugin/mkldnn_memory.cpp | 2 +- .../src/mkldnn_plugin/nodes/mkldnn_deconv_node.cpp | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/inference-engine/src/mkldnn_plugin/cpu_blocked_memory_desc.cpp b/inference-engine/src/mkldnn_plugin/cpu_blocked_memory_desc.cpp index 872664746d2f58..87b35189890184 100644 --- a/inference-engine/src/mkldnn_plugin/cpu_blocked_memory_desc.cpp +++ b/inference-engine/src/mkldnn_plugin/cpu_blocked_memory_desc.cpp @@ -100,12 +100,11 @@ bool BlockedMemoryDesc::isCompatible(const BlockedMemoryDesc& rhs) const { return false; } - if (this->getOrder() != rhs.getOrder()) { + if (!isEqualOrUndefined(this->getOrder(), rhs.getOrder())) { return false; } - return !(this->getOffsetPadding() != rhs.getOffsetPadding() && - this->getOffsetPadding() != Shape::UNDEFINED_DIM && rhs.getOffsetPadding() != Shape::UNDEFINED_DIM); + return dimsEqualWeak(this->getOffsetPadding(), rhs.getOffsetPadding()); } size_t BlockedMemoryDesc::getMemSizeImp() const { diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_memory.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_memory.cpp index 3b74bf51317864..3bba08015d2f60 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_memory.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_memory.cpp @@ -1094,7 +1094,7 @@ bool MKLDNNMemoryDesc::isCompatible(const BlockedMemoryDesc &rhs) const { size_t blk_offset0 = desc.data.offset0; - return !(blk_offset0 != rhs.getOffsetPadding() && blk_offset0 != Shape::UNDEFINED_DIM && rhs.getOffsetPadding() != Shape::UNDEFINED_DIM); + return dimsEqualWeak(blk_offset0, rhs.getOffsetPadding()); } bool MKLDNNMemoryDesc::checkGeneralLayout(GeneralLayout layoutType) const { diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_deconv_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_deconv_node.cpp index 0c7bb777302b95..0eaa4893896ad9 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_deconv_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_deconv_node.cpp @@ -418,9 +418,8 @@ std::unique_ptr MKLDNNDeconvolutionNode::getSrcMemDesc(mkldnn: } std::unique_ptr MKLDNNDeconvolutionNode::getDstMemDesc(mkldnn::primitive_desc_iterator &primitive_desc_it, size_t idx) { - MKLDNNMemoryDesc desc = isInt8 ? MKLDNNMemoryDesc(primitive_desc_it.dst_desc(idx)) - : MKLDNNMemoryDesc(primitive_desc_it.diff_src_desc(idx)); - return MKLDNNPlugin::make_unique(getChildEdgeAt(idx)->getShape().getStaticMklDims(), desc.getDataType(), desc.getFormat()); + return isInt8 ? MKLDNNPlugin::make_unique(primitive_desc_it.dst_desc(idx)) : + MKLDNNPlugin::make_unique(primitive_desc_it.diff_src_desc(idx)); } InferenceEngine::Precision MKLDNNDeconvolutionNode::getRuntimePrecision() const {