docstr: 检查得到的torch张量的工具函数
docstr_tok: ["\u68c0\u67e5\u5f97\u5230\u7684torch\u5f20\u91cf\u7684\u5de5\u5177\u51fd\u6570"]
code: def check_torch_tensor(self, tensor, device, requires_grad):
      """
      检查得到的torch张量的工具函数
      """
  
      assert isinstance(tensor, torch.Tensor)
      if device == "cpu":
          assert not tensor.is_cuda
      else:
          assert tensor.is_cuda
          assert tensor.device.index == torch.device(device).index
      assert tensor.requires_grad == requires_grad
  
imports: import pytest
  from fastNLP.envs.imports import _NEED_IMPORT_JITTOR, _NEED_IMPORT_PADDLE, _NEED_IMPORT_TORCH
  from fastNLP.modules.mix_modules.utils import paddle2torch, torch2paddle, jittor2torch, torch2jittor
label_desc: Use image node_id 1 for calling the TestJittor2Torch obj's underlying member method code with example usage: obj.check_torch_tensor(tensor, device, requires_grad) without return types