class_docstr: Test APIs documented by https://pytorch.org/docs/main/torch.compiler_custom_backends.html
class_docstr_tok: ["Test","APIs","documented","by","https",":","\/\/pytorch.org\/docs\/main\/torch.compiler_custom_backends.html"]
code: def test_aot_autograd_api(self):
      from functorch.compile import make_boxed_func
      from torch._dynamo.backends.common import aot_autograd
  
      backend_run = False
  
      def my_compiler(gm, example_inputs):
          nonlocal backend_run
          backend_run = True
          return make_boxed_func(gm.forward)
  
      my_backend = aot_autograd(fw_compiler=my_compiler)
  
      def f(x):
          return torch.relu(x)
  
      opt_f = torch.compile(f, backend=my_backend)
      opt_f(torch.randn(3, 3))
      self.assertTrue(backend_run)
  
imports: import functools
  import unittest
  import torch
  import torch._dynamo
  import torch._dynamo.test_case
  from torch._dynamo.backends.debugging import ExplainWithBackend
  from torch._dynamo.backends.onnxrt import has_onnxruntime
  from torch._dynamo.backends.tvm import has_tvm
  from torch._dynamo.testing import same
  from torch.testing._internal.inductor_utils import HAS_CUDA
label_desc: Use image node_id 2 for calling the TestCustomBackendAPI obj's underlying member method code with example usage: obj.test_aot_autograd_api() and returns: make_boxed_func, torch