class_docstr: A generic transpiler for Python functions.
  
  Its interface is the `transform` API, which can process Python function
  objects. Internally, it handles parsing.
  
  Users typically subclass this, customizing the `transform_ast` method. The
  output of transformed_ast is returned directly by `transform`. Existing
  methods like `transform_function` may also be overloaded.
  
  Example:
  
      class MyTransformer(GenericTranspiler):
  
        def transform_ast(self, node, ctx):
          result = <<transform node>>
          return result
  
      transformer = MyTransfomer()
  
      result = transformer.transform(f, ...)
      # result is the output
class_docstr_tok: ["A","generic","transpiler","for","Python","functions",".","Its","interface","is","the","`","transform","`","API",",","which","can","process","Python","function","objects",".","Internally",",","it","handles","parsing",".","Users","typically","subclass","this",",","customizing","the","`","transform_ast","`","method",".","The","output","of","transformed_ast","is","returned","directly","by","`","transform","`",".","Existing","methods","like","`","transform_function","`","may","also","be","overloaded",".","Example",":","class","MyTransformer","(","GenericTranspiler",")",":","def","transform_ast","(","self",",","node",",","ctx",")",":","result","=","<","<","transform","node",">",">","return","result","transformer","=","MyTransfomer","(",")","result","=","transformer.transform","(","f",",","...",")","#","result","is","the","output"]
docstr: Transforms a function.
  
  Subclasses may override this method. The return value is opaque.
  
  The method receives the original AST. The result is passed as-is to the
  output of `transform`.
  
  Args:
    fn: A function or lambda.
    user_context: An opaque object (may be None) that is forwarded to
      transform_ast, through the ctx.user_context argument.
  Returns:
    Tuple[Any, Any]. By default it returns the output of transform_ast,
    together with a `transformer.Context` containing information about the
    transformation process.
docstr_tok: ["Transforms","a","function",".","Subclasses","may","override","this","method",".","The","return","value","is","opaque",".","The","method","receives","the","original","AST",".","The","result","is","passed","as-is","to","the","output","of","`","transform","`",".","Args",":","fn",":","A","function","or","lambda",".","user_context",":","An","opaque","object","(","may","be","None",")","that","is","forwarded","to","transform_ast",",","through","the","ctx.user_context","argument",".","Returns",":","Tuple","[","Any",",","Any","]",".","By","default","it","returns","the","output","of","transform_ast",",","together","with","a","`","transformer.Context","`","containing","information","about","the","transformation","process","."]
code: def transform_function(self, fn, user_context):
      """Transforms a function.
  
      Subclasses may override this method. The return value is opaque.
  
      The method receives the original AST. The result is passed as-is to the
      output of `transform`.
  
      Args:
        fn: A function or lambda.
        user_context: An opaque object (may be None) that is forwarded to
          transform_ast, through the ctx.user_context argument.
      Returns:
        Tuple[Any, Any]. By default it returns the output of transform_ast,
        together with a `transformer.Context` containing information about the
        transformation process.
      """
      future_features = inspect_utils.getfutureimports(fn)
      node, source = parser.parse_entity(
          fn, future_features=future_features
      )
      logging.log(3, "Source code of %s:\n\n%s\n", fn, source)
  
      origin_info.resolve_entity(node, source, fn)
  
      namespace = inspect_utils.getnamespace(fn)
      namer = naming.Namer(namespace)
      new_name = namer.new_symbol(self.get_transformed_name(node), ())
      entity_info = transformer.EntityInfo(
          name=new_name,
          source_code=source,
          source_file="<fragment>",
          future_features=future_features,
          namespace=namespace,
      )
      context = transformer.Context(entity_info, namer, user_context)
  
      node = self._erase_arg_defaults(node)
      result = self.transform_ast(node, context)
  
      return result, context
  
imports: import inspect
  import threading
  import types
  import gast
  from nvidia.dali._autograph.pyct import cache
  from nvidia.dali._autograph.pyct import gast_util
  from nvidia.dali._autograph.pyct import inspect_utils
  from nvidia.dali._autograph.pyct import loader
  from nvidia.dali._autograph.pyct import naming
  from nvidia.dali._autograph.pyct import origin_info
  from nvidia.dali._autograph.pyct import parser
  from nvidia.dali._autograph.pyct import templates
  from nvidia.dali._autograph.pyct import transformer
  from nvidia.dali._autograph.utils import ag_logging
label_desc: Use image node_id 6 for calling the GenericTranspiler obj's underlying member method code with example usage: obj.transform_function(fn, user_context) and returns: result,  context