Skip to content

Commit

Permalink
[CPU][ARM] Fix indices in ACL Interpolate executor (openvinotoolkit#2…
Browse files Browse the repository at this point in the history
…5931)

### Details:
- Because of incorrect height and weight indices `is_upsample` variable
is initialised incorrectly and NHWC is not selected, that leads to
additional reorders in `octave-resnext`.

### Tickets:
 - *ticket-id*
  • Loading branch information
alvoron authored Aug 7, 2024
1 parent 6dce275 commit 96d900b
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@
#include "acl_utils.hpp"
#include "utils/debug_capabilities.h"

static bool getIndices(const ov::intel_cpu::MemoryDescPtr &desc, int& index_h, int& index_w) {
if (desc->hasLayoutType(ov::intel_cpu::LayoutType::ncsp)) {
index_h = 2;
index_w = 3;
return true;
} else if (desc->hasLayoutType(ov::intel_cpu::LayoutType::nspc)) {
index_h = 1;
index_w = 2;
return true;
} else { return false; }
}

bool ov::intel_cpu::ACLInterpolateExecutor::init(const InterpolateAttrs &interpolateAttrs,
const std::vector <MemoryDescPtr> &srcDescs,
const std::vector <MemoryDescPtr> &dstDescs,
Expand All @@ -27,12 +15,8 @@ bool ov::intel_cpu::ACLInterpolateExecutor::init(const InterpolateAttrs &interpo
acl_coord = arm_compute::SamplingPolicy::TOP_LEFT;
auto& out_shape = dstDescs[0]->getShape().getDims();

int index_h, index_w;
if (!getIndices(dstDescs[0], index_h, index_w)) {
DEBUG_LOG("ACL Interpolate unsupported layout: ", dstDescs[0]->serializeFormat());
return false;
}

static const size_t index_h = 2;
static const size_t index_w = 3;
if ((aclInterpolateAttrs.coordTransMode == InterpolateCoordTransMode::pytorch_half_pixel && out_shape[index_h] > 1 && out_shape[index_w] > 1) ||
aclInterpolateAttrs.coordTransMode == InterpolateCoordTransMode::half_pixel) {
acl_coord = arm_compute::SamplingPolicy::CENTER;
Expand Down Expand Up @@ -115,9 +99,8 @@ bool ov::intel_cpu::ACLInterpolateExecutorBuilder::isSupportedConfiguration(
auto& inp_shape = srcDescs[0]->getShape().getDims();
auto& out_shape = dstDescs[0]->getShape().getDims();

int index_h, index_w;
if (!getIndices(srcDescs[0], index_h, index_w)) { return false; }

static const size_t index_h = 2;
static const size_t index_w = 3;
float scale_h = static_cast<float>(out_shape[index_h]) / inp_shape[index_h];
float scale_w = static_cast<float>(out_shape[index_w]) / inp_shape[index_w];
bool is_upsample = scale_h > 1 && scale_w > 1;
Expand Down

0 comments on commit 96d900b

Please sign in to comment.