code: def test_if():
      # we will have effects in the blocks to ensure only the intended one is executed
      true_cond = relay.const(True)
      false_cond = relay.const(False)
  
      v = relay.Var("v")
      true_branch = seq(
          relay.RefWrite(v, relay.const(1)), relay.RefRead(v)
      )
      false_branch = seq(
          relay.RefWrite(v, relay.const(2)), relay.RefRead(v)
      )
  
      true_expr = relay.Let(
          v,
          relay.RefCreate(relay.const(0)),
          relay.If(true_cond, true_branch, false_branch),
      )
      false_expr = relay.Let(
          v,
          relay.RefCreate(relay.const(0)),
          relay.If(false_cond, true_branch, false_branch),
      )
  
      true_val = run_as_python(true_expr)
      assert_tensor_value(true_val, 1)
  
      false_val = run_as_python(false_expr)
      assert_tensor_value(false_val, 2)
  
imports: import numpy
  import tvm
  from tvm import te
  from tvm import relay
  from tvm.relay.testing import run_as_python
  from tvm.relay.prelude import Prelude
  from tvm.runtime.container import ADT
  from tvm.relay.backend.interpreter import RefValue, ConstructorValue
label_desc: Use image node_id 15 for calling a global function with example usage: test_if() without return types