aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Alfvén <johan.alfven@arm.com>2022-10-17 12:29:12 +0200
committerJohan Alfvén <johan.alfven@arm.com>2022-10-18 08:42:36 +0200
commita64616c4d7a33c5b2b4e5fb38c57217dc65bc2ea (patch)
tree6b591bbbe0bb0b1527c0d1119fe9d5adde72b6f9
parentb81e1bb92be8ea5b29625cf2f361e9160286b16a (diff)
downloadethos-u-vela-a64616c4d7a33c5b2b4e5fb38c57217dc65bc2ea.tar.gz
MLBEDSW-6794: ResizeNearestNeighbor with HPC
- Removed half pixel centers constraint for resize nearest neightbor. - Supported scale 2x, 4x and 8x. - Removed test_constraint_resize_half_pixel_centers - Regenerated SUPPORTED_OPS.md Signed-off-by: Johan Alfven <johan.alfven@arm.com> Change-Id: Ic3e02e9c2b2034d537c9a9841b8fb4ee433c96dc
-rw-r--r--SUPPORTED_OPS.md5
-rw-r--r--ethosu/vela/test/test_tflite_supported_operators.py12
-rw-r--r--ethosu/vela/tflite_graph_optimiser.py4
-rw-r--r--ethosu/vela/tflite_supported_operators.py10
4 files changed, 4 insertions, 27 deletions
diff --git a/SUPPORTED_OPS.md b/SUPPORTED_OPS.md
index 9488a78b..bf7c2ba6 100644
--- a/SUPPORTED_OPS.md
+++ b/SUPPORTED_OPS.md
@@ -1,7 +1,7 @@
# Supported Ops
This file was automatically generated by Vela using the `--supported-ops-report` parameter.
-Vela version: `3.5.1.dev10+gf616c9d6.d20220915`
+Vela version: `3.6.0rc1.dev23+g1f2496e.d20221017`
This file complies with
[**Gitiles Markdown syntax**](https://github.com/google/gitiles/blob/master/Documentation/markdown.md)
@@ -257,7 +257,6 @@ This is a list of constraints that the RESHAPE operator must satisfy in order to
- Input and output quantisation must match.
- Shape must be constant
-- Reshape on NPU not supported before MEAN operator
### TFLite RESIZE_BILINEAR Constraints
@@ -270,7 +269,6 @@ This is a list of constraints that the RESIZE_BILINEAR operator must satisfy in
W and H scaling must be equal and OFM W and H must be 2x/4x/8x IFM W and H, if align_corners is False
- The size tensor must match the output tensor shape
- Both align_corners and half_pixel_centers can't be True
-- Half_pixel_centers are only supported for resize bilinear
- Half_pixel_centers for resize bilinear requires that OFM W and H is 2x IFM W and H
### TFLite RESIZE_NEAREST_NEIGHBOR Constraints
@@ -284,7 +282,6 @@ This is a list of constraints that the RESIZE_NEAREST_NEIGHBOR operator must sat
W and H scaling must be equal and OFM W and H must be 2x/4x/8x IFM W and H, if align_corners is False
- The size tensor must match the output tensor shape
- Both align_corners and half_pixel_centers can't be True
-- Half_pixel_centers are only supported for resize bilinear
### TFLite SOFTMAX Constraints
diff --git a/ethosu/vela/test/test_tflite_supported_operators.py b/ethosu/vela/test/test_tflite_supported_operators.py
index 35fc1a6f..790f0018 100644
--- a/ethosu/vela/test/test_tflite_supported_operators.py
+++ b/ethosu/vela/test/test_tflite_supported_operators.py
@@ -381,18 +381,6 @@ def test_constraint_resize_attrs():
assert not support.is_operator_supported(op)
-def test_constraint_resize_half_pixel_centers():
- for resize_op in Op.op_set(Op.is_resize_op):
- # Half-pixel centers is only supported for resize bilinear
- op = testutil.create_op_with_quant_tensors(resize_op, [1, 4, 4, 8], [1, 8, 8, 8])
- op.add_input_tensor(create_const_tensor("size", [2], DataType.int32, [8, 8], np.int32))
- op.attrs["half_pixel_centers"] = True
- if resize_op == Op.ResizeBilinear:
- assert support.is_operator_supported(op)
- else:
- assert not support.is_operator_supported(op)
-
-
def test_constraint_concat_pass():
# A working concat
op = testutil.create_op_with_quant_tensors(Op.Concat, [1, 1, 1, 4], [1, 1, 1, 8])
diff --git a/ethosu/vela/tflite_graph_optimiser.py b/ethosu/vela/tflite_graph_optimiser.py
index f3ca1b63..574d298a 100644
--- a/ethosu/vela/tflite_graph_optimiser.py
+++ b/ethosu/vela/tflite_graph_optimiser.py
@@ -454,7 +454,9 @@ def convert_resize_to_upscale_and_average_pool(op):
# use depthwise conv to select the correct value
scaled_op = convert_resizenn_ac_to_depthwise_conv(scaled_op, upscale_factor)
else:
- # keep 1x1 kernel and average pool
+ # Keep 1x1 kernel and average pool, this applies both when
+ # half-pixel-centers is True and False. Calculations are the
+ # same in the reference.
pass
scaled_op.outputs = outputs
diff --git a/ethosu/vela/tflite_supported_operators.py b/ethosu/vela/tflite_supported_operators.py
index 3d04def3..23bbac24 100644
--- a/ethosu/vela/tflite_supported_operators.py
+++ b/ethosu/vela/tflite_supported_operators.py
@@ -264,7 +264,6 @@ class TFLiteSupportedOperators:
self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_resize)
self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_resize_size)
self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_resize_attrs)
- self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_resize_half_pixel_centers)
# Resize Bilinear specific checks:
self.specific_constraints[Op.ResizeBilinear].append(
@@ -682,15 +681,6 @@ class TFLiteSupportedOperators:
return valid, "Op has both align_corners and half_pixel_centers set to True."
@staticmethod
- def constraint_resize_half_pixel_centers(op):
- """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} and half_pixel_centers={half_pixel_centers}"
-
- @staticmethod
def constraint_resizebi_half_pixel_centers_dims(op):
"""Half_pixel_centers for resize bilinear requires that OFM W and H is 2x IFM W and H"""
half_pixel_centers = op.attrs.get("half_pixel_centers", False)