class_docstr: Base class for stopping rules.
  
  A convergence criterion determines when an optimization has converged given
  its history of losses, gradients, and parameter values. Each criterion is
  responsible for propagating from step to step whatever state it needs to
  represent the relevant aspects of that history (for example, a moving average
  of previous loss values or gradients). In particular, subclasses must
  implement:
  
  - `_bootstrap(loss, grads, parameters)`: takes the
    initial loss, gradients, and values of parameters, and returns a (structure
    of) `Tensor`(s) representing the initial values of any auxiliary quantities
    tracked by the convergence criterion.
  - `_one_step(step, loss, grads, window_size, auxiliary_state)`: At
    integer `step >= 1`,
    takes the current loss, gradients, and values of parameters, along with
    any auxiliary state carried over from the previous step, and returns
    `(has_converged, updated_auxiliary_state)`, where `has_converged` is a
    boolean `Tensor`, and `updated_auxiliary_state` is a (structure of)
    Tensor(s) matching `auxiliary_state`, containing whatever information must
    be propagated to the next timestep.
docstr: Returns a structure of `Tensors` for the rule's state at step 0.
  
  The shape of the `Tensor`s specifying `loss`, `grads`, and `parameters` may
  optionally be prefixed by one or more batch dimension(s).
  
  Args:
    loss: float `Tensor` initial value of loss being optimized.
    grads: list of float `Tensor` gradients of `loss` wrt `parameters`.
    parameters: list of float `Tensor` initial values of parameters
      being optimized.
  Returns:
    initial_auxiliary_state: (Structure of) `Tensor`(s) representing the
      initial auxiliary state carried forward by this criterion.
docstr_tok: ["Returns","a","structure","of","`","Tensors","`","for","the","rule","'s","state","at","step","0",".","The","shape","of","the","`","Tensor","`","s","specifying","`","loss","`",",","`","grads","`",",","and","`","parameters","`","may","optionally","be","prefixed","by","one","or","more","batch","dimension","(","s",")",".","Args",":","loss",":","float","`","Tensor","`","initial","value","of","loss","being","optimized",".","grads",":","list","of","float","`","Tensor","`","gradients","of","`","loss","`","wrt","`","parameters","`",".","parameters",":","list","of","float","`","Tensor","`","initial","values","of","parameters","being","optimized",".","Returns",":","initial_auxiliary_state",":","(","Structure","of",")","`","Tensor","`","(","s",")","representing","the","initial","auxiliary","state","carried","forward","by","this","criterion","."]
code: def bootstrap(self, loss, grads, parameters):
      """Returns a structure of `Tensors` for the rule's state at step 0.
  
      The shape of the `Tensor`s specifying `loss`, `grads`, and `parameters` may
      optionally be prefixed by one or more batch dimension(s).
  
      Args:
        loss: float `Tensor` initial value of loss being optimized.
        grads: list of float `Tensor` gradients of `loss` wrt `parameters`.
        parameters: list of float `Tensor` initial values of parameters
          being optimized.
      Returns:
        initial_auxiliary_state: (Structure of) `Tensor`(s) representing the
          initial auxiliary state carried forward by this criterion.
      """
      with tf.name_scope(self.name):
          return self._bootstrap(
              loss=tf.convert_to_tensor(loss),
              grads=(
                  tf.nest.map_structure(tf.convert_to_tensor, grads)
                  if grads is not None
                  else grads
              ),
              parameters=tf.nest.map_structure(
                  tf.convert_to_tensor, parameters
              ),
          )
  
file_path: probability/tensorflow_probability/python/optimizer/convergence_criteria/convergence_criterion.py
imports: import tensorflow.compat.v2
label_desc: Use image node_id 4 for calling the ConvergenceCriterion obj's underlying member method code with example usage: obj.bootstrap(loss, grads, parameters) and returns: self