code: def test_span_mask_correct_excluded(self):
      # All masked out span indices by span_mask should be '0'
  
      sequence_tensor = torch.randn([2, 6, 10])
  
      extractor = MaxPoolingSpanExtractor(10)
      indices = torch.LongTensor(
          [[[1, 1], [3, 5], [2, 5]], [[0, 0], [0, 3], [4, 5]]]
      )
  
      span_mask = torch.BoolTensor([[True] * 3, [False] * 3])
  
      span_representations = extractor(
          sequence_tensor,
          indices,
          span_indices_mask=span_mask,
      )
  
      # The span-mask masks out all indices in the last batch
      # We check whether all span representations for this batch are '0'
      X = indices[-1]
      batch = -1
      for indices_ind, span_def in enumerate(X):
          span_features_complete = sequence_tensor[batch][
              span_def[0] : span_def[1] + 1
          ]
  
          for i, _ in enumerate(span_features_complete):
              real_max_value = torch.FloatTensor([0.0])
              extracted_max_value = span_representations[
                  batch, indices_ind, i
              ]
  
              assert real_max_value == extracted_max_value, (
                  f"Error extracting max value for "
                  f"batch {batch}, span {indices_ind} on dimension {i}."
                  f"expected {real_max_value} "
                  f"but got {extracted_max_value} which is "
                  f"not the maximum element."
              )
  
file_path: allennlp/tests/modules/span_extractors/max_pooling_span_extractor_test.py
imports: import pytest
  import torch
  from allennlp.common.params import Params
  from allennlp.modules.span_extractors import SpanExtractor
  from allennlp.modules.span_extractors.max_pooling_span_extractor import MaxPoolingSpanExtractor
label_desc: Use image node_id 4 for calling the TestMaxPoolingSpanExtractor obj's underlying member method code with example usage: obj.test_span_mask_correct_excluded() without return types