code: def test_function_in_tuple():
      metatable = {"VirtualDevice": [CPU, GPU]}
  
      # Since %f ends up in a tuple its argument and result is forced to be on the CPU
      def input():
          return tvm.relay.parse(
              """
              #[version = "0.0.5"]
              def @main(%x: Tensor[(5, 7), float32], %y: Tensor[(5, 7), float32]) {
                let %f = fn (%a: Tensor[(5, 7), float32], %b: Tensor[(5, 7), float32]) {
                  %0 = on_device(%b, virtual_device=meta[VirtualDevice][0]);
                  add(%a, %0)
                };
                let %t = (%f, %x);
                %1 = %t.1;
                %2 = %t.0;
                %2(%1, %y)
              }
          """,
              "from_string",
              None,
              metatable,
          )
  
      def expected():
          return tvm.relay.parse(
              """
              #[version = "0.0.5"]
              def @main(%x {virtual_device=meta[VirtualDevice][0]}: Tensor[(5, 7), float32], %y {virtual_device=meta[VirtualDevice][0]}: Tensor[(5, 7), float32],
                        virtual_device=meta[VirtualDevice][0]) {
                let %f = fn (%a {virtual_device=meta[VirtualDevice][0]}: Tensor[(5, 7), float32], %b {virtual_device=meta[VirtualDevice][0]}: Tensor[(5, 7), float32],
                             virtual_device=meta[VirtualDevice][0]) {
                  add(%a, %b)
                };
                let %t = on_device((%f, %x), virtual_device=meta[VirtualDevice][0], constrain_result=True);
                %0 = %t.1;
                %1 = %t.0;
                %1(%0, %y)
              }
          """,
              "from_string",
              None,
              metatable,
          )
  
      def ref(x, y):
          return np.add(x, y)
  
      exercise(input(), expected(), ref, rands((5, 7), 2))
  
imports: import tvm
  from tvm import relay
  from tvm.script import tir
  import tvm.testing
  import numpy
  import os
label_desc: Use image node_id 16 for calling a global function with example usage: test_function_in_tuple() and returns: tvm, tvm, np