aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tflite_reader.py
diff options
context:
space:
mode:
authorDwight Lidman <dwight.lidman@arm.com>2020-05-29 09:37:03 +0200
committerTim Hall <tim.hall@arm.com>2020-06-18 17:53:52 +0100
commit42fed9484c9aa2a43bdd1b07f9b66bdecabd821d (patch)
treeb843ef49059d810ac2daa06d3b731e43a8856472 /ethosu/vela/tflite_reader.py
parenta9390f7fbd35dca75e80710835f67bb1d75d7c93 (diff)
downloadethos-u-vela-42fed9484c9aa2a43bdd1b07f9b66bdecabd821d.tar.gz
MLBEDSW-2372: Failing assert for ResizeBilinear with upscale != 2x
This commit fixes the failing assert by removing it and instead placing unsupported ResizeBilinear operators on the CPU. It introduces a new graph optimisation function which adds the necessary attributes as well as new operator restrictions for ResizeBilinear. Signed-off-by: Dwight Lidman <dwight.lidman@arm.com> Change-Id: I2feffd0b5a2169ebffbe4f165e450b3f2d140380
Diffstat (limited to 'ethosu/vela/tflite_reader.py')
-rw-r--r--ethosu/vela/tflite_reader.py19
1 files changed, 0 insertions, 19 deletions
diff --git a/ethosu/vela/tflite_reader.py b/ethosu/vela/tflite_reader.py
index 4ee39634..109ae0ec 100644
--- a/ethosu/vela/tflite_reader.py
+++ b/ethosu/vela/tflite_reader.py
@@ -20,7 +20,6 @@ import os.path
import numpy as np
from .errors import UnsupportedFeatureError
-from .ethos_u55_regs.ethos_u55_regs import resampling_mode
from .nn_graph import Graph
from .nn_graph import Subgraph
from .operation import Operation
@@ -146,24 +145,6 @@ class TFLiteSubgraph:
if opt_serializer is not None:
op.attrs = opt_serializer.deserialize(op_data.BuiltinOptions(), op_data.CustomOptionsAsNumpy())
- if op_type.startswith("ResizeBilinear"):
- input_tensor = op.inputs[0]
- upscaled_shape = [input_tensor.shape[1] * 2, input_tensor.shape[2] * 2]
- out_shape = op.outputs[0].shape[1:3]
- if not op.attrs["align_corners"] and out_shape == upscaled_shape:
- # this means the output is supposed to be a x2 upscale,
- # so we need to do SAME padding
- op.attrs.update({"padding": b"SAME"})
- elif op.attrs["align_corners"] and out_shape == [upscaled_shape[0] - 1, upscaled_shape[1] - 1]:
- # here we can just run the avg pool without padding and
- # produce a (M * 2 - 1, N * 2 - 1) sized output
- op.attrs.update({"padding": b"VALID"})
- else:
- raise UnsupportedFeatureError("ResizeBilinear: Only 2x upscaling is supported")
- op.attrs.update({"filter_width": 2, "filter_height": 2, "stride_w": 1, "stride_h": 1})
-
- input_tensor.resampling_mode = resampling_mode.NEAREST
-
if "stride_w" in op.attrs:
op.attrs["strides"] = (1, op.attrs["stride_h"], op.attrs["stride_w"], 1)
if "filter_width" in op.attrs: