From e1766f851077dfb8b84a1481401d8c7ae591494d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9E=A5=EC=A7=80=EC=84=AD/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84?= =?utf8?q?=EC=9E=90?= Date: Mon, 9 Jul 2018 16:19:46 +0900 Subject: [PATCH] Enables other type of operands in CONV2D operation. (#1889) * Change the type of CONV2D's Bias from QASYMM8 to INT32 This commit changes CONV2D's bias type from QASYMM8 to INT32. According to the nnapi description, for input tensor of {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} type, the bias should be of {@link ANEURALNETWORKS_TENSOR_INT32}. Signed-off-by: jiseob.jang * Add QuantizationInfo to TensorInfo in CONV2D operation. This commit adds QuantizationInfo to TensorInfo in CONV2D operation. Signed-off-by: jiseob.jang --- runtimes/pure_arm_compute/src/compilation.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/runtimes/pure_arm_compute/src/compilation.cc b/runtimes/pure_arm_compute/src/compilation.cc index 8c0689b..bcfe543 100644 --- a/runtimes/pure_arm_compute/src/compilation.cc +++ b/runtimes/pure_arm_compute/src/compilation.cc @@ -761,10 +761,18 @@ void Planner::visit(const ::internal::tflite::op::Conv2D::implicit::Node &node) // 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(ker_index, asTensorInfo(ker_shape, _ctx.at(ker_index).type())); - _builder.addShapeConstr(bias_index, asTensorInfo(bias_size, _ctx.at(bias_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())); + _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())); // Set initializer for kernel { @@ -806,9 +814,9 @@ void Planner::visit(const ::internal::tflite::op::Conv2D::implicit::Node &node) _builder.addInitializer(bias_index, initializer); break; } - case ANEURALNETWORKS_TENSOR_QUANT8_ASYMM: + case ANEURALNETWORKS_TENSOR_INT32: { - auto initializer = std::bind(initVectorTensor, _1, bias_base, bias_size); + auto initializer = std::bind(initVectorTensor, _1, bias_base, bias_size); _builder.addInitializer(bias_index, initializer); break; } -- 2.7.4