class_docstr: This messenger keeps track of stack of independence information declared by
  nested ``plate`` contexts. This information is stored in a
  ``cond_indep_stack`` at each sample/observe site for consumption by
  ``TraceMessenger``.
  
  Example::
  
      x_axis = IndepMessenger('outer', 320, dim=-1)
      y_axis = IndepMessenger('inner', 200, dim=-2)
      with x_axis:
          x_noise = sample("x_noise", dist.Normal(loc, scale).expand_by([320]))
      with y_axis:
          y_noise = sample("y_noise", dist.Normal(loc, scale).expand_by([200, 1]))
      with x_axis, y_axis:
          xy_noise = sample("xy_noise", dist.Normal(loc, scale).expand_by([200, 320]))
code: def __init__(
      self,
      name: str,
      size: int,
      dim: Optional[int] = None,
      device: Optional[str] = None,
  ) -> None:
      if not torch._C._get_tracing_state() and size == 0:
          raise ZeroDivisionError("size cannot be zero")
  
      super().__init__()
      self._vectorized = None
      if dim is not None:
          self._vectorized = True
  
      self._indices: Optional[torch.Tensor] = None
      self.name = name
      self.dim = dim
      self.size = size
      self.device = device
      self.counter = 0
  
imports: import numbers
  from typing import Iterator, NamedTuple, Optional, Tuple
  import torch
  from typing_extensions import Self
  from pyro.poutine.messenger import Messenger
  from pyro.poutine.runtime import _DIM_ALLOCATOR, Message
  from pyro.util import ignore_jit_warnings
label_desc: Use image node_id 1 to create a new IndepMessenger object from inherited base classes: Messenger with example: obj = IndepMessenger(name, size, dim, device)