aboutsummaryrefslogtreecommitdiff
path: root/ethosu
diff options
context:
space:
mode:
authorRickard Bolin <rickard.bolin@arm.com>2022-09-23 10:16:48 +0000
committerRickard Bolin <rickard.bolin@arm.com>2022-09-23 11:45:33 +0000
commit017b4ccf9575a0f8ce604e2478fb09febbaa2875 (patch)
tree18931eca2e78a9a34af6d76eba59cc7c090f8edb /ethosu
parentfea1516f94cfcbd801124e3fdc4b5f5c4526e15b (diff)
downloadethos-u-vela-017b4ccf9575a0f8ce604e2478fb09febbaa2875.tar.gz
MLBEDSW-6928: Add int16 support for Resize Bilinear HPC
Setting bias tensor dtype to DataType.int32 solves rounding issues for RB HPC int16. Removing the input data type check also solves the issue of resize nearest neighbor int16 ops incorrectly getting placed on the CPU. Signed-off-by: Rickard Bolin <rickard.bolin@arm.com> Change-Id: Iee352bcb78e581c0cde3c203dfbe866f1f6fae18
Diffstat (limited to 'ethosu')
-rw-r--r--ethosu/vela/tflite_graph_optimiser.py2
-rw-r--r--ethosu/vela/tflite_supported_operators.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/ethosu/vela/tflite_graph_optimiser.py b/ethosu/vela/tflite_graph_optimiser.py
index 27513d3d..1310ee63 100644
--- a/ethosu/vela/tflite_graph_optimiser.py
+++ b/ethosu/vela/tflite_graph_optimiser.py
@@ -586,7 +586,7 @@ def convert_resizebilinear_to_depthwise_convolutions(op, half_pixel_centers=True
# need to append the bias tensor as resize ops only have 2 inputs
assert len(dw_conv.inputs) == 2
dw_conv.inputs.append(None)
- fixup_bias_tensors(dw_conv, None, None)
+ fixup_bias_tensors(dw_conv, None, None, dtype=DataType.int32)
dw_conv.set_ifm_ofm_shapes()
dw_conv = dw_conv.clone(f"_{index}")
diff --git a/ethosu/vela/tflite_supported_operators.py b/ethosu/vela/tflite_supported_operators.py
index 9aa174de..8b448dfe 100644
--- a/ethosu/vela/tflite_supported_operators.py
+++ b/ethosu/vela/tflite_supported_operators.py
@@ -666,12 +666,12 @@ class TFLiteSupportedOperators:
@staticmethod
def constraint_resize_half_pixel_centers(op):
- """Half_pixel_centers are only supported for resize bilinear with IFM dtype int8 or uint8"""
- valid = op.ifm.dtype in (DataType.int8, DataType.uint8)
+ """Half_pixel_centers are only supported for resize bilinear"""
+ valid = True
half_pixel_centers = op.attrs.get("half_pixel_centers", False)
if half_pixel_centers and op.type != Op.ResizeBilinear:
valid = False
- return valid, f"Op type={op.type}, ifm dtype={op.ifm.dtype} and half_pixel_centers={half_pixel_centers}"
+ return valid, f"Op type={op.type} and half_pixel_centers={half_pixel_centers}"
@staticmethod
def constraint_resizebi_half_pixel_centers_dims(op):