From 52f2ac89d5a8199136e9987ceb48093246f5da74 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Thu, 25 Jan 2024 15:19:10 +0100 Subject: [PATCH] fix optional output shape --- src/plugins/intel_cpu/src/nodes/deconv.cpp | 8 ++++++ .../src/nodes/executors/acl/acl_deconv.cpp | 28 ++++++++++++------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/plugins/intel_cpu/src/nodes/deconv.cpp b/src/plugins/intel_cpu/src/nodes/deconv.cpp index 7e5d206e3d5036..581cc3e3691a5f 100644 --- a/src/plugins/intel_cpu/src/nodes/deconv.cpp +++ b/src/plugins/intel_cpu/src/nodes/deconv.cpp @@ -875,6 +875,14 @@ void Deconvolution::prepareParams() { OPENVINO_THROW("Preferable primitive descriptor is not set for node ", getName(), "."); if (useACL) { + if (isDynamicNode()) { + if (autoPad || externOutShape) { + deconvAttrs.paddingL = shapeInference->get_pads_begin(); + deconvAttrs.paddingR = shapeInference->get_pads_end(); + } + initPaddingR(getParentEdgesAtPort(0).front()->getMemory().getDescPtr()->getShape(), + getChildEdgesAtPort(0).front()->getMemory().getDescPtr()->getShape()); + } std::vector srcMemoryDescs; for (size_t i = 0; i < getOriginalInputsNumber(); i++) { srcMemoryDescs.push_back(getParentEdgesAtPort(i).front()->getMemory().getDescPtr()); diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp index 28aa38f0da7ccd..cdd23f6915b884 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp @@ -13,6 +13,24 @@ using namespace arm_compute; ACLDeconvTensorInfo getACLDeconvTensorInfo(const DeconvAttrs& deconvAttrs, const std::vector& srcDescs, const std::vector& dstDescs) { + int pad_l; + if (deconvAttrs.paddingL.size() > 1) { + pad_l = deconvAttrs.paddingL.at(1); + } else { + pad_l = deconvAttrs.paddingL.at(0); + } + int pad_r; + if (deconvAttrs.paddingR.size() > 1) { + pad_r = deconvAttrs.paddingR.at(1); + } else { + pad_r = deconvAttrs.paddingR.at(0); + } + auto pad_t = deconvAttrs.paddingL.at(0); + auto pad_b = deconvAttrs.paddingR.at(0); + unsigned int stride_x = (deconvAttrs.stride.size() > 1) ? deconvAttrs.stride.at(1) : deconvAttrs.stride.at(0); + unsigned int stride_y = deconvAttrs.stride.at(0); + PadStrideInfo deconv_info(stride_x, stride_y, pad_l, pad_r, pad_t, pad_b, DimensionRoundingType::FLOOR); + auto srcDims = srcDescs[0]->getShape().getDims(); auto weiDims = srcDescs[1]->getShape().getDims(); std::swap(weiDims[0], weiDims[1]); @@ -60,16 +78,6 @@ ACLDeconvTensorInfo getACLDeconvTensorInfo(const DeconvAttrs& deconvAttrs, precisionToAclDataType(srcDescs[2]->getPrecision()), getAclDataLayoutByMemoryDesc(srcDescs[2])); } - unsigned int pad_l = - (deconvAttrs.paddingL.size() > 1) ? static_cast(deconvAttrs.paddingL.at(1)) : static_cast(deconvAttrs.paddingL.at(0)); - unsigned int pad_r = - (deconvAttrs.paddingR.size() > 1) ? static_cast(deconvAttrs.paddingR.at(1)) : static_cast(deconvAttrs.paddingR.at(0)); - auto pad_t = static_cast(deconvAttrs.paddingL.at(0)); - auto pad_b = static_cast(deconvAttrs.paddingR.at(0)); - unsigned int stride_x = (deconvAttrs.stride.size() > 1) ? deconvAttrs.stride.at(1) : deconvAttrs.stride.at(0); - unsigned int stride_y = deconvAttrs.stride.at(0); - PadStrideInfo deconv_info(stride_x, stride_y, pad_l, pad_r, pad_t, pad_b, DimensionRoundingType::FLOOR); - return ACLDeconvTensorInfo{srcTensorInfo, weiTensorInfo, biasTensorInfo, dstTensorInfo, deconv_info}; }