class_docstr: HMM with discrete latent states and discrete observations, allowing for
  missing data or variable length sequences. Observations are assumed
  to be one hot encoded; rows with all zeros indicate missing data.
  
  .. warning:: Unlike in pyro's pyro.distributions.DiscreteHMM, which
      computes the probability of the first state as
      initial.T @ transition @ emission
      this distribution uses the standard HMM convention,
      initial.T @ emission
  
  :param ~torch.Tensor initial_logits: A logits tensor for an initial
      categorical distribution over latent states. Should have rightmost
      size ``state_dim`` and be broadcastable to
      ``(batch_size, state_dim)``.
  :param ~torch.Tensor transition_logits: A logits tensor for transition
      conditional distributions between latent states. Should have rightmost
      shape ``(state_dim, state_dim)`` (old, new), and be broadcastable
      to ``(batch_size, state_dim, state_dim)``.
  :param ~torch.Tensor observation_logits: A logits tensor for observation
      distributions from latent states. Should have rightmost shape
      ``(state_dim, categorical_size)``, where ``categorical_size`` is the
      dimension of the categorical output, and be broadcastable
      to ``(batch_size, state_dim, categorical_size)``.
class_docstr_tok: ["HMM","with","discrete","latent","states","and","discrete","observations",",","allowing","for","missing","data","or","variable","length","sequences",".","Observations","are","assumed","to","be","one","hot","encoded",";","rows","with","all","zeros","indicate","missing","data",".","..","warning",":",":","Unlike","in","pyro","'s","pyro.distributions.DiscreteHMM",",","which","computes","the","probability","of","the","first","state","as","initial.T","@","transition","@","emission","this","distribution","uses","the","standard","HMM","convention",",","initial.T","@","emission",":","param","~torch.Tensor","initial_logits",":","A","logits","tensor","for","an","initial","categorical","distribution","over","latent","states",".","Should","have","rightmost","size","``","state_dim","``","and","be","broadcastable","to","``","(","batch_size",",","state_dim",")","``",".",":","param","~torch.Tensor","transition_logits",":","A","logits","tensor","for","transition","conditional","distributions","between","latent","states",".","Should","have","rightmost","shape","``","(","state_dim",",","state_dim",")","``","(","old",",","new",")",",","and","be","broadcastable","to","``","(","batch_size",",","state_dim",",","state_dim",")","``",".",":","param","~torch.Tensor","observation_logits",":","A","logits","tensor","for","observation","distributions","from","latent","states",".","Should","have","rightmost","shape","``","(","state_dim",",","categorical_size",")","``",",","where","``","categorical_size","``","is","the","dimension","of","the","categorical","output",",","and","be","broadcastable","to","``","(","batch_size",",","state_dim",",","categorical_size",")","``","."]
code: def __init__(
      self,
      initial_logits,
      transition_logits,
      observation_logits,
      validate_args=None,
  ):
      if initial_logits.dim() < 1:
          raise ValueError(
              "expected initial_logits to have at least one dim, "
              "actual shape = {}".format(initial_logits.shape)
          )
      if transition_logits.dim() < 2:
          raise ValueError(
              "expected transition_logits to have at least two dims, "
              "actual shape = {}".format(transition_logits.shape)
          )
      if observation_logits.dim() < 2:
          raise ValueError(
              "expected observation_logits to have at least two dims, "
              "actual shape = {}".format(transition_logits.shape)
          )
      shape = broadcast_shape(
          initial_logits.shape[:-1],
          transition_logits.shape[:-2],
          observation_logits.shape[:-2],
      )
      if len(shape) == 0:
          shape = torch.Size([1])
      batch_shape = shape
      event_shape = (1, observation_logits.shape[-1])
      self.initial_logits = initial_logits - initial_logits.logsumexp(
          -1, True
      )
      self.transition_logits = (
          transition_logits - transition_logits.logsumexp(-1, True)
      )
      self.observation_logits = (
          observation_logits - observation_logits.logsumexp(-1, True)
      )
      super(MissingDataDiscreteHMM, self).__init__(
          batch_shape, event_shape, validate_args=validate_args
      )
  
file_path: pyro/pyro/contrib/mue/missingdatahmm.py
imports: import torch
  from torch.distributions import Categorical, OneHotCategorical
  from pyro.distributions import constraints
  from pyro.distributions.hmm import _sequential_logmatmulexp
  from pyro.distributions.torch_distribution import TorchDistribution
  from pyro.distributions.util import broadcast_shape
label_desc: Use image node_id 1 to create a new MissingDataDiscreteHMM object from inherited base classes: TorchDistribution with example: obj = MissingDataDiscreteHMM(initial_logits, transition_logits, observation_logits, validate_args)