class_docstr: Generic Zero Inflated distribution.
  
  This can be used directly or can be used as a base class as e.g. for
  :class:`ZeroInflatedPoisson` and :class:`ZeroInflatedNegativeBinomial`.
  
  :param TorchDistribution base_dist: the base distribution.
  :param torch.Tensor gate: probability of extra zeros given via a Bernoulli distribution.
  :param torch.Tensor gate_logits: logits of extra zeros given via a Bernoulli distribution.
class_docstr_tok: ["Generic","Zero","Inflated","distribution",".","This","can","be","used","directly","or","can","be","used","as","a","base","class","as","e.g",".","for",":","class",":","`","ZeroInflatedPoisson","`","and",":","class",":","`","ZeroInflatedNegativeBinomial","`",".",":","param","TorchDistribution","base_dist",":","the","base","distribution",".",":","param","torch.Tensor","gate",":","probability","of","extra","zeros","given","via","a","Bernoulli","distribution",".",":","param","torch.Tensor","gate_logits",":","logits","of","extra","zeros","given","via","a","Bernoulli","distribution","."]
code: def __init__(
      self,
      base_dist,
      *,
      gate=None,
      gate_logits=None,
      validate_args=None,
  ):
      if (gate is None) == (gate_logits is None):
          raise ValueError(
              "Either `gate` or `gate_logits` must be specified, but not both."
          )
      if gate is not None:
          batch_shape = broadcast_shape(
              gate.shape, base_dist.batch_shape
          )
          self.gate = gate.expand(batch_shape)
      else:
          batch_shape = broadcast_shape(
              gate_logits.shape, base_dist.batch_shape
          )
          self.gate_logits = gate_logits.expand(batch_shape)
      if base_dist.event_shape:
          raise ValueError(
              "ZeroInflatedDistribution expected empty "
              "base_dist.event_shape but got {}".format(
                  base_dist.event_shape
              )
          )
  
      self.base_dist = base_dist.expand(batch_shape)
      event_shape = torch.Size()
  
      super().__init__(batch_shape, event_shape, validate_args)
  
imports: import torch
  from torch.distributions import constraints
  from torch.distributions.utils import broadcast_all, lazy_property, logits_to_probs, probs_to_logits
  from torch.nn.functional import softplus
  from pyro.distributions import NegativeBinomial, Poisson, TorchDistribution
  from pyro.distributions.util import broadcast_shape
label_desc: Use image node_id 1 to create a new ZeroInflatedDistribution object from inherited base classes: TorchDistribution with example: obj = ZeroInflatedDistribution(base_dist)