class_docstr: Dictionary-like object to hold a vectorized collection of tensors to
  represent all state during inference with :class:`SMCFilter`. During
  inference, the :class:`SMCFilter` resample these tensors.
  
  Keys may have arbitrary hashable type.
  Values must be :class:`torch.Tensor` s.
  
  :param int num_particles:
class_docstr_tok: ["Dictionary-like","object","to","hold","a","vectorized","collection","of","tensors","to","represent","all","state","during","inference","with",":","class",":","`","SMCFilter","`",".","During","inference",",","the",":","class",":","`","SMCFilter","`","resample","these","tensors",".","Keys","may","have","arbitrary","hashable","type",".","Values","must","be",":","class",":","`","torch.Tensor","`","s.",":","param","int","num_particles",":"]
code: def __setitem__(self, key, value):
      if self._locked:
          raise RuntimeError("Guide cannot write to SMCState")
      if is_validation_enabled():
          if not isinstance(value, torch.Tensor):
              raise TypeError(
                  "Only Tensors can be stored in an SMCState, but got {}".format(
                      type(value).__name__
                  )
              )
          if value.dim() == 0 or value.size(0) != self._num_particles:
              raise ValueError(
                  "Expected leading dim of size {} but got shape {}".format(
                      self._num_particles, value.shape
                  )
              )
      super().__setitem__(key, value)
  
imports: import contextlib
  import math
  import torch
  import pyro
  import pyro.distributions
  import pyro.poutine
  from pyro.infer.util import is_validation_enabled
  from pyro.poutine.util import prune_subsample_sites
label_desc: Use image node_id 3 for calling the SMCState obj's underlying member method code with example usage: obj.__setitem__(key, value) without return types