Change input arguments of SquaredDifference operator (#2903)
authorPrasanna R/System SW /SRI-Bangalore/Engineer/삼성전자 <prasanna.r@samsung.com>
Fri, 5 Oct 2018 04:10:32 +0000 (09:40 +0530)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Fri, 5 Oct 2018 04:10:32 +0000 (13:10 +0900)
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 <prasanna.r@samsung.com>
runtimes/pure_arm_compute/src/compilation.cc
runtimes/pure_arm_compute/src/internal/op/SquaredDifference.cc
runtimes/pure_arm_compute/src/internal/op/SquaredDifference.h

index 7b37fc8..27c7102 100644 (file)
@@ -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<FuseCode>(_ctx.at(activation_index).asScalar<int32_t>());
-
   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);
index 13f97a5..1fbe60a 100644 (file)
@@ -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
index fb852e7..e9ba66f 100644 (file)
@@ -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);