code: def test_mst_decodes_arc_labels_with_respect_to_unconstrained_scores(
      self,
  ):
      energy = (
          torch.Tensor([[0, 2, 1], [10, 0, 0.5], [9, 0.2, 0]])
          .view(1, 1, 3, 3)
          .expand(1, 2, 3, 3)
          .contiguous()
      )
      # Make the score for the root label for arcs to the root token be higher - it
      # will be masked for the MST, but we want to make sure that the tags are with
      # respect to the unmasked tensor. If the masking was incorrect, we would decode all
      # zeros as the labels, because torch takes the first index in the case that all the
      # values are equal, which would be the case if the labels were calculated from
      # the masked score.
      energy[:, 1, 0, :] = 3
      length = torch.LongTensor([3])
      heads, tags = self.model._run_mst_decoding(
          energy, length
      )  # pylint: disable=protected-access
      assert heads.tolist()[0] == [0, 0, 1]
      assert tags.tolist()[0] == [0, 1, 0]
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/models/biaffine_dependency_parser_test.py
imports: from __future__ import division
  from __future__ import absolute_import
  import torch
  from allennlp.common.testing.model_test_case import ModelTestCase
  from allennlp.nn.decoding.chu_liu_edmonds import decode_mst
label_desc: Use image node_id 7 for calling the BiaffineDependencyParserTest obj's underlying member method code with example usage: obj.test_mst_decodes_arc_labels_with_respect_to_unconstrained_scores() without return types