Relay 条件表达

Relay 条件表达#

from tvm import relay

a, b = [relay.var(name) for name in "ab"]
c = a + b
d = a * b
cond = relay.const(a == b)
f = relay.If(cond, c, d)
print(f)
if (False) {
  free_var %a;
  free_var %b;
  add(%a, %b)
} else {
  multiply(%a, %b)
}