class_docstr: Adapts tunable parameters, namely step size and mass matrix, during the
  warmup phase. This class provides lookup properties to read the latest
  values of ``step_size`` and ``inverse_mass_matrix``. These values are
  periodically updated when adaptation is engaged.
class_docstr_tok: ["Adapts","tunable","parameters",",","namely","step","size","and","mass","matrix",",","during","the","warmup","phase",".","This","class","provides","lookup","properties","to","read","the","latest","values","of","``","step_size","``","and","``","inverse_mass_matrix","``",".","These","values","are","periodically","updated","when","adaptation","is","engaged","."]
code: def __init__(
      self,
      step_size=1,
      adapt_step_size=False,
      target_accept_prob=0.8,
      adapt_mass_matrix=False,
      dense_mass=False,
  ):
      self.adapt_step_size = adapt_step_size
      self.adapt_mass_matrix = adapt_mass_matrix
      self.target_accept_prob = target_accept_prob
      self.dense_mass = dense_mass
      self.step_size = 1 if step_size is None else step_size
      self._init_step_size = self.step_size
      self._adaptation_disabled = not (
          adapt_step_size or adapt_mass_matrix
      )
      if adapt_step_size:
          self._step_size_adapt_scheme = DualAveraging()
      self._mass_matrix_adapter = BlockMassMatrix()
  
      # We separate warmup_steps into windows:
      #   start_buffer + window 1 + window 2 + window 3 + ... + end_buffer
      # where the length of each window will be doubled for the next window.
      # We won't adapt mass matrix during start and end buffers; and mass
      # matrix will be updated at the end of each window. This is helpful
      # for dealing with the intense computation of sampling momentum from the
      # inverse of mass matrix.
      self._adapt_start_buffer = 75  # from Stan
      self._adapt_end_buffer = 50  # from Stan
      self._adapt_initial_window = 25  # from Stan
  
      # configured later on setup
      self._warmup_steps = None
      self._adaptation_schedule = []
  
imports: import math
  from collections import namedtuple
  import torch
  import pyro
  from pyro.ops.arrowhead import SymmArrowhead, sqrt, triu_gram, triu_inverse, triu_matvecmul
  from pyro.ops.dual_averaging import DualAveraging
  from pyro.ops.welford import WelfordArrowheadCovariance, WelfordCovariance
label_desc: Use image node_id 1 to create a new WarmupAdapter object  with example: obj = WarmupAdapter(step_size, adapt_step_size, target_accept_prob, adapt_mass_matrix, dense_mass)