class_docstr: Base structured distribution class.
  
  Dynamic distribution for length N of structures :math:`p(z)`.
  
  Implemented based on gradient identities from:
  
  * Inside-outside and forward-backward algorithms are just backprop :cite:`eisner2016inside`
  * Semiring Parsing :cite:`goodman1999semiring`
  * First-and second-order expectation semirings with applications to minimum-risk training on translation forests :cite:`li2009first`
  
  Parameters:
      log_potentials (tensor, batch_shape x event_shape) :  log-potentials :math:`\phi`
      lengths (long tensor, batch_shape) : integers for length masking
docstr: Convert simple representation to event.
docstr_tok: ["Convert","simple","representation","to","event","."]
code: def to_event(self, sequence, extra, lengths=None):
      "Convert simple representation to event."
      return self.struct.to_parts(sequence, extra, lengths=lengths)
  
imports: import torch
  from torch.distributions import constraints
  from torch.distributions.distribution import Distribution
  from torch.distributions.utils import lazy_property
  from .linearchain import LinearChain
  from .cky import CKY
  from .semimarkov import SemiMarkov
  from .alignment import Alignment
  from .deptree import DepTree, deptree_nonproj, deptree_part
  from .cky_crf import CKY_CRF
  from .semirings import LogSemiring, MaxSemiring, EntropySemiring, CrossEntropySemiring, KLDivergenceSemiring, MultiSampledSemiring, KMaxSemiring, StdSemiring, GumbelCRFSemiring
label_desc: Use image node_id 17 for calling the StructDistribution obj's underlying member method code with example usage: obj.to_event(sequence, extra, lengths) and returns: self