code: def __init__(
      self,
      func,
      y0,
      rtol,
      atol,
      min_step=0,
      max_step=float("inf"),
      first_step=None,
      step_t=None,
      jump_t=None,
      safety=0.9,
      ifactor=10.0,
      dfactor=0.2,
      max_num_steps=2**31 - 1,
      dtype=torch.float64,
      **kwargs,
  ):
      super(RKAdaptiveStepsizeODESolver, self).__init__(
          dtype=dtype, y0=y0, **kwargs
      )
  
      # We use mixed precision. y has its original dtype (probably float32), whilst all 'time'-like objects use
      # `dtype` (defaulting to float64).
      dtype = torch.promote_types(dtype, y0.abs().dtype)
      device = y0.device
  
      self.func = func
      self.rtol = torch.as_tensor(rtol, dtype=dtype, device=device)
      self.atol = torch.as_tensor(atol, dtype=dtype, device=device)
      self.min_step = torch.as_tensor(
          min_step, dtype=dtype, device=device
      )
      self.max_step = torch.as_tensor(
          max_step, dtype=dtype, device=device
      )
      self.first_step = (
          None
          if first_step is None
          else torch.as_tensor(first_step, dtype=dtype, device=device)
      )
      self.safety = torch.as_tensor(safety, dtype=dtype, device=device)
      self.ifactor = torch.as_tensor(
          ifactor, dtype=dtype, device=device
      )
      self.dfactor = torch.as_tensor(
          dfactor, dtype=dtype, device=device
      )
      self.max_num_steps = torch.as_tensor(
          max_num_steps, dtype=torch.int32, device=device
      )
      self.dtype = dtype
  
      self.step_t = (
          None
          if step_t is None
          else torch.as_tensor(step_t, dtype=dtype, device=device)
      )
      self.jump_t = (
          None
          if jump_t is None
          else torch.as_tensor(jump_t, dtype=dtype, device=device)
      )
  
      # Copy from class to instance to set device
      self.tableau = _ButcherTableau(
          alpha=self.tableau.alpha.to(device=device, dtype=y0.dtype),
          beta=[
              b.to(device=device, dtype=y0.dtype)
              for b in self.tableau.beta
          ],
          c_sol=self.tableau.c_sol.to(device=device, dtype=y0.dtype),
          c_error=self.tableau.c_error.to(
              device=device, dtype=y0.dtype
          ),
      )
      self.mid = self.mid.to(device=device, dtype=y0.dtype)
  
imports: import bisect
  import collections
  import torch
  from .event_handling import find_event
  from .interp import _interp_evaluate, _interp_fit
  from .misc import _compute_error_ratio, _select_initial_step, _optimal_step_size
  from .misc import Perturb
  from .solvers import AdaptiveStepsizeEventODESolver
label_desc: Use image node_id 1 to create a new RKAdaptiveStepsizeODESolver object from inherited base classes: AdaptiveStepsizeEventODESolver with example: obj = RKAdaptiveStepsizeODESolver(func, y0, rtol, atol, min_step, max_step, first_step, step_t, jump_t, safety, ifactor, dfactor, max_num_steps, dtype)