diff --git a/mace/python/tools/converter_tool/hexagon_converter.py b/mace/python/tools/converter_tool/hexagon_converter.py index 0c51b0ddbaf4854b728823d86c97e0b691275481..c30676c18c1a2f8b713ace2d93ceb27472473747 100644 --- a/mace/python/tools/converter_tool/hexagon_converter.py +++ b/mace/python/tools/converter_tool/hexagon_converter.py @@ -44,6 +44,7 @@ HexagonSupportedOps = [ 'QuantizedAvgPool_8', 'QuantizedConcat_8', 'QuantizedMaxPool_8', + 'QuantizedMul_8x8to8', 'QuantizedResizeBilinear_8', 'QuantizedSoftmax_8', 'QuantizedSub_8p8to8', @@ -69,7 +70,8 @@ class HexagonOps(object): HexagonOp.DepthwiseSupernode_8x8p32to8.name, MaceOp.Dequantize.name: HexagonOp.DequantizeOUTPUT_8tof.name, MaceOp.Eltwise.name: [HexagonOp.QuantizedAdd_8p8to8.name, - HexagonOp.QuantizedSub_8p8to8.name], + HexagonOp.QuantizedSub_8p8to8.name, + HexagonOp.QuantizedMul_8x8to8.name], MaceOp.Identity.name: HexagonOp.Nop.name, MaceOp.Quantize.name: HexagonOp.QuantizeINPUT_f_to_8.name, MaceOp.Pooling.name: [HexagonOp.QuantizedAvgPool_8.name, @@ -189,8 +191,13 @@ class HexagonConverter(base_converter.ConverterInterface): elif op.type == MaceOp.Eltwise.name: self.add_min_max_const_node(op, op.input[0]) self.add_min_max_const_node(op, op.input[1]) - self.add_min_max_const_node( - op, op.output[0], True, True, False) + element_type = \ + ConverterUtil.get_arg(op, + MaceKeyword.mace_element_type_str).i + if element_type == EltwiseType.SUM.value \ + or element_type == EltwiseType.SUB.value: + self.add_min_max_const_node( + op, op.output[0], True, True, False) elif op.type == MaceOp.BatchToSpaceND.name \ or op.type == MaceOp.SpaceToBatchND.name: strides_arg = ConverterUtil.get_arg( @@ -340,9 +347,11 @@ class HexagonConverter(base_converter.ConverterInterface): op.type = HexagonOp.QuantizedAdd_8p8to8.name elif element_type == EltwiseType.SUB.value: op.type = HexagonOp.QuantizedSub_8p8to8.name + elif element_type == EltwiseType.PROD.value: + op.type = HexagonOp.QuantizedMul_8x8to8.name else: mace_check(False, - "Hexagon does not support eltmentwise %s" + "Hexagon does not support elementwise %s" % EltwiseType(element_type).name) elif op.type == MaceOp.Pooling.name: pooling_type_arg = ConverterUtil.get_arg( diff --git a/mace/python/tools/converter_tool/transformer.py b/mace/python/tools/converter_tool/transformer.py index 41f32c6da0cf5a86323a54d08a46658cc1b8ef0f..7eb21610e12fd48a8ff7594aab31ee0c7f0cb789 100644 --- a/mace/python/tools/converter_tool/transformer.py +++ b/mace/python/tools/converter_tool/transformer.py @@ -1911,7 +1911,7 @@ class Transformer(base_converter.ConverterInterface): - producer_op1.quantize_info[0].minval else: mace_check(False, "Quantized Elementwise only support:" - " SUM and SUB now.") + " SUM and SUB without ranges now.") quantize_info = \ self.add_quantize_info(op, minval, maxval) self._quantize_activation_info[op.output[0]] = quantize_info diff --git a/third_party/nnlib/v60/libhexagon_nn_skel.so b/third_party/nnlib/v60/libhexagon_nn_skel.so index 7709b525067891cc966f1fcf00b39b79f8e23c0e..80c880a2dadd6b3c41045ad1c668432e385aeede 100755 Binary files a/third_party/nnlib/v60/libhexagon_nn_skel.so and b/third_party/nnlib/v60/libhexagon_nn_skel.so differ diff --git a/third_party/nnlib/v66/libhexagon_nn_skel.so b/third_party/nnlib/v66/libhexagon_nn_skel.so index fb952bc7901372e4edf818485d5bd397f342cd6f..1b44ef97a20c4828af6e71e0a3d31b469cc6dcb1 100755 Binary files a/third_party/nnlib/v66/libhexagon_nn_skel.so and b/third_party/nnlib/v66/libhexagon_nn_skel.so differ