class_docstr: Backward differentiation formula (BDF) solver for stiff ODEs.
  
  Implements the solver described in [Shampine and Reichelt (1997)][1], a
  variable step size, variable order (VSVO) BDF integrator with order varying
  between 1 and 5.
  
  #### Algorithm details
  
  Each step involves solving the following nonlinear equation by Newton's
  method:
  ```none
  0 = 1/1 * BDF(1, y)[n+1] + ... + 1/k * BDF(k, y)[n+1]
    - h ode_fn(t[n+1], y[n+1])
    - bdf_coefficients[k-1] * (1/1 + ... + 1/k) * (y[n+1] - y[n] - BDF(1, y)[n]
                                                          -  ... - BDF(k, y)[n])
  ```
  where `k >= 1` is the current order of the integrator, `h` is the current step
  size, `bdf_coefficients` is a list of numbers that parameterizes the method,
  and `BDF(m, y)` is the `m`-th order backward difference of the vector `y`. In
  particular, `BDF(0, y)[n] = y[n]` and
  `BDF(m + 1, y)[n] = BDF(m, y)[n] - BDF(m, y)[n - 1]` for `m >= 0`.
  
  Newton's method can fail because
  * the method has exceeded the maximum number of iterations,
  * the method is converging too slowly, or
  * the method is not expected to converge
  (the last two conditions are determined by approximating the Lipschitz
  constant associated with the iteration).
  
  When `evaluate_jacobian_lazily` is `True`, the solver avoids evaluating the
  Jacobian of the dynamics function as much as possible. In particular, Newton's
  method will try to use the Jacobian from a previous integration step. If
  Newton's method fails with an out-of-date Jacobian, the Jacobian is
  re-evaluated and Newton's method is restarted. If Newton's method fails and
  the Jacobian is already up-to-date, then the step size is decreased and
  Newton's method is restarted.
  
  Even if Newton's method converges, the solution it generates can still be
  rejected if it exceeds the specified error tolerance due to truncation error.
  In this case, the step size is decreased and Newton's method is restarted.
  
  #### References
  
  [1]: Lawrence F. Shampine and Mark W. Reichelt. The MATLAB ODE Suite. _SIAM
       Journal on Scientific Computing_ 18(1):1-22, 1997.
