code: def oneflow_move_data_to_device(
      batch: Any, device: Optional[Union[str, "oneflow.device"]] = None
  ) -> Any:
      r"""
      在 **oneflow** 中将数据集合 ``batch`` 传输到给定设备。
  
      :param batch: 需要迁移的数据
      :param device: 数据应当迁移到的设备；当该参数的值为 ``None`` 时则不执行任何操作
      :return: 迁移到新设备上的数据集合
      """
      if device is None:
          return batch
  
      def batch_to(data: Any) -> Any:
          data_output = data.to(device)
          if data_output is not None:
              return data_output
          # user wrongly implemented the `TransferableDataType` and forgot to return `self`.
          return data
  
      return apply_to_collection(
          batch, dtype=oneflow.Tensor, function=batch_to
      )
  
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 2 for calling a global function with example usage: oneflow_move_data_to_device(batch, device) and returns: apply_to_collection, batch, data, data_output