code: def test_run(self):
      padder = TorchTensorPadder(
          pad_val=-1, ele_dtype=torch.zeros(3).dtype, dtype=int
      )
      a = [torch.zeros(3), torch.zeros(2), torch.zeros(0)]
      a = padder(a)
      shape = a.shape
      assert isinstance(a, torch.Tensor)
      assert tuple(shape) == (3, 3)
      b = torch.LongTensor([[0, 0, 0], [0, 0, -1], [-1, -1, -1]])
      assert (a == b).sum().item() == shape[0] * shape[1]
  
      a = [
          torch.zeros((3, 2)),
          torch.zeros((2, 2)),
          torch.zeros((1, 2)),
      ]
      a = padder(a)
      shape = a.shape
      assert isinstance(a, torch.Tensor)
      assert tuple(shape) == (3, 3, 2)
      b = torch.LongTensor(
          [
              [[0, 0], [0, 0], [0, 0]],
              [[0, 0], [0, 0], [-1, -1]],
              [[0, 0], [-1, -1], [-1, -1]],
          ]
      )
      assert (a == b).sum().item() == shape[0] * shape[1] * shape[2]
  
      a = [
          torch.zeros((3, 2)),
          torch.zeros((2, 2)),
          torch.zeros((1, 1)),
      ]
      a = padder(a)
      shape = a.shape
      assert isinstance(a, torch.Tensor)
      assert tuple(shape) == (3, 3, 2)
      b = torch.LongTensor(
          [
              [[0, 0], [0, 0], [0, 0]],
              [[0, 0], [0, 0], [-1, -1]],
              [[0, -1], [-1, -1], [-1, -1]],
          ]
      )
      assert (a == b).sum().item() == shape[0] * shape[1] * shape[2]
  
      padder = TorchTensorPadder(
          pad_val=-1, ele_dtype=torch.zeros(3).dtype, dtype=int
      )
      a = [
          torch.zeros((3, 2)),
          torch.zeros((2, 2)),
          torch.zeros((1, 0)),
      ]
      a = padder(a)
      shape = a.shape
      assert isinstance(a, torch.Tensor)
      assert tuple(shape) == (3, 3, 2)
      b = torch.LongTensor(
          [
              [[0, 0], [0, 0], [0, 0]],
              [[0, 0], [0, 0], [-1, -1]],
              [[-1, -1], [-1, -1], [-1, -1]],
          ]
      )
      assert (a == b).sum().item() == shape[0] * shape[1] * shape[2]
  
      padder = TorchTensorPadder(
          pad_val=-1, ele_dtype=torch.zeros(3).dtype, dtype=None
      )
      a = [np.zeros((3, 2)), np.zeros((2, 2)), np.zeros((1, 0))]
      a = padder(a)
      shape = a.shape
      assert isinstance(a, torch.Tensor)
      assert tuple(shape) == (3, 3, 2)
      b = torch.FloatTensor(
          [
              [[0, 0], [0, 0], [0, 0]],
              [[0, 0], [0, 0], [-1, -1]],
              [[-1, -1], [-1, -1], [-1, -1]],
          ]
      )
      assert (a == b).sum().item() == shape[0] * shape[1] * shape[2]
  
file_path: fastNLP/tests/core/collators/padders/test_torch_padder.py
imports: import numpy
  import pytest
  from fastNLP.core.collators.padders.torch_padder import TorchTensorPadder, TorchSequencePadder, TorchNumberPadder
  from fastNLP.core.collators.padders.exceptions import DtypeError
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
label_desc: Use image node_id 1 for calling the TestTorchTensorPadder obj's underlying member method code with example usage: obj.test_run() without return types