code: def builder(self):
      try:
          if not self.is_rocm_pytorch():
              assert_no_cuda_mismatch(self.name)
          self.build_for_cpu = False
      except MissingCUDAException:
          self.build_for_cpu = True
  
      if self.build_for_cpu:
          from torch.utils.cpp_extension import (
              CppExtension as ExtensionBuilder,
          )
      else:
          from torch.utils.cpp_extension import (
              CUDAExtension as ExtensionBuilder,
          )
  
      compile_args = (
          {"cxx": self.strip_empty_entries(self.cxx_args())}
          if self.build_for_cpu
          else {
              "cxx": self.strip_empty_entries(self.cxx_args()),
              "nvcc": self.strip_empty_entries(self.nvcc_args()),
          }
      )
  
      if not self.build_for_cpu and self.enable_bf16:
          compile_args["cxx"].append("-DBF16_AVAILABLE")
  
      if self.is_rocm_pytorch():
          compile_args["cxx"].append("-D__HIP_PLATFORM_AMD__=1")
  
      cuda_ext = ExtensionBuilder(
          name=self.absolute_name(),
          sources=self.strip_empty_entries(self.sources()),
          include_dirs=self.strip_empty_entries(self.include_paths()),
          libraries=self.strip_empty_entries(self.libraries_args()),
          extra_compile_args=compile_args,
          extra_link_args=self.strip_empty_entries(
              self.extra_ldflags()
          ),
      )
  
      if self.is_rocm_pytorch():
          # hip converts paths to absolute, this converts back to relative
          sources = cuda_ext.sources
          curr_file = Path(__file__).parent.parent  # ds root
          for i in range(len(sources)):
              src = Path(sources[i])
              if src.is_absolute():
                  sources[i] = str(src.relative_to(curr_file))
              else:
                  sources[i] = str(src)
          cuda_ext.sources = sources
      return cuda_ext
  
imports: import os
  import sys
  import time
  import importlib
  from pathlib import Path
  import subprocess
  import shlex
  import shutil
  import tempfile
  import distutils.ccompiler
  import distutils.log
  import distutils.sysconfig
  from distutils.errors import CompileError, LinkError
  from abc import ABC, abstractmethod
  from typing import List
label_desc: Use image node_id 5 for calling the CUDAOpBuilder obj's underlying member method code with example usage: obj.builder() and returns: cuda_ext