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
diff --git a/ethosu/vela/test/test_tflite_supported_operators.py b/ethosu/vela/test/test_tflite_supported_operators.py
index 35fc1a6..790f001 100644
--- a/ethosu/vela/test/test_tflite_supported_operators.py
+++ b/ethosu/vela/test/test_tflite_supported_operators.py
@@ -381,18 +381,6 @@
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 f3ca1b6..574d298 100644
--- a/ethosu/vela/tflite_graph_optimiser.py
+++ b/ethosu/vela/tflite_graph_optimiser.py
@@ -454,7 +454,9 @@
# 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 3d04def..23bbac2 100644
--- a/ethosu/vela/tflite_supported_operators.py
+++ b/ethosu/vela/tflite_supported_operators.py
@@ -264,7 +264,6 @@
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 @@
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)