aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2020-05-08 09:50:21 +0100
committerTim Hall <tim.hall@arm.com>2020-06-18 17:53:52 +0100
commite4e58e15d9916fdcef33f5c43c2f60ef124da6a6 (patch)
tree79243fa802da73cec830256e7b615af49398d0ca
parent9033795e399d29871bf95fc7f37959b498c46041 (diff)
downloadethos-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>
-rw-r--r--ethosu/vela/tflite_reader.py11
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