class_docstr: Wraps a Zuko distribution as a Pyro distribution.
  
  If ``dist`` has an ``rsample_and_log_prob`` method, like Zuko's flows, it will be
  used when sampling instead of ``rsample``. The returned log density will be cached
  for later scoring.
  
  :param dist: A distribution instance.
  :type dist: torch.distributions.Distribution
  
  .. code-block:: python
  
      flow = zuko.flows.MAF(features=5)
  
      # flow() is a torch.distributions.Distribution
  
      dist = flow()
      x = dist.sample((2, 3))
      log_p = dist.log_prob(x)
  
      # ZukoToPyro(flow()) is a pyro.distributions.Distribution
  
      dist = ZukoToPyro(flow())
      x = dist((2, 3))
      log_p = dist.log_prob(x)
  
      with pyro.plate("data", 42):
          z = pyro.sample("z", dist)
code: def __call__(self, shape: Size = ()) -> Tensor:
      if hasattr(
          self.dist, "rsample_and_log_prob"
      ):  # fast sampling + scoring
          x, self.cache[x] = self.dist.rsample_and_log_prob(shape)
      elif self.has_rsample:
          x = self.dist.rsample(shape)
      else:
          x = self.dist.sample(shape)
  
      return x
  
file_path: pyro/pyro/contrib/zuko.py
imports: import torch
  from torch import Size, Tensor
  import pyro
label_desc: Use image node_id 5 for calling the ZukoToPyro obj's underlying member method code with example usage: obj.__call__(shape) and returns: x