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 expand(self, batch_shape, _instance=None):
      new = self._get_checked_instance(type(self), _instance)
      batch_shape = torch.Size(batch_shape)
      gate = (
          self.gate.expand(batch_shape)
          if "gate" in self.__dict__
          else None
      )
      gate_logits = (
          self.gate_logits.expand(batch_shape)
          if "gate_logits" in self.__dict__
          else None
      )
      base_dist = self.base_dist.expand(batch_shape)
      ZeroInflatedDistribution.__init__(
          new,
          base_dist,
          gate=gate,
          gate_logits=gate_logits,
          validate_args=False,
      )
      new._validate_args = self._validate_args
      return new
  
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 9 for calling the ZeroInflatedDistribution obj's underlying member method code with example usage: obj.expand(batch_shape, _instance) and returns: new