捷徑

torch.nn.functional.torch.nn.parallel.data_parallel

torch.nn.parallel.data_parallel(module, inputs, device_ids=None, output_device=None, dim=0, module_kwargs=None)[原始碼][原始碼]

在 device_ids 中指定的 GPU 上並行評估 module(input)。

這是 DataParallel 模組的函數式版本。

參數
  • module (Module) – 要並行評估的模組

  • inputs (Tensor) – 模組的輸入

  • device_ids (list of int or torch.device) – 要在上面複製模組的 GPU ID

  • output_device (list of int or torch.device) – 輸出所在的 GPU 位置。 使用 -1 表示 CPU。(預設:device_ids[0])

返回

一個包含 module(input) 結果的 Tensor,位於 output_device 上

返回類型

Tensor

文件

訪問 PyTorch 的全面開發者文檔

查看文檔

教程

獲取初學者和高級開發者的深入教程

查看教程

資源

查找開發資源並獲取問題解答

查看資源