Skip to content

Commit 3fc3293

Browse files
committed
Finish merge
1 parent 9a04967 commit 3fc3293

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

utensor_cgen/frontend/tflite.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,18 @@ def _build_tensor_map(self, fb_model, ugraph):
8686
dtype = self._TENSOR_NP_TYPE[tensor.Type()]
8787
attributes = dict()
8888
quant_params = tensor.Quantization()
89-
if quant_params is not None and quant_params.ZeroPointAsNumpy() and quant_params.ScaleAsNumpy():
90-
zp = quant_params.ZeroPointAsNumpy()
91-
if zp.dtype == np.dtype('<i8'):
92-
zp = zp.astype('int8')
93-
else:
94-
zp = zp.astype('uint8')
95-
attributes["quantization_zeros"] = zp
89+
# if quant_params is not None and quant_params.ZeroPointAsNumpy() and quant_params.ScaleAsNumpy():
90+
# zp = quant_params.ZeroPointAsNumpy()
91+
# if zp.dtype == np.dtype('<i8'):
92+
# zp = zp.astype('int8')
93+
# else:
94+
# zp = zp.astype('uint8')
95+
# attributes["quantization_zeros"] = zp
96+
# attributes["quantization_scales"] = quant_params.ScaleAsNumpy()
97+
if quant_params is not None and \
98+
quant_params.ZeroPointLength() and \
99+
quant_params.ScaleLength():
100+
attributes["quantization_zeros"] = quant_params.ZeroPointAsNumpy()
96101
attributes["quantization_scales"] = quant_params.ScaleAsNumpy()
97102

98103
if isinstance(tensor.ShapeAsNumpy(), np.ndarray):
@@ -472,7 +477,7 @@ def default_op_data(op, fb_mdel):
472477
#_OP_DATA_FUNC_MAP["ADD"] = None
473478
#_OP_DATA_FUNC_MAP["AVERAGE_POOL_2D"] = None
474479
#_OP_DATA_FUNC_MAP["CONCATENATION"] = None
475-
_OP_DATA_FUNC_MAP["CONV_2D"] = conv2d_op_data
480+
_OP_DATA_FUNC_MAP["CONV_2D"] = conv_2d_op_data
476481
_OP_DATA_FUNC_MAP["DEPTHWISE_CONV_2D"] = depthwise_conv2d_op_data
477482
_OP_DATA_FUNC_MAP["DEQUANTIZE"] = dequantize_op_data
478483
#_OP_DATA_FUNC_MAP["EMBEDDING_LOOKUP"] = None

0 commit comments

Comments
 (0)