class_docstr: Represents a non-projective dependency CRF.
  
  For references see:
  
  * Non-projective dependency parsing using spanning tree algorithms :cite:`mcdonald2005non`
  * Structured prediction models via the matrix-tree theorem :cite:`koo2007structured`
  
  Event shape is of the form:
  
  Parameters:
     log_potentials (tensor) : event shape (*N x N*) head, child  with
                               arc scores with root scores on diagonal e.g.
                               :math:`\phi(i, j)` where :math:`\phi(i, i)` is (root, i).
  
  Compact representation: N long tensor in [0, .. N] (indexing is +1)
  
  Note: Does not currently implement argmax (Chiu-Liu) or sampling.
code: def sample(self, sample_shape=torch.Size()):
      raise NotImplementedError()
  
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 3 for calling the NonProjectiveDependencyCRF obj's underlying member method code with example usage: obj.sample(sample_shape) without return types