class_docstr: Tests just-in-time cpp extensions.
  Don't confuse this with the PyTorch JIT (aka TorchScript).
code: def test_cpp_frontend_module_has_same_output_as_python(
      self, dtype=torch.double
  ):
      extension = torch.utils.cpp_extension.load(
          name="cpp_frontend_extension",
          sources="cpp_extensions/cpp_frontend_extension.cpp",
          verbose=True,
      )
  
      input = torch.randn(2, 5, dtype=dtype)
      cpp_linear = extension.Net(5, 2)
      cpp_linear.to(dtype)
      python_linear = torch.nn.Linear(5, 2).to(dtype)
  
      # First make sure they have the same parameters
      cpp_parameters = dict(cpp_linear.named_parameters())
      with torch.no_grad():
          python_linear.weight.copy_(cpp_parameters["fc.weight"])
          python_linear.bias.copy_(cpp_parameters["fc.bias"])
  
      cpp_output = cpp_linear.forward(input)
      python_output = python_linear(input)
      self.assertEqual(cpp_output, python_output)
  
      cpp_output.sum().backward()
      python_output.sum().backward()
  
      for p in cpp_linear.parameters():
          self.assertFalse(p.grad is None)
  
      self.assertEqual(
          cpp_parameters["fc.weight"].grad, python_linear.weight.grad
      )
      self.assertEqual(
          cpp_parameters["fc.bias"].grad, python_linear.bias.grad
      )
  
imports: import os
  import shutil
  import sys
  import unittest
  import warnings
  import re
  import tempfile
  import subprocess
  import glob
  import torch.testing._internal.common_utils
  from torch.testing._internal.common_cuda import TEST_CUDNN, TEST_CUDA
  import torch
  import torch.backends.cudnn
  import torch.utils.cpp_extension
  from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME
  from torch.testing._internal.common_utils import gradcheck
  import torch.multiprocessing
  from torch.utils.cpp_extension import _TORCH_PATH, remove_extension_h_precompiler_headers, get_cxx_compiler, check_compiler_is_gcc
label_desc: Use image node_id 20 for calling the TestCppExtensionJIT obj's underlying member method code with example usage: obj.test_cpp_frontend_module_has_same_output_as_python(dtype) without return types