Perform multi-GPU training for a single mini-batch.
对单个小批量进行多 GPU 训练。
In order to implement data parallelism in a multi-GPU training scenario from scratch, we first import the required packages or modules.
为了从零开始实现多GPU训练中的数据并行,让我们先导入需要的包或模块。
Using a Multi-GPU Training Model
使用多 GPU 训练模型
Multi-GPU Training on a Single Mini-batch
单个小批量上的多 GPU 训练
We train the ResNet-18 model described in "ResNet" section on the CIFAR-10 data set. We will also apply the methods described in the "Gluon Implementation in Multi-GPU Computation" section, and use a multi-GPU training model.
Now, we can define the training function. Here the training function is slightly different from the one used in the previous chapter. For example, here, we need to copy all the model parameters to multiple GPUs based on data parallelism and perform multi-GPU training on a single mini-batch for each iteration.
Os exemplos servem apenas como ajuda na tradução da palavra ou da expressão procurada. Eles não são selecionados ou validados por nós e podem conter linguagem inapropriada. Pedimos que reporte exemplos que devem ser modificados ou que não devem ser exibidos. As traduções potencialmente sensivéis, impróprias ou coloquiais geralmente são marcadas em vermelho ou em laranja.