Skip to content

Commit

Permalink
addhasSrcNspcLayout and hasDstNspcLayout vars
Browse files Browse the repository at this point in the history
  • Loading branch information
alvoron committed Jun 11, 2024
1 parent c6cdbb5 commit 778e6dc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/plugins/intel_cpu/src/nodes/executors/acl/acl_reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ bool AclReduceExecutor::init(const ReduceAttrs& reduceAttrs,

const auto& srcDims = srcDescs[0]->getShape().getStaticDims();
const auto& dstDims = dstDescs[0]->getShape().getStaticDims();
bool hasSrcNspcLayout = srcDescs[0]->hasLayoutType(LayoutType::nspc);
bool hasDstNspcLayout = dstDescs[0]->hasLayoutType(LayoutType::nspc);
auto srcShape = shapeCast(srcDims);
auto dstShape = shapeCast(dstDims);
if (srcDescs[0]->hasLayoutType(LayoutType::nspc) && dstDescs[0]->hasLayoutType(LayoutType::nspc)) {
if (hasSrcNspcLayout && hasDstNspcLayout) {
changeLayoutToNH_C({&srcShape, &dstShape});
}

Expand All @@ -55,8 +57,8 @@ bool AclReduceExecutor::init(const ReduceAttrs& reduceAttrs,
std::function<std::unique_ptr<IFunction>(void)> exec_func;
std::vector<int> castedAxes;
for (size_t i = 0; i < reduceAttrs.axes.size(); ++i) {
int axis = axisCast(reduceAttrs.axes[i], srcDims.size(), srcDescs[0]->hasLayoutType(LayoutType::nspc) ? NHWC_TO_NCHW : NO_LAYOUT_CONVERSION);
if (srcDescs[0]->hasLayoutType(LayoutType::nspc) && axis == -1) return false;
int axis = axisCast(reduceAttrs.axes[i], srcDims.size(), hasSrcNspcLayout ? NHWC_TO_NCHW : NO_LAYOUT_CONVERSION);
if (hasSrcNspcLayout && axis == -1) return false;
castedAxes.push_back(axis);
}
switch (reduceAttrs.operation) {
Expand Down

0 comments on commit 778e6dc

Please sign in to comment.