code: def test_batch_norm_fold_const():
      axis = 1
      dtype = "float32"
      shape = [4, 5, 6]
  
      data_np = np.random.random(shape).astype(dtype)
      beta_np = np.random.random(shape[axis]).astype(dtype)
      gamma_np = np.random.random(shape[axis]).astype(dtype)
      moving_mean_np = np.random.random(shape[axis]).astype(dtype)
      moving_var_np = np.random.random(shape[axis]).astype(dtype)
  
      data = relay.var("data", relay.TensorType(shape, dtype))
      beta = relay.var("beta", relay.TensorType((shape[1],), dtype))
      gamma = relay.var("gamma", relay.TensorType((shape[1],), dtype))
      moving_mean = relay.var(
          "moving_mean", relay.TensorType((shape[1],), dtype)
      )
      moving_var = relay.var(
          "moving_var", relay.TensorType((shape[1],), dtype)
      )
      out = relay.nn.batch_norm(
          data, gamma, beta, moving_mean, moving_var, axis=axis
      ).astuple()
      func = relay.Function(
          [data, gamma, beta, moving_mean, moving_var], out
      )
  
      out_const = relay.nn.batch_norm(
          relay.const(data_np),
          relay.const(gamma_np),
          relay.const(beta_np),
          relay.const(moving_mean_np),
          relay.const(moving_var_np),
          axis=axis,
      ).astuple()
      func_const = relay.Function([], out_const)
  
      # Build the module with constants to have FoldConstant transform batch_norm.
      mod_const = tvm.IRModule.from_expr(func_const)
      mod_const = relay.transform.FoldConstant()(mod_const)
  
      const_data_out = mod_const["main"].body[0].data
      const_moving_mean_out = mod_const["main"].body[1].data
      const_moving_var_out = mod_const["main"].body[2].data
  
      # Run the Relay func without constants. This will use SimplyInference instead.
      (
          vm_data_out,
          vm_moving_mean_out,
          vm_moving_var_out,
      ) = relay.create_executor(
          "vm", device=tvm.device("llvm"), target="llvm"
      ).evaluate(
          func
      )(
          data_np, gamma_np, beta_np, moving_mean_np, moving_var_np
      )
  
      tvm.testing.assert_allclose(
          const_data_out.numpy(), vm_data_out.numpy()
      )
      tvm.testing.assert_allclose(
          const_moving_mean_out.numpy(), vm_moving_mean_out.numpy()
      )
      tvm.testing.assert_allclose(
          const_moving_var_out.numpy(), vm_moving_var_out.numpy()
      )
  
imports: import numpy
  import pytest
  import tvm
  from tvm import te
  import scipy
  from tvm import relay
  import pytest
  from tvm.relay.testing import run_infer_type
  import tvm.topi.testing
  from tvm.contrib.nvcc import have_fp16
  import tvm.testing
  from tvm.topi.utils import get_const_tuple
label_desc: Use image node_id 19 for calling a global function with example usage: test_batch_norm_fold_const() without return types