(structure, *args, **kwargs)
return tree.map_structure(
      lambda x: x(*args, **kwargs) if callable(x) else x, structure)
Evaluates a arbitrarily nested structure of callables or constant values.

  Args:
    structure: An arbitrarily nested structure of callables or constant values.
      By "structures", we mean lists, tuples, namedtuples, or dicts.
    *args: Positional arguments passed to each callable in `structure`.
    **kwargs: Keyword arguments passed to each callable in `structure.

  Returns:
    The same nested structure, with each callable replaced by the value returned
    by calling it.
Evaluates a arbitrarily nested structure of callables or constant values.
Evaluates a arbitrarily nested structure of callables or constant values .
def evaluate(structure, *args, **kwargs):
  """Evaluates a arbitrarily nested structure of callables or constant values.

  Args:
    structure: An arbitrarily nested structure of callables or constant values.
      By "structures", we mean lists, tuples, namedtuples, or dicts.
    *args: Positional arguments passed to each callable in `structure`.
    **kwargs: Keyword arguments passed to each callable in `structure.

  Returns:
    The same nested structure, with each callable replaced by the value returned
    by calling it.
  """
  return tree.map_structure(
      lambda x: x(*args, **kwargs) if callable(x) else x, structure)
def evaluate ( structure , * args , * * kwargs ) : return tree . map_structure ( lambda x : x ( * args , * * kwargs ) if callable ( x ) else x , structure )