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>
diff --git a/ethosu/vela/tflite_reader.py b/ethosu/vela/tflite_reader.py
index 3632f82..4f9bd7d 100644
--- a/ethosu/vela/tflite_reader.py
+++ b/ethosu/vela/tflite_reader.py
@@ -108,10 +108,11 @@
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 @@
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