class_docstr: Tests ahead-of-time cpp extensions
  
  NOTE: run_test.py's test_cpp_extensions_aot_ninja target
  also runs this test case, but with ninja enabled. If you are debugging
  a test failure here from the CI, check the logs for which target
  (test_cpp_extensions_aot_no_ninja vs test_cpp_extensions_aot_ninja)
  failed.
class_docstr_tok: ["Tests","ahead-of-time","cpp","extensions","NOTE",":","run_test.py","'s","test_cpp_extensions_aot_ninja","target","also","runs","this","test","case",",","but","with","ninja","enabled",".","If","you","are","debugging","a","test","failure","here","from","the","CI",",","check","the","logs","for","which","target","(","test_cpp_extensions_aot_no_ninja","vs","test_cpp_extensions_aot_ninja",")","failed","."]
code: def test_optional(self):
      has_value = cpp_extension.function_taking_optional(torch.ones(5))
      self.assertTrue(has_value)
      has_value = cpp_extension.function_taking_optional(None)
      self.assertFalse(has_value)
  
imports: from itertools import repeat
  import os
  import re
  from typing import Union, get_args, get_origin
  import unittest
  import torch.testing._internal.common_utils
  from torch.testing._internal.common_utils import IS_WINDOWS, skipIfTorchDynamo
  from torch.testing._internal.common_cuda import TEST_CUDA
  import torch
  import torch.backends.cudnn
  import torch.utils.cpp_extension
label_desc: Use image node_id 9 for calling the TestCppExtensionAOT obj's underlying member method code with example usage: obj.test_optional() without return types