From 837dc1bc42323fa723b72fe51919bc2f013e5a26 Mon Sep 17 00:00:00 2001 From: Michael McGeagh Date: Tue, 10 Nov 2020 12:38:25 +0000 Subject: 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 Change-Id: I6a7e2a49f251b76b2ea1168fff78e00da1910b25 --- ethosu/vela/tflite_mapping.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ethosu/vela/tflite_mapping.py') 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 -- cgit v1.2.1