class_docstr: Helper object that wraps a Python function factory.
class_docstr_tok: ["Helper","object","that","wraps","a","Python","function","factory","."]
docstr: Creates a new function instance.
docstr_tok: ["Creates","a","new","function","instance","."]
code: def instantiate(
      self, globals_, closure, defaults=None, kwdefaults=None
  ):
      """Creates a new function instance."""
      if self._unbound_factory is None:
          raise ValueError("call create first")
  
      factory_code = self._unbound_factory.__code__
      factory_freevars = factory_code.co_freevars
      closure_map = dict(zip(self._freevars, closure))
      factory_closure = tuple(
          closure_map[name] for name in factory_code.co_freevars
      )
      if len(factory_closure) != len(closure):
          raise ValueError(
              "closure mismatch, requested {}, but source function had {}".format(
                  self._freevars, factory_freevars
              )
          )
  
      bound_factory = types.FunctionType(
          code=factory_code,
          globals=globals_,
          name=self._name,
          argdefs=(),
          closure=factory_closure,
      )
  
      # The lint override is a false positive.
      new_fn = bound_factory(
          **self._extra_locals
      )  # pylint:disable=not-callable
  
      if defaults:
          new_fn.__defaults__ = defaults
      if kwdefaults:
          new_fn.__kwdefaults__ = kwdefaults
  
      return new_fn
  
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 3 for calling the _PythonFnFactory obj's underlying member method code with example usage: obj.instantiate(globals_, closure, defaults, kwdefaults) and returns: new_fn