class_docstr: Mixin to provide Pyro compatibility for PyTorch distributions.
  
  You should instead use `TorchDistribution` for new distribution classes.
  
  This is mainly useful for wrapping existing PyTorch distributions for
  use in Pyro.  Derived classes must first inherit from
  :class:`torch.distributions.distribution.Distribution` and then inherit
  from :class:`TorchDistributionMixin`.
class_docstr_tok: ["Mixin","to","provide","Pyro","compatibility","for","PyTorch","distributions",".","You","should","instead","use","`","TorchDistribution","`","for","new","distribution","classes",".","This","is","mainly","useful","for","wrapping","existing","PyTorch","distributions","for","use","in","Pyro",".","Derived","classes","must","first","inherit","from",":","class",":","`","torch.distributions.distribution.Distribution","`","and","then","inherit","from",":","class",":","`","TorchDistributionMixin","`","."]
docstr: Returns a new :class:`ExpandedDistribution` instance with batch
  dimensions expanded to `batch_shape`.
  
  :param tuple batch_shape: batch shape to expand to.
  :param _instance: unused argument for compatibility with
      :meth:`torch.distributions.Distribution.expand`
  :return: an instance of `ExpandedDistribution`.
  :rtype: :class:`ExpandedDistribution`
code: def expand(
      self, batch_shape, _instance=None
  ) -> "ExpandedDistribution":
      """
      Returns a new :class:`ExpandedDistribution` instance with batch
      dimensions expanded to `batch_shape`.
  
      :param tuple batch_shape: batch shape to expand to.
      :param _instance: unused argument for compatibility with
          :meth:`torch.distributions.Distribution.expand`
      :return: an instance of `ExpandedDistribution`.
      :rtype: :class:`ExpandedDistribution`
      """
      return ExpandedDistribution(self, batch_shape)
  
imports: import warnings
  from collections import OrderedDict
  from typing import Callable
  import torch
  from torch.distributions.kl import kl_divergence, register_kl
  import pyro.distributions.torch
  from .None import constraints
  from .distribution import Distribution
  from .score_parts import ScoreParts
  from .util import broadcast_shape, scale_and_mask
label_desc: Use image node_id 7 for calling the TorchDistributionMixin obj's underlying member method code with example usage: obj.expand(batch_shape, _instance) and returns: ExpandedDistribution