From 3c5cfe9e110b402f60fa7e1cdd5aa5e1c31bd511 Mon Sep 17 00:00:00 2001 From: Tim Hall Date: Wed, 16 Mar 2022 16:31:57 +0000 Subject: MLBEDSW-6298: MLCE: Unable to find a valid block config - Fixed a bug due to ResizeBilinear modifying the attributes of a shared IFM - The ifm_resampling_mode is now an attribute of an operator rather than a tensor - Changed all calls to try_block_config() to use the attribute rather than recalculating it in multiple places Signed-off-by: Tim Hall Change-Id: I4641e9cd6b049bd4186776d98e3e751c5e5bcc06 --- ethosu/vela/tflite_graph_optimiser.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ethosu/vela/tflite_graph_optimiser.py') diff --git a/ethosu/vela/tflite_graph_optimiser.py b/ethosu/vela/tflite_graph_optimiser.py index 576ead03..fb8a08c0 100644 --- a/ethosu/vela/tflite_graph_optimiser.py +++ b/ethosu/vela/tflite_graph_optimiser.py @@ -268,7 +268,7 @@ def fixup_conv2d_backprop(op, arch, nng): # flip the inputs op.inputs[0], op.inputs[2] = op.inputs[2], op.inputs[0] op.type = Op.Conv2DBackpropInputSwitchedBias - op.ifm.resampling_mode = resampling_mode.TRANSPOSE + op.ifm_resampling_mode = resampling_mode.TRANSPOSE # Update strides op.attrs.update({"stride_w": 1, "stride_h": 1, "strides": (1, 1, 1, 1)}) @@ -312,7 +312,7 @@ def convert_resizebilinear_to_nearest_neighbor_upscaling_and_pool(op): else: shape_modifier = 0 op.attrs["padding"] = Padding.SAME - op.inputs[0].resampling_mode = resampling_mode.NEAREST + op.ifm_resampling_mode = resampling_mode.NEAREST upscaled_shape = np.array(op.ifm_shapes[0].get_hw_as_list()) out_shape = np.array(op.ofm_shapes[0].get_hw_as_list()) @@ -1128,7 +1128,6 @@ def convert_pad(op: Operation, arch, nng): def add_attrs_to_resizebilinear(op, arch, nng): if op.type == Op.ResizeBilinear and op.run_on_npu: - input_tensor = op.inputs[0] input_shape = op.ifm_shapes[0] upscaled_height = input_shape.height * 2 upscaled_width = input_shape.width * 2 @@ -1147,7 +1146,7 @@ def add_attrs_to_resizebilinear(op, arch, nng): op.attrs["padding"] = Padding.VALID else: return op - input_tensor.resampling_mode = resampling_mode.NEAREST + op.ifm_resampling_mode = resampling_mode.NEAREST op.attrs.update({"strides": (1, 1, 1, 1), "ksize": (1, 2, 2, 1)}) return op -- cgit v1.2.1