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 torch.Tensor gate: probability of extra zeros given via a Bernoulli distribution.
  :param TorchDistribution base_dist: the base distribution.
code: def sample(self, sample_shape=torch.Size()):
      shape = self._extended_shape(sample_shape)
      with torch.no_grad():
          mask = torch.bernoulli(self.gate.expand(shape)).bool()
          samples = self.base_dist.expand(shape).sample()
          samples = torch.where(mask, samples.new_zeros(()), samples)
      return samples
  
imports: import torch
  from torch.distributions import constraints, NegativeBinomial, Poisson, Distribution
  from torch.distributions.utils import broadcast_all, lazy_property
  from .utils import broadcast_shape
label_desc: Use image node_id 4 for calling the ZeroInflatedDistribution obj's underlying member method code with example usage: obj.sample(sample_shape) and returns: samples