class_docstr: EXPERIMENTAL This class is used to adapt (inverse) mass matrix and provide useful
  methods to calculate algebraic terms which involves the mass matrix.
  
  The mass matrix will have arrowhead structure, with the head including all
  dense sites specified in the argument `full_mass` of the HMC/NUTS kernels.
  
  :param float init_scale: initial scale to construct the initial mass matrix.
class_docstr_tok: ["EXPERIMENTAL","This","class","is","used","to","adapt","(","inverse",")","mass","matrix","and","provide","useful","methods","to","calculate","algebraic","terms","which","involves","the","mass","matrix",".","The","mass","matrix","will","have","arrowhead","structure",",","with","the","head","including","all","dense","sites","specified","in","the","argument","`","full_mass","`","of","the","HMC\/NUTS","kernels",".",":","param","float","init_scale",":","initial","scale","to","construct","the","initial","mass","matrix","."]
docstr: Sets up an initial mass matrix.
  
  :param dict mass_matrix_shape: a dict that maps tuples of site names to the shape of
      the corresponding mass matrix. Each tuple of site names corresponds to a block.
  :param bool adapt_mass_matrix: a flag to decide whether an adaptation scheme will be used.
  :param dict options: tensor options to construct the initial mass matrix.
docstr_tok: ["Sets","up","an","initial","mass","matrix",".",":","param","dict","mass_matrix_shape",":","a","dict","that","maps","tuples","of","site","names","to","the","shape","of","the","corresponding","mass","matrix",".","Each","tuple","of","site","names","corresponds","to","a","block",".",":","param","bool","adapt_mass_matrix",":","a","flag","to","decide","whether","an","adaptation","scheme","will","be","used",".",":","param","dict","options",":","tensor","options","to","construct","the","initial","mass","matrix","."]
code: def configure(
      self, mass_matrix_shape, adapt_mass_matrix=True, options={}
  ):
      """
      Sets up an initial mass matrix.
  
      :param dict mass_matrix_shape: a dict that maps tuples of site names to the shape of
          the corresponding mass matrix. Each tuple of site names corresponds to a block.
      :param bool adapt_mass_matrix: a flag to decide whether an adaptation scheme will be used.
      :param dict options: tensor options to construct the initial mass matrix.
      """
      mass_matrix = {}
      dense_sites = ()
      dense_size = 0
      diag_sites = ()
      diag_size = 0
      for site_names, shape in mass_matrix_shape.items():
          if len(shape) == 2:
              dense_sites = dense_sites + site_names
              dense_size = dense_size + shape[0]
          else:
              diag_sites = diag_sites + site_names
              diag_size = diag_size + shape[0]
  
      size = dense_size + diag_size
      head_size = dense_size
      all_sites = dense_sites + diag_sites
      self._mass_matrix_size[all_sites] = size
      top = torch.eye(head_size, size, **options) * self._init_scale
      bottom_diag = torch.full(
          (size - head_size,), self._init_scale, **options
      )
      mass_matrix[all_sites] = SymmArrowhead(top, bottom_diag)
      if adapt_mass_matrix:
          adapt_scheme = WelfordArrowheadCovariance(head_size=head_size)
          self._adapt_scheme[all_sites] = adapt_scheme
  
      self.mass_matrix = mass_matrix
  
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 6 for calling the ArrowheadMassMatrix obj's underlying member method code with example usage: obj.configure(mass_matrix_shape, adapt_mass_matrix, options) without return types