class_docstr: Given a stochastic function with some sample statements
  and a dictionary of observations at names,
  change the sample statements at those names into observes
  with those values.
  
  Consider the following Pyro program:
  
      >>> def model(x):
      ...     s = pyro.param("s", torch.tensor(0.5))
      ...     z = pyro.sample("z", dist.Normal(x, s))
      ...     return z ** 2
  
  To observe a value for site `z`, we can write
  
      >>> conditioned_model = pyro.poutine.condition(model, data={"z": torch.tensor(1.)})
  
  This is equivalent to adding `obs=value` as a keyword argument
  to `pyro.sample("z", ...)` in `model`.
  
  :param fn: a stochastic function (callable containing Pyro primitive calls)
  :param data: a dict or a :class:`~pyro.poutine.Trace`
  :returns: stochastic function decorated with a :class:`~pyro.poutine.condition_messenger.ConditionMessenger`
docstr: :param data: a dict or a Trace
  
  Constructor. Doesn't do much, just stores the stochastic function
  and the data to condition on.
docstr_tok: [":","param","data",":","a","dict","or","a","Trace","Constructor",".","Does","n't","do","much",",","just","stores","the","stochastic","function","and","the","data","to","condition","on","."]
code: def __init__(
      self, data: Union[Dict[str, torch.Tensor], Trace]
  ) -> None:
      """
      :param data: a dict or a Trace
  
      Constructor. Doesn't do much, just stores the stochastic function
      and the data to condition on.
      """
      super().__init__()
      self.data = data
  
file_path: pyro/pyro/poutine/condition_messenger.py
imports: from typing import TYPE_CHECKING, Dict, Union
  import torch
  from pyro.poutine.messenger import Messenger
  from pyro.poutine.trace_struct import Trace
label_desc: Use image node_id 1 to create a new ConditionMessenger object from inherited base classes: Messenger with example: obj = ConditionMessenger(data)