code: def _apply_parameters(generator, *raw_parameters):
      """Runs the generator with the given parameter values and returns the result.
  
      Args:
        generator: Python generator that yields initialization callables
          (which take a `seed` and return a (structure of) `Tensor`(s)),
          returns a value, and has no side effects. See module description.
        *raw_parameters: iterable of `Tensor` (or structure of `Tensor`) parameter
          values, of length corresponding to the number of `yield` invocations
          made by the generator. Alternately, a length-1 tuple containing such
          an iterable.
      Returns:
        retval: the value returned by the generator when run with the given
          parameters.
      """
      raw_parameters = _sanitize_parameters(*raw_parameters)
      gen = generator()
      if not isinstance(gen, types.GeneratorType):
          raise ValueError(
              "Expected generator but saw function: {}. A generator "
              "must contain at least one `yield` statement. To define a "
              "trivial generator, which yields zero times, a `yield` "
              "statement may be placed after `return`, but must still "
              "be present.".format(generator)
          )
      try:
          parameter = next(gen)
          for param_value in raw_parameters:
              if parameter.constraining_bijector is not None:
                  param_value = parameter.constraining_bijector.forward(
                      # Disable bijector cache so that gradients are defined.
                      tf.nest.map_structure(tf.identity, param_value)
                  )
              parameter = gen.send(param_value)
      except StopIteration as e:
          return e.value
      raise ValueError(
          "Insufficient parameters provided for generator {}. Saw "
          "parameters: {}.".format(gen, raw_parameters)
      )
  
file_path: probability/tensorflow_probability/python/internal/trainable_state_util.py
imports: import collections
  import functools
  import inspect
  import re
  import types
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import structural_tuple
label_desc: Use image node_id 5 for calling a global function with example usage: _apply_parameters(generator) and returns: e