code: def valuetype_type(
      t: Type,
      *,
      binds: ArgName,
      remove_non_owning_ref_types: bool = False,
      symint: bool = False,
  ) -> Optional[NamedCType]:
      if isinstance(t, BaseType):
          if t.name == BaseTy.Tensor or t.name == BaseTy.Scalar:
              return None
          elif str(t) == "SymInt":
              if symint:
                  return NamedCType(binds, BaseCType(SymIntT))
              else:
                  return NamedCType(binds, BaseCType(longT))
          if remove_non_owning_ref_types:
              if t.name == BaseTy.str:
                  raise AssertionError(
                      "string ref->value conversion: not implemented yet"
                  )
          # All other BaseType currently map directly to BaseCppTypes.
          return NamedCType(
              binds, BaseCType(BaseTypeToCppMapping[t.name])
          )
      elif isinstance(t, OptionalType):
          elem = valuetype_type(t.elem, binds=binds, symint=symint)
          if elem is None:
              return None
          return NamedCType(binds, OptionalCType(elem.type))
      elif isinstance(t, ListType):
          if str(t.elem) == "bool":
              assert t.size is not None
              return NamedCType(
                  binds, ArrayCType(BaseCType(boolT), t.size)
              )
          else:
              return None
      else:
          raise AssertionError(f"unrecognized type {repr(t)}")
  
file_path: pytorch/torchgen/api/cpp.py
imports: from typing import List, Optional, Sequence, Set, Union
  from torchgen import local
  from torchgen.api.types import ArgName, ArrayCType, ArrayRefCType, BaseCType, BaseTypeToCppMapping, Binding, boolT, ConstRefCType, CType, dimnameListT, intArrayRefT, iTensorListRefT, ListCType, longT, MutRefCType, NamedCType, OptionalCType, optionalIntArrayRefT, optionalSymIntArrayRefT, scalarT, SpecialArgName, symIntArrayRefT, SymIntT, tensorListT, tensorOptionsT, tensorT, TupleCType, VectorCType, voidT
  from torchgen.model import Argument, Arguments, BaseTy, BaseType, FunctionSchema, ListType, NativeFunction, OptionalType, Return, SelfArgument, TensorOptionsArguments, Type
  from torchgen.utils import assert_never
label_desc: Use image node_id 2 for calling a global function with example usage: valuetype_type(t) and returns: NamedCType, None, NamedCType, None, NamedCType, NamedCType, NamedCType, None