code: def get_oneflow_device(device):
      """
      构造一个 :class:`oneflow.device` 实例并返回。
  
      :param device: 字符串或 gpu 编号
      :return: :class:`oneflow.device`
      """
      if isinstance(device, oneflow.device):
          return device
      if isinstance(device, int):
          return oneflow.device("cuda", device)
      if isinstance(device, str):
          return oneflow.device(device)
      raise RuntimeError(f"Cannot get `oneflow.device` from {device}.")
  
file_path: fastNLP/fastNLP/core/utils/oneflow_utils.py
imports: import os
  from typing import Any, Union, Optional
  from fastNLP.envs.env import FASTNLP_DISTRIBUTED_CHECK
  from fastNLP.envs.imports import _NEED_IMPORT_ONEFLOW
  from .utils import apply_to_collection
label_desc: Use image node_id 1 for calling a global function with example usage: get_oneflow_device(device) and returns: device, oneflow, oneflow