code: def run_and_compare_activation(self, fn, inps):
      with torch.jit.fuser("fuser1"):
          device = "cuda"
          dtype = torch.float
          if isinstance(fn, nn.Module):
              fn = fn.to(device=device, dtype=dtype)
  
          ref_args = [
              torch.randn(
                  shape, device=device, dtype=dtype, requires_grad=True
              )
              for shape in inps
          ]
          res_args = [
              i.clone().detach().requires_grad_(True) for i in ref_args
          ]
  
          ref = fn(*ref_args)
          ref.sum().backward()
  
          mem_optimized_fn = memory_efficient_fusion(fn)
          for _ in range(5):
              for i in res_args:
                  i.grad = None
              res = mem_optimized_fn(*res_args)
              res.sum().backward()
  
          self.assertEqual(ref, res)
          for ref_arg, res_arg in zip(ref_args, res_args):
              self.assertEqual(ref_arg.grad, res_arg.grad)
  
imports: import torch
  import torch.nn
  import torch.fx
  from functorch import make_fx
  from torch.nn import functional
  from functorch.compile import memory_efficient_fusion
  from torch._functorch.compile_utils import fx_graph_cse
  from torch.testing._internal.common_utils import TestCase, run_tests
  import inspect
  import random
  from typing import Callable
  import unittest
label_desc: Use image node_id 8 for calling a global function with example usage: run_and_compare_activation(fn, inps) without return types