Skip to content

Commit

Permalink
[Relay] Check if the attribute "name" exists before accessing it
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolaLancellotti committed Apr 4, 2023
1 parent f5db8b7 commit 57f4e98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/tvm/relay/qnn/op/_qnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 57f4e98

Please sign in to comment.