快捷方式

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)[source][source]

在 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])

返回值

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

返回型別

Tensor

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源