code: def test_span_scorer_raises_with_incorrect_scorer_spec(self):
      # Mis-configured scorer - doesn't produce a tensor with 1 as it's final dimension.
      scorer = lambda tensor: tensor.sum(-1)
      pruner = SpanPruner(scorer=scorer)  # type: ignore
      spans = torch.randn([3, 4, 5]).clamp(min=0.0, max=1.0)
      mask = torch.ones([3, 4])
  
      with pytest.raises(ValueError):
          _ = pruner(spans, mask, 2)
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/modules/span_pruner_test.py
imports: from __future__ import with_statement
  from __future__ import absolute_import
  import numpy
  import pytest
  import torch
  from allennlp.modules import SpanPruner
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.nn.util import batched_index_select
label_desc: Use image node_id 2 for calling the TestSpanPruner obj's underlying member method code with example usage: obj.test_span_scorer_raises_with_incorrect_scorer_spec() without return types