docstr: 检查张量是否在指定的设备上的工具函数
docstr_tok: ["\u68c0\u67e5\u5f20\u91cf\u662f\u5426\u5728\u6307\u5b9a\u7684\u8bbe\u5907\u4e0a\u7684\u5de5\u5177\u51fd\u6570"]
code: def check_gpu(self, tensor, idx):
      """
      检查张量是否在指定的设备上的工具函数
      """
  
      assert tensor.place.is_gpu_place()
      assert tensor.place.gpu_device_id() == idx
  
file_path: fastNLP/tests/core/utils/test_paddle_utils.py
imports: import os
  import pytest
  from fastNLP.core.utils.paddle_utils import _convert_data_device, paddle_to, paddle_move_data_to_device
  from fastNLP.envs.imports import _NEED_IMPORT_PADDLE
label_desc: Use image node_id 1 for calling the TestPaddleMoveDataToDevice obj's underlying member method code with example usage: obj.check_gpu(tensor, idx) without return types