class_docstr: :class:`~torch.distributions.Distribution` wrapper around a
  :class:`~funsor.terms.Funsor` for use in Pyro code. This is typically used
  as a base class for specific funsor inference algorithms wrapped in a
  distribution interface.
  
  :param funsor.terms.Funsor funsor_dist: A funsor with an input named
      "value" that is treated as a random variable. The distribution should
      be normalized over "value".
  :param torch.Size batch_shape: The distribution's batch shape. This must
      be in the same order as the input of the ``funsor_dist``, but may
      contain extra dims of size 1.
  :param event_shape: The distribution's event shape.
class_docstr_tok: [":","class",":","`","~torch.distributions.Distribution","`","wrapper","around","a",":","class",":","`","~funsor.terms.Funsor","`","for","use","in","Pyro","code",".","This","is","typically","used","as","a","base","class","for","specific","funsor","inference","algorithms","wrapped","in","a","distribution","interface",".",":","param","funsor.terms.Funsor","funsor_dist",":","A","funsor","with","an","input","named","``","value","''","that","is","treated","as","a","random","variable",".","The","distribution","should","be","normalized","over","``","value","''",".",":","param","torch.Size","batch_shape",":","The","distribution","'s","batch","shape",".","This","must","be","in","the","same","order","as","the","input","of","the","``","funsor_dist","``",",","but","may","contain","extra","dims","of","size","1.",":","param","event_shape",":","The","distribution","'s","event","shape","."]
code: def sample(self, sample_shape=torch.Size()):
      delta = self._sample_delta(sample_shape)
      ndims = (
          len(sample_shape)
          + len(self.batch_shape)
          + len(self.event_shape)
      )
      value = funsor_to_tensor(delta.terms[0][1][0], ndims=ndims)
      return value.detach()
  
imports: from collections import OrderedDict
  import torch
  from pyro.distributions import TorchDistribution
  from torch.distributions import constraints
  from funsor.cnf import Contraction
  from funsor.delta import Delta
  from funsor.domains import Bint
  from funsor.interpreter import reinterpret
  from funsor.pyro.convert import DIM_TO_NAME, funsor_to_tensor, tensor_to_funsor
  from funsor.terms import Funsor, to_funsor
label_desc: Use image node_id 5 for calling the FunsorDistribution obj's underlying member method code with example usage: obj.sample(sample_shape) and returns: value