class_docstr: Compound distribution comprising of a dirichlet-multinomial pair. The probability of
  classes (``probs`` for the :class:`~pyro.distributions.Multinomial` distribution)
  is unknown and randomly drawn from a :class:`~pyro.distributions.Dirichlet`
  distribution prior to a certain number of Categorical trials given by
  ``total_count``.
  
  :param float or torch.Tensor concentration: concentration parameter (alpha) for the
      Dirichlet distribution.
  :param int or torch.Tensor total_count: number of Categorical trials.
  :param bool is_sparse: Whether to assume value is mostly zero when computing
      :meth:`log_prob`, which can speed up computation when data is sparse.
class_docstr_tok: ["Compound","distribution","comprising","of","a","dirichlet-multinomial","pair",".","The","probability","of","classes","(","``","probs","``","for","the",":","class",":","`","~pyro.distributions.Multinomial","`","distribution",")","is","unknown","and","randomly","drawn","from","a",":","class",":","`","~pyro.distributions.Dirichlet","`","distribution","prior","to","a","certain","number","of","Categorical","trials","given","by","``","total_count","``",".",":","param","float","or","torch.Tensor","concentration",":","concentration","parameter","(","alpha",")","for","the","Dirichlet","distribution",".",":","param","int","or","torch.Tensor","total_count",":","number","of","Categorical","trials",".",":","param","bool","is_sparse",":","Whether","to","assume","value","is","mostly","zero","when","computing",":","meth",":","`","log_prob","`",",","which","can","speed","up","computation","when","data","is","sparse","."]
code: def __init__(
      self,
      concentration,
      total_count=1,
      is_sparse=False,
      validate_args=None,
  ):
      batch_shape = concentration.shape[:-1]
      event_shape = concentration.shape[-1:]
      if isinstance(total_count, numbers.Number):
          total_count = concentration.new_tensor(total_count)
      else:
          batch_shape = broadcast_shape(batch_shape, total_count.shape)
          concentration = concentration.expand(batch_shape + (-1,))
          total_count = total_count.expand(batch_shape)
      self._dirichlet = Dirichlet(concentration)
      self.total_count = total_count
      self.is_sparse = is_sparse
      super().__init__(
          batch_shape, event_shape, validate_args=validate_args
      )
  
imports: import numbers
  import torch
  from torch.distributions.utils import broadcast_all
  from pyro.ops.special import log_beta, log_binomial
  from .None import constraints
  from .torch import Beta, Binomial, Dirichlet, Gamma, Multinomial, Poisson
  from .torch_distribution import TorchDistribution
  from .util import broadcast_shape
label_desc: Use image node_id 1 to create a new DirichletMultinomial object from inherited base classes: TorchDistribution with example: obj = DirichletMultinomial(concentration, total_count, is_sparse, validate_args)