code: def test_ref_execution_order():
      # we want to have effects execute from left to right
      x = relay.Var("x")
      y = relay.Var("y")
      f = relay.Var("f")
      r = relay.Var("r")
  
      expr = relay.Let(
          f,
          relay.Function([x, y], x),
          # r = 1
          relay.Let(
              r,
              relay.RefCreate(relay.const(1)),
              relay.Tuple(
                  [
                      # should be 1
                      relay.RefRead(r),
                      # set r to 2 and read back
                      seq(
                          relay.RefWrite(r, relay.const(2)),
                          relay.RefRead(r),
                      ),
                      # set r to 3 and read back
                      seq(
                          relay.RefWrite(r, relay.const(3)),
                          relay.RefRead(r),
                      ),
                      # set r to 4 and read as first arg to f
                      # set r to 5 and read as second arg to f
                      # f should evaluate to 4
                      f(
                          seq(
                              relay.RefWrite(r, relay.const(4)),
                              relay.RefRead(r),
                          ),
                          seq(
                              relay.RefWrite(r, relay.const(5)),
                              relay.RefRead(r),
                          ),
                      ),
                      # read back 5
                      relay.RefRead(r),
                  ]
              ),
          ),
      )
  
      tup_val = run_as_python(expr)
      assert_adt_len(tup_val, 5)
      assert_tensor_value(tup_val[0], 1)
      assert_tensor_value(tup_val[1], 2)
      assert_tensor_value(tup_val[2], 3)
      assert_tensor_value(tup_val[3], 4)
      assert_tensor_value(tup_val[4], 5)
  
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 29 for calling a global function with example usage: test_ref_execution_order() without return types