Fix Shape Constraints of depthwise_conv2d_explicit for quant8 (#2326)
author남궁석/동작제어Lab(SR)/Engineer/삼성전자 <sk.namkoong@samsung.com>
Mon, 20 Aug 2018 03:05:57 +0000 (12:05 +0900)
committer이춘석/동작제어Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Mon, 20 Aug 2018 03:05:57 +0000 (12:05 +0900)
Shape constraints of depthwise_conv2d_explicit was not correct
This commit will apply correct constraints for quant8 and enable below tests

`GeneratedTests.depthwise_conv2d_quant8_large`
`GeneratedTests.depthwise_conv2d_quant8_large_weights_as_inputs`
`GeneratedTests.depthwise_conv2d_quant8`
`GeneratedTests.depthwise_conv2d_quant8_weights_as_inputs`

Signed-off-by: Seok NamKoong <sk.namkoong@samsung.com>
runtimes/pure_arm_compute/src/compilation.cc

index d75cd99..d2be05f 100644 (file)
@@ -1136,11 +1136,19 @@ void Planner::visit(const ::internal::tflite::op::DepthwiseConv2D::Explicit::Nod
 
   // TODO Should move to the place where the operand is handled, if it is possible.
   // Set Shape Constraints and TensorInfo
-  _builder.addShapeConstr(ofm_index, asTensorInfo(ofm_shape, _ctx.at(ofm_index).type()));
-  _builder.addShapeConstr(ifm_index, asTensorInfo(ifm_shape, _ctx.at(ifm_index).type()));
+  _builder.addShapeConstr(ofm_index,
+                          asTensorInfo(ofm_shape, _ctx.at(ofm_index).type(),
+                                       _ctx.at(ofm_index).scale(), _ctx.at(ofm_index).zeroPoint()));
+  _builder.addShapeConstr(ifm_index,
+                          asTensorInfo(ifm_shape, _ctx.at(ifm_index).type(),
+                                       _ctx.at(ifm_index).scale(), _ctx.at(ifm_index).zeroPoint()));
   // NOTE DepthwiseConv2D kernel is of shape [1, KER_W, KER_H, IFM_C * MULTIPLIER]
-  _builder.addShapeConstr(ker_index, asTensorInfo(ker_shape, _ctx.at(ker_index).type()));
-  _builder.addShapeConstr(bias_index, asTensorInfo(bias_size, _ctx.at(bias_index).type()));
+  _builder.addShapeConstr(ker_index,
+                          asTensorInfo(ker_shape, _ctx.at(ker_index).type(),
+                                       _ctx.at(ker_index).scale(), _ctx.at(ker_index).zeroPoint()));
+  _builder.addShapeConstr(bias_index, asTensorInfo(bias_size, _ctx.at(bias_index).type(),
+                                                   _ctx.at(bias_index).scale(),
+                                                   _ctx.at(bias_index).zeroPoint()));
 
   // Construct operation parameters
   struct Param