class_docstr: Base trace object
  
  Parameters
  ----------
  name: str
      Name of backend
  model: Model
      If None, the model is taken from the `with` context.
  vars: list of variables
      Sampling values will be stored for these variables. If None,
      `model.unobserved_RVs` is used.
  test_point: dict
      use different test point that might be with changed variables shapes
class_docstr_tok: ["Base","trace","object","Parameters","--","--","--","--","--","name",":","str","Name","of","backend","model",":","Model","If","None",",","the","model","is","taken","from","the","`","with","`","context",".","vars",":","list","of","variables","Sampling","values","will","be","stored","for","these","variables",".","If","None",",","`","model.unobserved_RVs","`","is","used",".","test_point",":","dict","use","different","test","point","that","might","be","with","changed","variables","shapes"]
docstr: Get sampler statistics from the trace.
  
  Note: This implementation attempts to squeeze object arrays into a consistent dtype,
  #     which can change their shape in hard-to-predict ways.
  #     See https://github.com/pymc-devs/pymc/issues/6207
  
  Parameters
  ----------
  stat_name : str
      Name of the stat to fetch.
  sampler_idx : int or None
      Index of the sampler to get the stat from.
  burn : int
      Draws to skip from the start.
  thin : int
      Stepsize for the slice.
  
  Returns
  -------
  stats : np.ndarray
      If `sampler_idx` was specified, the shape should be `(draws,)`.
      Otherwise, the shape should be `(draws, samplers)`.
docstr_tok: ["Get","sampler","statistics","from","the","trace",".","Note",":","This","implementation","attempts","to","squeeze","object","arrays","into","a","consistent","dtype",",","#","which","can","change","their","shape","in","hard-to-predict","ways",".","#","See","https",":","\/\/github.com\/pymc-devs\/pymc\/issues\/6207","Parameters","--","--","--","--","--","stat_name",":","str","Name","of","the","stat","to","fetch",".","sampler_idx",":","int","or","None","Index","of","the","sampler","to","get","the","stat","from",".","burn",":","int","Draws","to","skip","from","the","start",".","thin",":","int","Stepsize","for","the","slice",".","Returns","--","--","--","-","stats",":","np.ndarray","If","`","sampler_idx","`","was","specified",",","the","shape","should","be","`","(","draws",",",")","`",".","Otherwise",",","the","shape","should","be","`","(","draws",",","samplers",")","`","."]
code: def get_sampler_stats(
      self,
      stat_name: str,
      sampler_idx: Optional[int] = None,
      burn=0,
      thin=1,
  ) -> np.ndarray:
      """Get sampler statistics from the trace.
  
      Note: This implementation attempts to squeeze object arrays into a consistent dtype,
      #     which can change their shape in hard-to-predict ways.
      #     See https://github.com/pymc-devs/pymc/issues/6207
  
      Parameters
      ----------
      stat_name : str
          Name of the stat to fetch.
      sampler_idx : int or None
          Index of the sampler to get the stat from.
      burn : int
          Draws to skip from the start.
      thin : int
          Stepsize for the slice.
  
      Returns
      -------
      stats : np.ndarray
          If `sampler_idx` was specified, the shape should be `(draws,)`.
          Otherwise, the shape should be `(draws, samplers)`.
      """
      if sampler_idx is not None:
          return self._get_sampler_stats(
              stat_name, sampler_idx, burn, thin
          )
  
      sampler_idxs = [
          i for i, s in enumerate(self.sampler_vars) if stat_name in s
      ]
      if not sampler_idxs:
          raise KeyError("Unknown sampler stat %s" % stat_name)
  
      vals = np.stack(
          [
              self._get_sampler_stats(stat_name, i, burn, thin)
              for i in sampler_idxs
          ],
          axis=-1,
      )
  
      if vals.shape[-1] == 1:
          vals = vals[..., 0]
  
      if vals.dtype == np.dtype(object):
          try:
              vals = np.vstack(list(vals))
          except ValueError:
              # Most likely due to non-identical shapes. Just stick with the object-array.
              pass
  
      return vals
  
imports: import itertools
  import logging
  import warnings
  from abc import ABC
  from typing import Any, Dict, List, Mapping, Optional, Sequence, Set, Sized, Tuple, TypeVar, Union, cast
  import numpy
  from pymc.backends.report import SamplerReport
  from pymc.model import modelcontext
  from pymc.util import get_var_name
label_desc: Use image node_id 5 for calling the BaseTrace obj's underlying member method code with example usage: obj.get_sampler_stats(stat_name, sampler_idx, burn, thin) and returns: vals, self