Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[CPU][ARM] Fix indices in ACL Interpolate executor (#25931)

Aleksandr Voron96d900b0894d
diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.cpp
index 0e05f6193d2..5c74293d04d 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_interpolate.cpp
@@ -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,
@@ -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;
@@ -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;