parameters: (self, args, kwargs)
docstring: Gets a function for these inputs, defining it if necessary.
  
      `args` and `kwargs` can be None if this `Function` was created with an
      `input_signature`.
  
      Caller must hold self._lock.
  
      Args:
        args: The varargs for the Python function.
        kwargs: The keyword args for the Python function.
  
      Returns:
        A graph function corresponding to the input signature implied by args and
        kwargs, as well as filtered flattened inputs (only Tensors and Variables)
        that the object should be called with.
  
      Raises:
        ValueError: If inputs are incompatible with the input signature.
        TypeError: If the function inputs include non-hashable objects
        RuntimeError: If there's an internal bug (inconsistency) in handling
          shape relaxation retracing.
docstring_summary: Gets a function for these inputs, defining it if necessary.
docstring_tokens: Gets a function for these inputs defining it if necessary .
function: def _maybe_define_function(self, args, kwargs):
      """Gets a function for these inputs, defining it if necessary.
  
      `args` and `kwargs` can be None if this `Function` was created with an
      `input_signature`.
  
      Caller must hold self._lock.
  
      Args:
        args: The varargs for the Python function.
        kwargs: The keyword args for the Python function.
  
      Returns:
        A graph function corresponding to the input signature implied by args and
        kwargs, as well as filtered flattened inputs (only Tensors and Variables)
        that the object should be called with.
  
      Raises:
        ValueError: If inputs are incompatible with the input signature.
        TypeError: If the function inputs include non-hashable objects
        RuntimeError: If there's an internal bug (inconsistency) in handling
          shape relaxation retracing.
      """
      if self.input_signature is None or args is not None or kwargs is not None:
        args, kwargs, filtered_flat_args = (
            self._function_spec.canonicalize_function_inputs(*args, **kwargs))
      else:
        filtered_flat_args = []
  
      if self.input_signature is None:
        cache_key, cache_key_deletion_observer = function_cache.make_cache_key(
            (args, kwargs))
      else:
        cache_key, cache_key_deletion_observer = function_cache.make_cache_key(
            self.flat_input_signature)
  
      try:
        hash(cache_key)
      except TypeError as e:
        raise TypeError(
            "Arguments supplied to `defun`-generated functions must be "
            f"hashable.  Original error: {e}.")
  
      graph_function = self._function_cache.lookup(cache_key,
                                                   USE_FUNCTION_SUBTYPING)
      if graph_function is not None:
        return graph_function, filtered_flat_args
  
      with monitoring.MonitoredTimer(_graph_building_time_counter.get_cell()):
        with trace.Trace("tf.function-graph_building"):
          logging.vlog(1,
                       "Creating new FuncGraph for Python function %r (key: %r)",
                       self._python_function, cache_key)
          logging.vlog(2, "Python function signature [args: %s] [kwargs: %s]",
                       args, kwargs)
  
          ag_status = (
              ag_ctx.Status.ENABLED
              if self._autograph else ag_ctx.Status.DISABLED)
          with ag_ctx.ControlStatusCtx(
              status=ag_status, options=self._autograph_options):
  
            # Build a function with shape relaxation retracing if:
            # 1. shape relaxation is explicitly enabled
            # and 2. there's no provided input signature
            # and 3. there's been a cache miss for this calling context
            if (self._experimental_relax_shapes and
                self.input_signature is None and
                self._function_cache.has_call_context(cache_key.call_context)):
              return (self._graph_function_with_shape_relaxation(args, kwargs),
                      filtered_flat_args)
  
            self._function_cache.add_call_context(cache_key.call_context)
            graph_function = self._create_graph_function(args, kwargs)
            self._function_cache.add(cache_key, cache_key_deletion_observer,
                                     graph_function)
  
            return graph_function, filtered_flat_args
function_tokens: def _maybe_define_function ( self , args , kwargs ) : if self . input_signature is None or args is not None or kwargs is not None : args , kwargs , filtered_flat_args = ( self . _function_spec . canonicalize_function_inputs ( * args , * * kwargs ) ) else : filtered_flat_args = [ ] if self . input_signature is None : cache_key , cache_key_deletion_observer = function_cache . make_cache_key ( ( args , kwargs ) ) else : cache_key , cache_key_deletion_observer = function_cache . make_cache_key ( self . flat_input_signature ) try : hash ( cache_key ) except TypeError as e : raise TypeError ( "Arguments supplied to `defun`-generated functions must be " f"hashable.  Original error: {e}." ) graph_function = self . _function_cache . lookup ( cache_key , USE_FUNCTION_SUBTYPING ) if graph_function is not None : return graph_function , filtered_flat_args with monitoring . MonitoredTimer ( _graph_building_time_counter . get_cell ( ) ) : with trace . Trace ( "tf.function-graph_building" ) : logging . vlog ( 1 , "Creating new FuncGraph for Python function %r (key: %r)" , self . _python_function , cache_key ) logging . vlog ( 2 , "Python function signature [args: %s] [kwargs: %s]" , args , kwargs ) ag_status = ( ag_ctx . Status . ENABLED if self . _autograph else ag_ctx . Status . DISABLED ) with ag_ctx . ControlStatusCtx ( status = ag_status , options = self . _autograph_options ) : # Build a function with shape relaxation retracing if: # 1. shape relaxation is explicitly enabled # and 2. there's no provided input signature # and 3. there's been a cache miss for this calling context if ( self . _experimental_relax_shapes and self . input_signature is None and self . _function_cache . has_call_context ( cache_key . call_context ) ) : return ( self . _graph_function_with_shape_relaxation ( args , kwargs ) , filtered_flat_args ) self . _function_cache . add_call_context ( cache_key . call_context ) graph_function = self . _create_graph_function ( args , kwargs ) self . _function_cache . add ( cache_key , cache_key_deletion_observer , graph_function ) return graph_function , filtered_flat_args