class_docstr_tok: ["Backward","differentiation","formula","(","BDF",")","solver","for","stiff","ODEs",".","Implements","the","solver","described","in","[","Shampine","and","Reichelt","(","1997",")","]","[","1","]",",","a","variable","step","size",",","variable","order","(","VSVO",")","BDF","integrator","with","order","varying","between","1","and","5",".","#","#","#","#","Algorithm","details","Each","step","involves","solving","the","following","nonlinear","equation","by","Newton's","method",":","``","`","none","0","=","1\/1","*","BDF","(","1",",","y",")","[","n+1","]","+","...","+","1\/k","*","BDF","(","k",",","y",")","[","n+1","]","-","h","ode_fn","(","t","[","n+1","]",",","y","[","n+1","]",")","-","bdf_coefficients","[","k-1","]","*","(","1\/1","+","...","+","1\/k",")","*","(","y","[","n+1","]","-","y","[","n","]","-","BDF","(","1",",","y",")","[","n","]","-","...","-","BDF","(","k",",","y",")","[","n","]",")","``","`","where","`","k",">","=","1","`","is","the","current","order","of","the","integrator",",","`","h","`","is","the","current","step","size",",","`","bdf_coefficients","`","is","a","list","of","numbers","that","parameterizes","the","method",",","and","`","BDF","(","m",",","y",")","`","is","the","`","m","`","-th","order","backward","difference","of","the","vector","`","y","`",".","In","particular",",","`","BDF","(","0",",","y",")","[","n","]","=","y","[","n","]","`","and","`","BDF","(","m","+","1",",","y",")","[","n","]","=","BDF","(","m",",","y",")","[","n","]","-","BDF","(","m",",","y",")","[","n","-","1","]","`","for","`","m",">","=","0","`",".","Newton","'s","method","can","fail","because","*","the","method","has","exceeded","the","maximum","number","of","iterations",",","*","the","method","is","converging","too","slowly",",","or","*","the","method","is","not","expected","to","converge","(","the","last","two","conditions","are","determined","by","approximating","the","Lipschitz","constant","associated","with","the","iteration",")",".","When","`","evaluate_jacobian_lazily","`","is","`","True","`",",","the","solver","avoids","evaluating","the","Jacobian","of","the","dynamics","function","as","much","as","possible",".","In","particular",",","Newton's","method","will","try","to","use","the","Jacobian","from","a","previous","integration","step",".","If","Newton","'s","method","fails","with","an","out-of-date","Jacobian",",","the","Jacobian","is","re-evaluated","and","Newton","'s","method","is","restarted",".","If","Newton","'s","method","fails","and","the","Jacobian","is","already","up-to-date",",","then","the","step","size","is","decreased","and","Newton","'s","method","is","restarted",".","Even","if","Newton","'s","method","converges",",","the","solution","it","generates","can","still","be","rejected","if","it","exceeds","the","specified","error","tolerance","due","to","truncation","error",".","In","this","case",",","the","step","size","is","decreased","and","Newton","'s","method","is","restarted",".","#","#","#","#","References","[","1","]",":","Lawrence","F.","Shampine","and","Mark","W.","Reichelt",".","The","MATLAB","ODE","Suite",".","_SIAM","Journal","on","Scientific","Computing_","18","(","1",")",":1-22",",","1997","."]
docstr: Creates a list of assert operations.
docstr_tok: ["Creates","a","list","of","assert","operations","."]
code: def _assert_ops(
      self,
      previous_solver_internal_state,
      initial_state_vec,
      final_time,
      initial_time,
      solution_times,
      max_num_steps,
      max_num_newton_iters,
      atol,
      rtol,
      first_step_size,
      safety_factor,
      min_step_size_factor,
      max_step_size_factor,
      max_order,
      newton_tol_factor,
      newton_step_size_factor,
      solution_times_chosen_by_solver,
  ):
      """Creates a list of assert operations."""
      if not self._validate_args:
          return []
      assert_ops = []
      if previous_solver_internal_state is not None:
          assert_initial_state_matches_previous_solver_internal_state = tf.debugging.assert_near(
              tf.norm(
                  initial_state_vec
                  - previous_solver_internal_state.backward_differences[
                      0
                  ],
                  np.inf,
              ),
              0.0,
              message="`previous_solver_internal_state` does not match "
              "`initial_state`.",
          )
          assert_ops.append(
              assert_initial_state_matches_previous_solver_internal_state
          )
      assert_ops.append(
          util.assert_positive(
              final_time - initial_time, "final_time - initial_time"
          )
      )
      if not solution_times_chosen_by_solver:
          assert_ops += [
              util.assert_increasing(solution_times, "solution_times"),
              util.assert_nonnegative(
                  solution_times[0] - initial_time,
                  "solution_times[0] - initial_time",
              ),
          ]
      if max_num_steps is not None:
          assert_ops.append(
              util.assert_positive(max_num_steps, "max_num_steps")
          )
      if max_num_newton_iters is not None:
          assert_ops.append(
              util.assert_positive(
                  max_num_newton_iters, "max_num_newton_iters"
              )
          )
      assert_ops += [
          util.assert_positive(rtol, "rtol"),
          util.assert_positive(atol, "atol"),
          util.assert_positive(first_step_size, "first_step_size"),
          util.assert_positive(safety_factor, "safety_factor"),
          util.assert_positive(
              min_step_size_factor, "min_step_size_factor"
          ),
          util.assert_positive(
              max_step_size_factor, "max_step_size_factor"
          ),
          tf.Assert(
              (max_order >= 1) & (max_order <= bdf_util.MAX_ORDER),
              [
                  "`max_order` must be between 1 and {}.".format(
                      bdf_util.MAX_ORDER
                  )
              ],
          ),
          util.assert_positive(newton_tol_factor, "newton_tol_factor"),
          util.assert_positive(
              newton_step_size_factor, "newton_step_size_factor"
          ),
      ]
      return assert_ops
  
imports: import collections
  import functools
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math.ode import base
  from tensorflow_probability.python.math.ode import bdf_util
  from tensorflow_probability.python.math.ode import util
label_desc: Use image node_id 6 for calling the BDF obj's underlying member method code with example usage: obj._assert_ops(previous_solver_internal_state, initial_state_vec, final_time, initial_time, solution_times, max_num_steps, max_num_newton_iters, atol, rtol, first_step_size, safety_factor, min_step_size_factor, max_step_size_factor, max_order, newton_tol_factor, newton_step_size_factor, solution_times_chosen_by_solver) and returns: assert_ops, list