From: 장지섭/동작제어Lab(SR)/Engineer/삼성전자 Date: Mon, 9 Jul 2018 07:19:46 +0000 (+0900) Subject: Enables other type of operands in CONV2D operation. (#1889) X-Git-Tag: 0.2~486 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1766f851077dfb8b84a1481401d8c7ae591494d;p=platform%2Fcore%2Fml%2Fnnfw.git 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 --- 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; }