Skip to content

Commit

Permalink
Fix format.
Browse files Browse the repository at this point in the history
  • Loading branch information
xhmelon committed Sep 18, 2024
1 parent e687934 commit 125683c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/tvm/relay/frontend/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4565,18 +4565,18 @@ def _impl_v1(cls, inputs, attr, params):
"Attempting to unify ranks but this may produce incorrect results."
)
warnings.warn(warning_msg)
if type(inputs[0]) is tvm.relay.expr.Constant:
cond_value = inputs[0].data.asnumpy()[0]
# breakpoint()
# Skip constant If node to avoid irrational broadcast
if isinstance(inputs[0], tvm.relay.expr.Constant):
predicate = inputs[0].data.asnumpy()[0]
node_name = attr["tvm_custom"]["name"]
warn_msg_begin = f"Predicate of If node {node_name} is always "
if cond_value == np.bool_(True):
if predicate == np.bool_(True):
warnings.warn(
warn_msg_begin
+ "true so only then branch would be executed. Removing else branch. "
)
else_expr = then_expr
elif cond_value == np.bool_(False):
elif predicate == np.bool_(False):
warnings.warn(
warn_msg_begin
+ "false so only else branch would be executed. Removing then branch. "
Expand Down

0 comments on commit 125683c

Please sign in to comment.