code: def test_batch_encode_plus_tensors(self):
      tokenizers = self.get_tokenizers(do_lower_case=False)
      for tokenizer in tokenizers:
          with self.subTest(f"{tokenizer.__class__.__name__}"):
              words, boxes = self.get_words_and_boxes_batch()
  
              # A Tensor cannot be build by sequences which are not the same size
              self.assertRaises(
                  ValueError,
                  tokenizer.batch_encode_plus,
                  words,
                  boxes=boxes,
                  return_tensors="pt",
              )
              self.assertRaises(
                  ValueError,
                  tokenizer.batch_encode_plus,
                  words,
                  boxes=boxes,
                  return_tensors="tf",
              )
  
              if tokenizer.pad_token_id is None:
                  self.assertRaises(
                      ValueError,
                      tokenizer.batch_encode_plus,
                      words,
                      boxes=boxes,
                      padding=True,
                      return_tensors="pt",
                  )
                  self.assertRaises(
                      ValueError,
                      tokenizer.batch_encode_plus,
                      words,
                      boxes=boxes,
                      padding="longest",
                      return_tensors="tf",
                  )
              else:
                  pytorch_tensor = tokenizer.batch_encode_plus(
                      words,
                      boxes=boxes,
                      padding=True,
                      return_tensors="pt",
                  )
                  tensorflow_tensor = tokenizer.batch_encode_plus(
                      words,
                      boxes=boxes,
                      padding="longest",
                      return_tensors="tf",
                  )
                  encoded_sequences = tokenizer.batch_encode_plus(
                      words, boxes=boxes, padding=True
                  )
  
                  for key in encoded_sequences.keys():
                      pytorch_value = pytorch_tensor[key].tolist()
                      tensorflow_value = (
                          tensorflow_tensor[key].numpy().tolist()
                      )
                      encoded_value = encoded_sequences[key]
  
                      self.assertEqual(
                          pytorch_value, tensorflow_value, encoded_value
                      )
  
imports: import inspect
  import shutil
  import tempfile
  import unittest
  from typing import List
  from transformers import AddedToken, LayoutXLMTokenizerFast, SpecialTokensMixin, is_tf_available, is_torch_available, logging
  from transformers.models.layoutxlm.tokenization_layoutxlm import LayoutXLMTokenizer
  from transformers.testing_utils import get_tests_dir, is_pt_tf_cross_test, require_pandas, require_scatter, require_sentencepiece, require_tokenizers, require_torch, slow
  from ...test_tokenization_common import SMALL_TRAINING_CORPUS, TokenizerTesterMixin, filter_non_english, merge_model_tokenizer_mappings
label_desc: Use image node_id 40 for calling the LayoutXLMTokenizationTest obj's underlying member method code with example usage: obj.test_batch_encode_plus_tensors() without return types