Skip to content

Commit

Permalink
fix optional output shape
Browse files Browse the repository at this point in the history
  • Loading branch information
allnes committed Jan 25, 2024
1 parent 828bd6c commit 52f2ac8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
8 changes: 8 additions & 0 deletions src/plugins/intel_cpu/src/nodes/deconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<MemoryDescPtr> srcMemoryDescs;
for (size_t i = 0; i < getOriginalInputsNumber(); i++) {
srcMemoryDescs.push_back(getParentEdgesAtPort(i).front()->getMemory().getDescPtr());
Expand Down
28 changes: 18 additions & 10 deletions src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ using namespace arm_compute;
ACLDeconvTensorInfo getACLDeconvTensorInfo(const DeconvAttrs& deconvAttrs,
const std::vector<MemoryDescPtr>& srcDescs,
const std::vector<MemoryDescPtr>& 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]);
Expand Down Expand Up @@ -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<unsigned int>(deconvAttrs.paddingL.at(1)) : static_cast<unsigned int>(deconvAttrs.paddingL.at(0));
unsigned int pad_r =
(deconvAttrs.paddingR.size() > 1) ? static_cast<unsigned int>(deconvAttrs.paddingR.at(1)) : static_cast<unsigned int>(deconvAttrs.paddingR.at(0));
auto pad_t = static_cast<unsigned int>(deconvAttrs.paddingL.at(0));
auto pad_b = static_cast<unsigned int>(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};
}

Expand Down

0 comments on commit 52f2ac8

Please sign in to comment.