class_docstr: Mixture of Normal distributions with diagonal covariance matrices.
  
  That is, this distribution is a mixture with K components, where each
  component distribution is a D-dimensional Normal distribution with a
  D-dimensional mean parameter loc and a D-dimensional diagonal covariance
  matrix specified by a scale parameter `coord_scale`. The K different
  component means are gathered into the parameter `locs` and the scale
  parameter is shared between all K components. The mixture weights are
  controlled by a K-dimensional vector of softmax logits, `component_logits`.
  This distribution implements pathwise derivatives for samples from the
  distribution.
  
  See reference [1] for details on the implementations of the pathwise
  derivative. Please consider citing this reference if you use the pathwise
  derivative in your research. Note that this distribution does not support
  dimension D = 1.
  
  [1] Pathwise Derivatives for Multivariate Distributions, Martin Jankowiak &
  Theofanis Karaletsos. arXiv:1806.01856
  
  :param torch.Tensor locs: K x D mean matrix
  :param torch.Tensor coord_scale: shared D-dimensional scale vector
  :param torch.Tensor component_logits: K-dimensional vector of softmax logits
class_docstr_tok: ["Mixture","of","Normal","distributions","with","diagonal","covariance","matrices",".","That","is",",","this","distribution","is","a","mixture","with","K","components",",","where","each","component","distribution","is","a","D-dimensional","Normal","distribution","with","a","D-dimensional","mean","parameter","loc","and","a","D-dimensional","diagonal","covariance","matrix","specified","by","a","scale","parameter","`","coord_scale","`",".","The","K","different","component","means","are","gathered","into","the","parameter","`","locs","`","and","the","scale","parameter","is","shared","between","all","K","components",".","The","mixture","weights","are","controlled","by","a","K-dimensional","vector","of","softmax","logits",",","`","component_logits","`",".","This","distribution","implements","pathwise","derivatives","for","samples","from","the","distribution",".","See","reference","[","1","]","for","details","on","the","implementations","of","the","pathwise","derivative",".","Please","consider","citing","this","reference","if","you","use","the","pathwise","derivative","in","your","research",".","Note","that","this","distribution","does","not","support","dimension","D","=","1",".","[","1","]","Pathwise","Derivatives","for","Multivariate","Distributions",",","Martin","Jankowiak","&","Theofanis","Karaletsos",".","arXiv:1806.01856",":","param","torch.Tensor","locs",":","K","x","D","mean","matrix",":","param","torch.Tensor","coord_scale",":","shared","D-dimensional","scale","vector",":","param","torch.Tensor","component_logits",":","K-dimensional","vector","of","softmax","logits"]
code: def expand(self, batch_shape, _instance=None):
      new = self._get_checked_instance(
          MixtureOfDiagNormalsSharedCovariance, _instance
      )
      new.batch_mode = True
      batch_shape = torch.Size(batch_shape)
      new.dim = self.dim
      new.locs = self.locs.expand(batch_shape + self.locs.shape[-2:])
      coord_scale_shape = -1 if self.batch_mode else -2
      new.coord_scale = self.coord_scale.expand(
          batch_shape + self.coord_scale.shape[coord_scale_shape:]
      )
      new.component_logits = self.component_logits.expand(
          batch_shape + self.component_logits.shape[-1:]
      )
      new.categorical = self.categorical.expand(batch_shape)
      new.probs = self.probs.expand(batch_shape + self.probs.shape[-1:])
      super(MixtureOfDiagNormalsSharedCovariance, new).__init__(
          batch_shape, self.event_shape, validate_args=False
      )
      new._validate_args = self._validate_args
      return new
  
file_path: pyro/pyro/distributions/diag_normal_mixture_shared_cov.py
imports: import math
  import torch
  from torch.autograd import Function
  from torch.autograd.function import once_differentiable
  from torch.distributions import Categorical, constraints
  from pyro.distributions.torch_distribution import TorchDistribution
  from pyro.distributions.util import sum_leftmost
label_desc: Use image node_id 2 for calling the MixtureOfDiagNormalsSharedCovariance obj's underlying member method code with example usage: obj.expand(batch_shape, _instance) and returns: new