class_docstr: Runs type inference on a single AST statement.
  
  This visitor annotates most nodes with type information. It also sets types
  for the symbols modified by this statement in its types_out property.
  
  Note: this inferrer is able to capture side effects of functions, however,
  these side effects will not be applied to the current expression. Doing so
  would create too much of a dependence on the runtime's internal rules about
  execution order.
  Example:
  
    def f():
      nonlocal a
      a = 1
      return a
  
    a = 0.0
    b = f() + a  # a = float; side effect of f() ignored
    print(a)  # a = int; side effect of f() accounted for
class_docstr_tok: ["Runs","type","inference","on","a","single","AST","statement",".","This","visitor","annotates","most","nodes","with","type","information",".","It","also","sets","types","for","the","symbols","modified","by","this","statement","in","its","types_out","property",".","Note",":","this","inferrer","is","able","to","capture","side","effects","of","functions",",","however",",","these","side","effects","will","not","be","applied","to","the","current","expression",".","Doing","so","would","create","too","much","of","a","dependence","on","the","runtime","'s","internal","rules","about","execution","order",".","Example",":","def","f","(",")",":","nonlocal","a","a","=","1","return","a","a","=","0.0","b","=","f","(",")","+","a","#","a","=","float",";","side","effect","of","f","(",")","ignored","print","(","a",")","#","a","=","int",";","side","effect","of","f","(",")","accounted","for"]
code: def visit_Name(self, node):
      name = anno.getanno(node, anno.Basic.QN)
  
      if isinstance(node.ctx, gast.Load):
          types = self.types_in.types.get(name, None)
          if types is None:
              if (name not in self.scope.bound) or (
                  name in self.scope.nonlocals
              ):
                  # TODO(mdan): Test with global variables.
                  if name in self.closure_types:
                      types = self.closure_types[name]
                  else:
                      types, value = self.resolver.res_name(
                          self.namespace, self.types_in.types, name
                      )
                      if value is not None:
                          anno.setanno(node, anno.Static.VALUE, value)
  
      elif isinstance(node.ctx, gast.Param):
          # The direct parent it the whole function scope. See activity.py.
          f_is_local = self.scope.parent.parent is not None
  
          type_name = anno.getanno(node.annotation, anno.Basic.QN, None)
          types = self.resolver.res_arg(
              self.namespace,
              self.types_in.types,
              self.scope.function_name,
              name,
              type_name,
              f_is_local,
          )
          if types is not None:
              self.new_symbols[name] = types
  
      elif isinstance(node.ctx, gast.Store):
          if self.rtype is not None:
              self.new_symbols[name] = self.rtype
          types = self.rtype
  
      else:
          assert False, "unknown ctx"
  
      if __debug__:
          self._check_set(types)
  
      return types
  
imports: import itertools
  from typing import Any, Callable, Dict, Set
  import gast
  from nvidia.dali._autograph.pyct import anno
  from nvidia.dali._autograph.pyct import cfg
  from nvidia.dali._autograph.pyct import qual_names
  from nvidia.dali._autograph.pyct import transformer
  from nvidia.dali._autograph.pyct.static_analysis import activity
  from nvidia.dali._autograph.pyct.static_analysis import annos
label_desc: Use image node_id 9 for calling the StmtInferrer obj's underlying member method code with example usage: obj.visit_Name(node) and returns: types