code: def test_batch_encoding_pickle_pt(self):
      import torch
  
      tokenizer_p = BertTokenizer.from_pretrained("bert-base-cased")
      tokenizer_r = BertTokenizerFast.from_pretrained("bert-base-cased")
  
      with self.subTest(
          "BatchEncoding (Python, return_tensors=PYTORCH)"
      ):
          self.assert_dump_and_restore(
              tokenizer_p(
                  "Small example to encode",
                  return_tensors=TensorType.PYTORCH,
              ),
              torch.equal,
          )
  
      with self.subTest("BatchEncoding (Rust, return_tensors=PYTORCH)"):
          self.assert_dump_and_restore(
              tokenizer_r(
                  "Small example to encode",
                  return_tensors=TensorType.PYTORCH,
              ),
              torch.equal,
          )
  
imports: import os
  import pickle
  import tempfile
  import unittest
  from typing import Callable, Optional
  import numpy
  from transformers import PreTrainedTokenizerFast
  from transformers import BatchEncoding, BertTokenizer, BertTokenizerFast, PreTrainedTokenizer, TensorType, TokenSpan, is_tokenizers_available
  from transformers.models.gpt2.tokenization_gpt2 import GPT2Tokenizer
  from transformers.testing_utils import CaptureStderr, require_flax, require_tf, require_tokenizers, require_torch, slow
label_desc: Use image node_id 7 for calling the TokenizerUtilsTest obj's underlying member method code with example usage: obj.test_batch_encoding_pickle_pt() without return types