From 57f4e9814558646950979d313603c508c3608be8 Mon Sep 17 00:00:00 2001 From: Nicola Lancellotti Date: Tue, 4 Apr 2023 13:48:00 +0000 Subject: [PATCH] [Relay] Check if the attribute "name" exists before accessing it --- python/tvm/relay/qnn/op/_qnn.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/tvm/relay/qnn/op/_qnn.py b/python/tvm/relay/qnn/op/_qnn.py index 278ce7ee23c8..2ad2445cd365 100644 --- a/python/tvm/relay/qnn/op/_qnn.py +++ b/python/tvm/relay/qnn/op/_qnn.py @@ -101,7 +101,11 @@ def legalize_clip(attrs, inputs, tinfos): implementations (like Cortex-M) need it to be done earlier in legalization. """ - if hasattr(inputs[0], "op") and inputs[0].op.name == "qnn.requantize": + if ( + hasattr(inputs[0], "op") + and hasattr(inputs[0].op, "name") + and inputs[0].op.name == "qnn.requantize" + ): dtype_info = np.iinfo(tinfos[0].dtype) if dtype_info.min == attrs.a_min and dtype_info.max == attrs.a_max: return inputs[0]