From 065487d5e154d350dcae9181313926196c5de815 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Prasanna=20R/System=20SW=20/SRI-Bangalore/Engineer/?= =?utf8?q?=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 5 Oct 2018 09:40:32 +0530 Subject: [PATCH] Change input arguments of SquaredDifference operator (#2903) While testing grocery model, below errors occured, ``` tflite_run: /home/jyoung/git/star/nnfw/runtimes/pure_arm_compute/src/internal/op/SquaredDifference.cc:33: internal::tflite::op::SquaredDifference::Param::Param(uint32_t, const uint32_t*, uint32_t, const uint32_t*): Assertion `inputCount == 3 && outputCount == 1' failed. ``` There is no need of an activation index as SquaredDifference op takes only two inputs X & Y. This patch makes those necessary changes. Signed-off-by: prasannar --- runtimes/pure_arm_compute/src/compilation.cc | 6 ------ runtimes/pure_arm_compute/src/internal/op/SquaredDifference.cc | 3 +-- runtimes/pure_arm_compute/src/internal/op/SquaredDifference.h | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/runtimes/pure_arm_compute/src/compilation.cc b/runtimes/pure_arm_compute/src/compilation.cc index 7b37fc8..27c7102 100644 --- a/runtimes/pure_arm_compute/src/compilation.cc +++ b/runtimes/pure_arm_compute/src/compilation.cc @@ -3377,7 +3377,6 @@ void Planner::visit(const ::internal::tflite::op::SquaredDifference::Node &node) const ::internal::tflite::operand::Index ofm_index{node.param().ofm_index}; const ::internal::tflite::operand::Index lhs_index{node.param().lhs_index}; const ::internal::tflite::operand::Index rhs_index{node.param().rhs_index}; - const ::internal::tflite::operand::Index activation_index{node.param().activation_index}; // Set Shape Constraints and TensorInfo _builder.addShapeConstr( @@ -3406,8 +3405,6 @@ void Planner::visit(const ::internal::tflite::op::SquaredDifference::Node &node) int ofm_index; int lhs_index; int rhs_index; - - FuseCode activation; }; Param param; @@ -3416,8 +3413,6 @@ void Planner::visit(const ::internal::tflite::op::SquaredDifference::Node &node) param.lhs_index = lhs_index.asInt(); param.rhs_index = rhs_index.asInt(); - param.activation = static_cast(_ctx.at(activation_index).asScalar()); - auto stage = [param](const IAllocationContext &ctx, IExecutionBuilder &builder) { auto ofm_alloc = ctx.at(::internal::tflite::operand::Index{param.ofm_index}); auto lhs_alloc = ctx.at(::internal::tflite::operand::Index{param.lhs_index}); @@ -3430,7 +3425,6 @@ void Planner::visit(const ::internal::tflite::op::SquaredDifference::Node &node) builder.append("SquaredDifference", std::move(fn)); - ActivationBuilder{builder}.append(param.activation, ofm_alloc); }; _builder.addStage(stage); diff --git a/runtimes/pure_arm_compute/src/internal/op/SquaredDifference.cc b/runtimes/pure_arm_compute/src/internal/op/SquaredDifference.cc index 13f97a5..1fbe60a 100644 --- a/runtimes/pure_arm_compute/src/internal/op/SquaredDifference.cc +++ b/runtimes/pure_arm_compute/src/internal/op/SquaredDifference.cc @@ -46,7 +46,7 @@ namespace SquaredDifference Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs) { - assert(inputCount == 3 && outputCount == 1); + assert(inputCount == 2 && outputCount == 1); ofm_index = outputs[0]; @@ -57,7 +57,6 @@ Param::Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, // 2 -> Activation Index lhs_index = inputs[0]; rhs_index = inputs[1]; - activation_index = inputs[2]; } } // namespace SquaredDifference diff --git a/runtimes/pure_arm_compute/src/internal/op/SquaredDifference.h b/runtimes/pure_arm_compute/src/internal/op/SquaredDifference.h index fb852e7..e9ba66f 100644 --- a/runtimes/pure_arm_compute/src/internal/op/SquaredDifference.h +++ b/runtimes/pure_arm_compute/src/internal/op/SquaredDifference.h @@ -36,7 +36,6 @@ struct Param int32_t lhs_index; int32_t rhs_index; - int32_t activation_index; Param() = default; Param(uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs); -- 2.7.4