class_docstr: MCMC that computes required statistics in a streaming fashion. For this class no samples are retained
  but only aggregated statistics. This is useful for running memory expensive models where we care only
  about specific statistics (especially useful in a memory constrained environments like GPU).
  
  For available streaming ops please see :mod:`~pyro.ops.streaming`.
class_docstr_tok: ["MCMC","that","computes","required","statistics","in","a","streaming","fashion",".","For","this","class","no","samples","are","retained","but","only","aggregated","statistics",".","This","is","useful","for","running","memory","expensive","models","where","we","care","only","about","specific","statistics","(","especially","useful","in","a","memory","constrained","environments","like","GPU",")",".","For","available","streaming","ops","please","see",":","mod",":","`","~pyro.ops.streaming","`","."]
code: def __init__(
      self,
      kernel,
      num_samples,
      warmup_steps=None,
      initial_params=None,
      statistics=None,
      num_chains=1,
      hook_fn=None,
      disable_progbar=False,
      disable_validation=True,
      transforms=None,
      save_params=None,
  ):
      super().__init__(kernel, num_chains, transforms)
      self.warmup_steps = (
          num_samples if warmup_steps is None else warmup_steps
      )  # Stan
      self.num_samples = num_samples
      self.disable_validation = disable_validation
      self._samples = None
      self._args = None
      self._kwargs = None
      if statistics is None:
          statistics = StatsOfDict(default=CountMeanVarianceStats)
      self._statistics = statistics
      self._default_statistics = copy.deepcopy(statistics)
      if save_params is not None:
          kernel.save_params = save_params
      self._validate_kernel(initial_params)
      if num_chains > 1:
          if initial_params:
              self._validate_initial_params(initial_params)
      else:
          if initial_params:
              initial_params = {
                  k: v.unsqueeze(0) for k, v in initial_params.items()
              }
      self._diagnostics = [None] * num_chains
      self.sampler = _UnarySampler(
          kernel,
          num_samples,
          self.warmup_steps,
          num_chains,
          disable_progbar,
          initial_params=initial_params,
          hook=hook_fn,
      )
  
imports: import copy
  import json
  import logging
  import queue
  import signal
  import threading
  import warnings
  from abc import ABC, abstractmethod
  from collections import OrderedDict
  from typing import Dict
  import torch
  import torch.multiprocessing
  import pyro
  import pyro.poutine
  from pyro.infer.mcmc.hmc import HMC
  from pyro.infer.mcmc.logger import DIAGNOSTIC_MSG, ProgressBar, TqdmHandler, initialize_logger
  from pyro.infer.mcmc.nuts import NUTS
  from pyro.infer.mcmc.util import diagnostics, diagnostics_from_stats, print_summary, select_samples
  from pyro.ops.streaming import CountMeanVarianceStats, StatsOfDict, StreamingStats
  from pyro.util import optional
label_desc: Use image node_id 1 to create a new StreamingMCMC object from inherited base classes: AbstractMCMC with example: obj = StreamingMCMC(kernel, num_samples, warmup_steps, initial_params, statistics, num_chains, hook_fn, disable_progbar, disable_validation, transforms, save_params)