class_docstr: Abstract base class for reparameterizers.
  
  Derived classes should implement :meth:`apply`.
class_docstr_tok: ["Abstract","base","class","for","reparameterizers",".","Derived","classes","should","implement",":","meth",":","`","apply","`","."]
docstr: Abstract method to apply reparameterizer.
  
  :param dict name: A simplified Pyro message with fields:
      - ``name: str`` the sample site's name
      - ``fn: Callable`` a distribution
      - ``value: Optional[torch.Tensor]`` an observed or initial value
      - ``is_observed: bool`` whether ``value`` is an observation
  :returns: A simplified Pyro message with fields ``fn``, ``value``, and
      ``is_observed``.
  :rtype: dict
docstr_tok: ["Abstract","method","to","apply","reparameterizer",".",":","param","dict","name",":","A","simplified","Pyro","message","with","fields",":","-","``","name",":","str","``","the","sample","site","'s","name","-","``","fn",":","Callable","``","a","distribution","-","``","value",":","Optional","[","torch.Tensor","]","``","an","observed","or","initial","value","-","``","is_observed",":","bool","``","whether","``","value","``","is","an","observation",":","returns",":","A","simplified","Pyro","message","with","fields","``","fn","``",",","``","value","``",",","and","``","is_observed","``",".",":","rtype",":","dict"]
code: def apply(self, msg: ReparamMessage) -> ReparamResult:
      """
      Abstract method to apply reparameterizer.
  
      :param dict name: A simplified Pyro message with fields:
          - ``name: str`` the sample site's name
          - ``fn: Callable`` a distribution
          - ``value: Optional[torch.Tensor]`` an observed or initial value
          - ``is_observed: bool`` whether ``value`` is an observation
      :returns: A simplified Pyro message with fields ``fn``, ``value``, and
          ``is_observed``.
      :rtype: dict
      """
  
      # This default is provided for backwards compatibility only.
      # New subclasses should define .apply() and omit .__call__().
      warnings.warn(
          "Reparam.__call__() is deprecated in favor of .apply(); "
          "new subclasses should implement .apply().",
          DeprecationWarning,
      )
      new_fn, value = self(msg["name"], msg["fn"], msg["value"])
      is_observed = msg["value"] is None and value is not None
      return {"fn": new_fn, "value": value, "is_observed": is_observed}
  
file_path: pyro/pyro/infer/reparam/reparam.py
imports: import warnings
  from abc import ABC
  from typing import Callable, Optional
  import torch
  from typing_extensions import TypedDict
label_desc: Use image node_id 1 for calling the Reparam obj's underlying member method code with example usage: obj.apply(msg) and returns: dict