aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tflite_graph_optimiser.py
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2022-03-16 16:31:57 +0000
committertim.hall <tim.hall@arm.com>2022-03-21 18:50:48 +0000
commit3c5cfe9e110b402f60fa7e1cdd5aa5e1c31bd511 (patch)
treec5db3f145a097293cacaaee4112cc30be3670b4c /ethosu/vela/tflite_graph_optimiser.py
parent845e23200d471e44f274940846e400d170b5ff37 (diff)
downloadethos-u-vela-3c5cfe9e110b402f60fa7e1cdd5aa5e1c31bd511.tar.gz
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 <tim.hall@arm.com> Change-Id: I4641e9cd6b049bd4186776d98e3e751c5e5bcc06
Diffstat (limited to 'ethosu/vela/tflite_graph_optimiser.py')
-rw-r--r--ethosu/vela/tflite_graph_optimiser.py7
1 files changed, 3 insertions, 4 deletions
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