aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tflite_mapping.py
diff options
context:
space:
mode:
authorMichael McGeagh <michael.mcgeagh@arm.com>2020-11-10 12:38:25 +0000
committerMichael McGeagh <michael.mcgeagh@arm.com>2020-11-17 14:40:26 +0000
commit837dc1bc42323fa723b72fe51919bc2f013e5a26 (patch)
treee38f2e5ff31a13404c252e62dd13ef877a7e6a49 /ethosu/vela/tflite_mapping.py
parent69b3176127ff8522903e087d56e2d2f4ec557d62 (diff)
downloadethos-u-vela-837dc1bc42323fa723b72fe51919bc2f013e5a26.tar.gz
MLBEDSW-3403 Generate supported op report
A new CLI has been added that allows the generation of a report containing a summary table of all TFLite ops that can be placed on the NPU, and what the constraints are for that operator to be successfully scheduled on the NPU. This option will generate a new file, SUPPORTED_OPS.md containing this information, in the current working directory. Signed-off-by: Michael McGeagh <michael.mcgeagh@arm.com> Change-Id: I6a7e2a49f251b76b2ea1168fff78e00da1910b25
Diffstat (limited to 'ethosu/vela/tflite_mapping.py')
-rw-r--r--ethosu/vela/tflite_mapping.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/ethosu/vela/tflite_mapping.py b/ethosu/vela/tflite_mapping.py
index 44ecedcc..ea9e8a36 100644
--- a/ethosu/vela/tflite_mapping.py
+++ b/ethosu/vela/tflite_mapping.py
@@ -691,10 +691,15 @@ builtin_operator_inv_map = {v[0]: (k, v[1]) for k, v in builtin_operator_map.ite
builtin_operator_inv_map[Op.CustomNpuOp] = (BuiltinOperator.CUSTOM, CustomOptionsSerializer())
+BUILTIN_OPERATOR_UNKNOWN = "UNKNOWN"
+
+
+def builtin_type_name(builtin):
+ return next(k for k, v in vars(BuiltinOperator).items() if v == builtin)
+
def optype_to_builtintype(op_type):
if op_type in builtin_operator_inv_map:
- builtin_type = builtin_operator_inv_map[op_type][0]
- return next(k for k, v in vars(BuiltinOperator).items() if v == builtin_type)
+ return builtin_type_name(builtin_operator_inv_map[op_type][0])
else:
- return "UNKNOWN"
+ return BUILTIN_OPERATOR_UNKNOWN