code: def test_checkpoint_alpha_equal_tuple():
      xs = [
          relay.var("x{}".format(i), relay.TensorType((1,), "float32"))
          for i in range(4)
      ]
      f = relay.Function(
          xs,
          relay.annotation.checkpoint(
              relay.Tuple(
                  [relay.add(xs[0], xs[1]), relay.add(xs[2], xs[3])]
              )
          ),
      )
      df = transform.gradient(run_infer_type(f))
  
      # run PE and DCE
      with tvm.transform.PassContext(opt_level=3):
          # See comment in test_checkpoint_alpha_equal above.
          # TODO(mbs): Revisit once DCE supports dead reference writes.
          passes = [
              transform.PartialEvaluate(),
              transform.DeadCodeElimination(
                  inline_once=True, ignore_impurity=True
              ),
          ]
          mod = tvm.transform.Sequential(passes)(
              tvm.IRModule.from_expr(df)
          )
          df = mod["main"]
  
      df_parsed = tvm.relay.parse_expr(
          """
          #[version = "0.0.5"]
          fn (%x: Tensor[(1), float32], %y: Tensor[(1), float32],
              %z: Tensor[(1), float32], %w: Tensor[(1), float32])
              -> ((Tensor[(1), float32], Tensor[(1), float32]),
                  (Tensor[(1), float32], Tensor[(1), float32],
                   Tensor[(1), float32], Tensor[(1), float32])) {
          let %x1: Tensor[(1), float32] = add(%x, %y) /* ty=Tensor[(1), float32] */;
          let %x2: Tensor[(1), float32] = add(%z, %w) /* ty=Tensor[(1), float32] */;
          let %x3: Tensor[(1), float32] = zeros_like(%x2) /* ty=Tensor[(1), float32] */;
          let %x4: Tensor[(1), float32] = ones_like(%x1) /* ty=Tensor[(1), float32] */;
          %0 = (%x1, %x2);
          %1 = zeros_like(%x) /* ty=Tensor[(1), float32] */;
          %2 = collapse_sum_like(%x4, %x) /* ty=Tensor[(1), float32] */;
          %3 = add(%1, %2) /* ty=Tensor[(1), float32] */;
          %4 = zeros_like(%y) /* ty=Tensor[(1), float32] */;
          %5 = collapse_sum_like(%x4, %y) /* ty=Tensor[(1), float32] */;
          %6 = add(%4, %5) /* ty=Tensor[(1), float32] */;
          %7 = zeros_like(%z) /* ty=Tensor[(1), float32] */;
          %8 = collapse_sum_like(%x3, %z) /* ty=Tensor[(1), float32] */;
          %9 = add(%7, %8) /* ty=Tensor[(1), float32] */;
          %10 = zeros_like(%w) /* ty=Tensor[(1), float32] */;
          %11 = collapse_sum_like(%x3, %w) /* ty=Tensor[(1), float32] */;
          %12 = add(%10, %11) /* ty=Tensor[(1), float32] */;
          %13 = (%3, %6, %9, %12);
          (%0, %13)
          }
          """
      )
  
      tvm.ir.assert_structural_equal(df, df_parsed)
  
imports: import sys
  import pytest
  import numpy
  import tvm
  import tvm.testing
  import tvm.topi.testing
  from tvm import relay, te, topi
  from tvm.relay import transform
  from tvm.relay.testing import run_infer_type
label_desc: Use image node_id 3 for calling a global function with example usage: test_checkpoint_alpha_equal_tuple() without return types