class_docstr: Initializes a site by replacing ``.sample()`` calls with values
  drawn from an initialization strategy. This is mainly for internal use by
  autoguide classes.
  
  :param callable init_fn: An initialization function.
class_docstr_tok: ["Initializes","a","site","by","replacing","``",".sample","(",")","``","calls","with","values","drawn","from","an","initialization","strategy",".","This","is","mainly","for","internal","use","by","autoguide","classes",".",":","param","callable","init_fn",":","An","initialization","function","."]
code: def _pyro_sample(self, msg):
      if (
          msg["value"] is not None
          or type(msg["fn"]).__name__ == "_Subsample"
      ):
          return
      with torch.no_grad(), helpful_support_errors(msg):
          value = self.init_fn(msg)
      if is_validation_enabled() and msg["value"] is not None:
          if not isinstance(value, type(msg["value"])):
              raise ValueError(
                  "{} provided invalid type for site {}:\nexpected {}\nactual {}".format(
                      self.init_fn,
                      msg["name"],
                      type(msg["value"]),
                      type(value),
                  )
              )
          if value.shape != msg["value"].shape:
              raise ValueError(
                  "{} provided invalid shape for site {}:\nexpected {}\nactual {}".format(
                      self.init_fn,
                      msg["name"],
                      msg["value"].shape,
                      value.shape,
                  )
              )
      msg["value"] = value
  
imports: import functools
  from typing import Callable, Optional
  import torch
  from torch.distributions import transform_to
  from pyro.distributions.torch import Independent
  from pyro.distributions.torch_distribution import MaskedDistribution
  from pyro.infer.util import is_validation_enabled
  from pyro.poutine.messenger import Messenger
  from pyro.util import torch_isnan
  from .utils import helpful_support_errors
label_desc: Use image node_id 2 for calling the InitMessenger obj's underlying member method code with example usage: obj._pyro_sample(msg) without return types