diff options
author | Tim Hall <tim.hall@arm.com> | 2020-05-08 09:50:21 +0100 |
---|---|---|
committer | Tim Hall <tim.hall@arm.com> | 2020-06-18 17:53:52 +0100 |
commit | e4e58e15d9916fdcef33f5c43c2f60ef124da6a6 (patch) | |
tree | 79243fa802da73cec830256e7b615af49398d0ca /ethosu/vela/tflite_reader.py | |
parent | 9033795e399d29871bf95fc7f37959b498c46041 (diff) | |
download | ethos-u-vela-e4e58e15d9916fdcef33f5c43c2f60ef124da6a6.tar.gz |
Add float32 support for unsupported operators
- Removed the assert on datatype not being uint8/int8/int16
- Allow unquantised inputs
- This will break for float32 versions of supported operators
Change-Id: Id579b7adf61645b7578ee59bc2003c49108aedd5
Signed-off-by: Tim Hall <tim.hall@arm.com>
Diffstat (limited to 'ethosu/vela/tflite_reader.py')
-rw-r--r-- | ethosu/vela/tflite_reader.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ethosu/vela/tflite_reader.py b/ethosu/vela/tflite_reader.py index 3632f821..4f9bd7d0 100644 --- a/ethosu/vela/tflite_reader.py +++ b/ethosu/vela/tflite_reader.py @@ -108,10 +108,11 @@ class TFLiteSubgraph: return arr tens.quantization = QuantizationParameters() - tens.quantization.min = len1_array_to_scalar(quant.MinAsNumpy()) - tens.quantization.max = len1_array_to_scalar(quant.MaxAsNumpy()) - tens.quantization.scale_f32 = len1_array_to_scalar(quant.ScaleAsNumpy()) - tens.quantization.zero_point = len1_array_to_scalar(quant.ZeroPointAsNumpy()) + if quant is not None: + tens.quantization.min = len1_array_to_scalar(quant.MinAsNumpy()) + tens.quantization.max = len1_array_to_scalar(quant.MaxAsNumpy()) + tens.quantization.scale_f32 = len1_array_to_scalar(quant.ScaleAsNumpy()) + tens.quantization.zero_point = len1_array_to_scalar(quant.ZeroPointAsNumpy()) if dtype == DataType.uint8: tens.quantization.quant_min = 0 @@ -119,8 +120,6 @@ class TFLiteSubgraph: elif dtype in set((DataType.int8, DataType.int16, DataType.int32, DataType.int64)): tens.quantization.quant_min = -(1 << (dtype.bits - 1)) tens.quantization.quant_max = (1 << (dtype.bits - 1)) - 1 - else: - raise Exception("DataType '" + str(dtype) + "' is not supported for quantization.") if tens.quantization.scale_f32 is None and tens.quantization.zero_point is None: tens.quantization = None |