aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/mark_tensors.py
diff options
context:
space:
mode:
authorJonas Ohlsson <jonas.ohlsson@arm.com>2021-09-01 15:57:21 +0200
committerJonas Ohlsson <jonas.ohlsson@arm.com>2021-09-15 10:48:08 +0100
commit0957e3ef4b94f17efb67429c88bab8ba650f78e8 (patch)
treef3e2600367bc7c89145657023b45b9dde2c316c2 /ethosu/vela/mark_tensors.py
parent1a7527cd4ad56b49f120b10dc5e87a1e8f5a8122 (diff)
downloadethos-u-vela-0957e3ef4b94f17efb67429c88bab8ba650f78e8.tar.gz
MLBEDSW-5102 Update removal of memory only operators
Memory only operators such as Reshape, Squeeze and ExpandDims are removed in the graph optimiser step. - Added semantic check that memory only operators have same quantisation parameters on ifm/ofm. - Added support for the ExpandDims operator. - Addition and cleanup of related unit tests. - Removed TOSA from the generated SUPPORTED_OPS.md documentation. Signed-off-by: Jonas Ohlsson <jonas.ohlsson@arm.com> Change-Id: If848d8afc58c18806e10997ed94e4dae83f30879
Diffstat (limited to 'ethosu/vela/mark_tensors.py')
-rw-r--r--ethosu/vela/mark_tensors.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ethosu/vela/mark_tensors.py b/ethosu/vela/mark_tensors.py
index f3d5e855..f76c59d7 100644
--- a/ethosu/vela/mark_tensors.py
+++ b/ethosu/vela/mark_tensors.py
@@ -15,6 +15,7 @@
# limitations under the License.
# Description:
# Mark purpose and select formats for Tensors.
+from .graph_optimiser_util import memory_only_ops
from .operation import CustomType
from .operation import Op
from .rewrite_graph import visit_graph_post_order
@@ -72,8 +73,8 @@ def rewrite_mark_tensor_purpose(op, arch):
else:
purpose = TensorPurpose.FeatureMap
mark_purpose(tens, arch, purpose)
- if op.type == Op.Reshape:
- # Reshape's input and output point to same data
+ if op.type in memory_only_ops:
+ # Memory only operator input and output point to same data
op.ofm.mem_area = op.ifm.mem_area
if op.type == Op.Custom and op.attrs.get("custom_type") == CustomType.ExistingNpuOp: