Commit 339ac50d authored by Davis King's avatar Davis King

Fixed double counting of mini-batches for the purposes of solver termination

when multiple GPUs are used.
parent 0f180a68
......@@ -513,8 +513,10 @@ namespace dlib
for (size_t i = 0; i < devices.size(); ++i)
losses[i] = std::async(std::launch::async,[&,i](){ return compute_parameter_gradients(i, next_job, pick_which_run_update); });
// aggregate loss values from all the network computations.
double theloss = 0;
for (auto&& loss : losses)
record_loss(loss.get());
theloss += loss.get();
record_loss(theloss/losses.size());
// Now, if there is more than one active device we need to synchronize the
// gradient updates between devices. So we do that now.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment