class_docstr: Dormand-Prince explicit solver for non-stiff ODEs.
  
  Implements 5th order Runge-Kutta with adaptive step size control
  and dense output, using the Dormand-Prince method. Similar to the 'dopri5'
  method of `scipy.integrate.ode` and MATLAB's `ode45`. For details see [1].
  For solver API see `tfp.math.ode.Solver`.
  
  #### References
  
  [1]: Shampine, L. F. (1986). Some practical runge-kutta formulas.
      Mathematics of Computation, 46(173), 135-150, doi:10.2307/2008219
class_docstr_tok: ["Dormand-Prince","explicit","solver","for","non-stiff","ODEs",".","Implements","5th","order","Runge-Kutta","with","adaptive","step","size","control","and","dense","output",",","using","the","Dormand-Prince","method",".","Similar","to","the","'dopri5'","method","of","`","scipy.integrate.ode","`","and","MATLAB","'s","`","ode45","`",".","For","details","see","[","1","]",".","For","solver","API","see","`","tfp.math.ode.Solver","`",".","#","#","#","#","References","[","1","]",":","Shampine",",","L.","F.","(","1986",")",".","Some","practical","runge-kutta","formulas",".","Mathematics","of","Computation",",","46","(","173",")",",","135-150",",","doi:10.2307\/2008219"]
docstr: Initializes the solver.
  
  Args:
    rtol: Optional float `Tensor` specifying an upper bound on relative error,
      per element of the dependent variable. The error tolerance for the next
      step is `tol = atol + rtol * abs(state)` where `state` is the computed
      state at the current step (see also `atol`). The next step is rejected
      if it incurs a local truncation error larger than `tol`.
      Default value: `1e-3`.
    atol: Optional float `Tensor` specifying an upper bound on absolute error,
      per element of the dependent variable (see also `rtol`).
      Default value: `1e-6`.
    first_step_size: Scalar float `Tensor` specifying the size of the
      first step.
      Default value: `1e-3`.
    safety_factor: Scalar positive float `Tensor`. At the end of every Runge
      Kutta step, the solver may choose to update the step size by applying a
      multiplicative factor to the current step size. This factor is `factor =
      clamp(factor_unclamped, min_step_size_factor, max_step_size_factor)`
      where `factor_unclamped = error_ratio**(-1. / (order + 1)) *
      safety_factor` (see also `min_step_size_factor` and
      `max_step_size_factor`). A small (respectively, large) value for the
      safety factor causes the solver to take smaller (respectively, larger)
      step sizes. A value larger than one, though not explicitly prohibited,
      is discouraged.
      Default value: `0.9`.
    min_step_size_factor: Scalar float `Tensor` (see `safety_factor`).
      Default value: `0.1`.
    max_step_size_factor: Scalar float `Tensor` (see `safety_factor`).
      Default value: `10.`.
    max_num_steps: Optional scalar integer `Tensor` specifying the maximum
      number of steps allowed (including rejected steps). If unspecified,
      there is no upper bound on the number of steps.
      Default value: `None`.
    make_adjoint_solver_fn: Callable that takes no arguments that constructs a
      `Solver` instance. The created solver is used in the adjoint senstivity
      analysis to compute gradients (if they are requested).
      Default value: A callable that returns this solver.
    validate_args: Whether to validate input with asserts. If `validate_args`
      is `False` and the inputs are invalid, correct behavior is not
      guaranteed.
      Default value: `False`.
    name: Python `str` name prefixed to Ops created by this function.
      Default value: `None` (i.e., 'dormand_prince').
docstr_tok: ["Initializes","the","solver",".","Args",":","rtol",":","Optional","float","`","Tensor","`","specifying","an","upper","bound","on","relative","error",",","per","element","of","the","dependent","variable",".","The","error","tolerance","for","the","next","step","is","`","tol","=","atol","+","rtol","*","abs","(","state",")","`","where","`","state","`","is","the","computed","state","at","the","current","step","(","see","also","`","atol","`",")",".","The","next","step","is","rejected","if","it","incurs","a","local","truncation","error","larger","than","`","tol","`",".","Default","value",":","`","1e-3","`",".","atol",":","Optional","float","`","Tensor","`","specifying","an","upper","bound","on","absolute","error",",","per","element","of","the","dependent","variable","(","see","also","`","rtol","`",")",".","Default","value",":","`","1e-6","`",".","first_step_size",":","Scalar","float","`","Tensor","`","specifying","the","size","of","the","first","step",".","Default","value",":","`","1e-3","`",".","safety_factor",":","Scalar","positive","float","`","Tensor","`",".","At","the","end","of","every","Runge","Kutta","step",",","the","solver","may","choose","to","update","the","step","size","by","applying","a","multiplicative","factor","to","the","current","step","size",".","This","factor","is","`","factor","=","clamp","(","factor_unclamped",",","min_step_size_factor",",","max_step_size_factor",")","`","where","`","factor_unclamped","=","error_ratio","*","*","(","-1",".","\/","(","order","+","1",")",")","*","safety_factor","`","(","see","also","`","min_step_size_factor","`","and","`","max_step_size_factor","`",")",".","A","small","(","respectively",",","large",")","value","for","the","safety","factor","causes","the","solver","to","take","smaller","(","respectively",",","larger",")","step","sizes",".","A","value","larger","than","one",",","though","not","explicitly","prohibited",",","is","discouraged",".","Default","value",":","`","0.9","`",".","min_step_size_factor",":","Scalar","float","`","Tensor","`","(","see","`","safety_factor","`",")",".","Default","value",":","`","0.1","`",".","max_step_size_factor",":","Scalar","float","`","Tensor","`","(","see","`","safety_factor","`",")",".","Default","value",":","`","10.","`",".","max_num_steps",":","Optional","scalar","integer","`","Tensor","`","specifying","the","maximum","number","of","steps","allowed","(","including","rejected","steps",")",".","If","unspecified",",","there","is","no","upper","bound","on","the","number","of","steps",".","Default","value",":","`","None","`",".","make_adjoint_solver_fn",":","Callable","that","takes","no","arguments","that","constructs","a","`","Solver","`","instance",".","The","created","solver","is","used","in","the","adjoint","senstivity","analysis","to","compute","gradients","(","if","they","are","requested",")",".","Default","value",":","A","callable","that","returns","this","solver",".","validate_args",":","Whether","to","validate","input","with","asserts",".","If","`","validate_args","`","is","`","False","`","and","the","inputs","are","invalid",",","correct","behavior","is","not","guaranteed",".","Default","value",":","`","False","`",".","name",":","Python","`","str","`","name","prefixed","to","Ops","created","by","this","function",".","Default","value",":","`","None","`","(","i.e.",",","'dormand_prince","'",")","."]
code: def __init__(
      self,
      rtol=1e-3,
      atol=1e-6,
      first_step_size=1e-3,
      safety_factor=0.9,
      min_step_size_factor=0.1,
      max_step_size_factor=10.0,
      max_num_steps=None,
      make_adjoint_solver_fn=None,
      validate_args=False,
      name="dormand_prince",
  ):
      """Initializes the solver.
  
      Args:
        rtol: Optional float `Tensor` specifying an upper bound on relative error,
          per element of the dependent variable. The error tolerance for the next
          step is `tol = atol + rtol * abs(state)` where `state` is the computed
          state at the current step (see also `atol`). The next step is rejected
          if it incurs a local truncation error larger than `tol`.
          Default value: `1e-3`.
        atol: Optional float `Tensor` specifying an upper bound on absolute error,
          per element of the dependent variable (see also `rtol`).
          Default value: `1e-6`.
        first_step_size: Scalar float `Tensor` specifying the size of the
          first step.
          Default value: `1e-3`.
        safety_factor: Scalar positive float `Tensor`. At the end of every Runge
          Kutta step, the solver may choose to update the step size by applying a
          multiplicative factor to the current step size. This factor is `factor =
          clamp(factor_unclamped, min_step_size_factor, max_step_size_factor)`
          where `factor_unclamped = error_ratio**(-1. / (order + 1)) *
          safety_factor` (see also `min_step_size_factor` and
          `max_step_size_factor`). A small (respectively, large) value for the
          safety factor causes the solver to take smaller (respectively, larger)
          step sizes. A value larger than one, though not explicitly prohibited,
          is discouraged.
          Default value: `0.9`.
        min_step_size_factor: Scalar float `Tensor` (see `safety_factor`).
          Default value: `0.1`.
        max_step_size_factor: Scalar float `Tensor` (see `safety_factor`).
          Default value: `10.`.
        max_num_steps: Optional scalar integer `Tensor` specifying the maximum
          number of steps allowed (including rejected steps). If unspecified,
          there is no upper bound on the number of steps.
          Default value: `None`.
        make_adjoint_solver_fn: Callable that takes no arguments that constructs a
          `Solver` instance. The created solver is used in the adjoint senstivity
          analysis to compute gradients (if they are requested).
          Default value: A callable that returns this solver.
        validate_args: Whether to validate input with asserts. If `validate_args`
          is `False` and the inputs are invalid, correct behavior is not
          guaranteed.
          Default value: `False`.
        name: Python `str` name prefixed to Ops created by this function.
          Default value: `None` (i.e., 'dormand_prince').
      """
      super(DormandPrince, self).__init__(
          make_adjoint_solver_fn=make_adjoint_solver_fn,
          validate_args=validate_args,
          name=name,
      )
      # The default values of `rtol` and `atol` match `scipy.integrate.solve_ivp`.
      self._rtol = rtol
      self._atol = atol
      self._safety_factor = safety_factor
      # TODO(dkochkov) Add option to choose initial step size automatically.
      self._first_step_size = first_step_size
      self._min_step_size_factor = min_step_size_factor
      self._max_step_size_factor = max_step_size_factor
      self._max_num_steps = max_num_steps
  
imports: import collections
  import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.math.ode import base
  from tensorflow_probability.python.math.ode import runge_kutta_util
  from tensorflow_probability.python.math.ode import util
  from tensorflow.python.util import nest
label_desc: Use image node_id 1 to create a new DormandPrince object from inherited base classes: base with example: obj = DormandPrince(rtol, atol, first_step_size, safety_factor, min_step_size_factor, max_step_size_factor, max_num_steps, make_adjoint_solver_fn, validate_args, name)