code: def test_as_tensor_can_handle_multiple_token_indexers_and_empty_fields(
      self,
  ):
      # pylint: disable=protected-access
      self.field1._token_indexers = self.words_and_characters_indexers
      self.field2._token_indexers = self.words_and_characters_indexers
      self.field3._token_indexers = self.words_and_characters_indexers
  
      list_field = ListField(
          [self.field1.empty_field(), self.field1, self.field2]
      )
      list_field.index(self.vocab)
      padding_lengths = list_field.get_padding_lengths()
      tensor_dict = list_field.as_tensor(padding_lengths)
      words = tensor_dict["words"].detach().cpu().numpy()
      characters = tensor_dict["characters"].detach().cpu().numpy()
  
      numpy.testing.assert_array_almost_equal(
          words,
          numpy.array(
              [[0, 0, 0, 0, 0], [2, 3, 4, 5, 0], [2, 3, 4, 1, 5]]
          ),
      )
  
      numpy.testing.assert_array_almost_equal(
          characters[0], numpy.zeros([5, 9])
      )
  
      numpy.testing.assert_array_almost_equal(
          characters[1],
          numpy.array(
              [
                  [5, 1, 1, 2, 0, 0, 0, 0, 0],
                  [1, 2, 0, 0, 0, 0, 0, 0, 0],
                  [1, 0, 0, 0, 0, 0, 0, 0, 0],
                  [2, 3, 4, 5, 3, 4, 6, 3, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0],
              ]
          ),
      )
  
      numpy.testing.assert_array_almost_equal(
          characters[2],
          numpy.array(
              [
                  [5, 1, 1, 2, 0, 0, 0, 0, 0],
                  [1, 2, 0, 0, 0, 0, 0, 0, 0],
                  [1, 0, 0, 0, 0, 0, 0, 0, 0],
                  [1, 1, 1, 1, 3, 1, 3, 4, 5],
                  [2, 3, 4, 5, 3, 4, 6, 3, 0],
              ]
          ),
      )
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/data/fields/list_field_test.py
imports: from __future__ import absolute_import
  from __future__ import print_function
  import numpy
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.data import Token, Vocabulary
  from allennlp.data.fields import TextField, LabelField, ListField, IndexField, SequenceLabelField
  from allennlp.data.token_indexers import SingleIdTokenIndexer, TokenCharactersIndexer
label_desc: Use image node_id 10 for calling the TestListField obj's underlying member method code with example usage: obj.test_as_tensor_can_handle_multiple_token_indexers_and_empty_fields() without return types