quot;&quot;</span>

        <span class="c1"># Calculate and reduce average loss and metrics per GPU</span>
        <span class="n">loss_and_metrics</span> <span class="o">=</span> <span class="n">average_loss_and_metrics</span><span class="p">(</span><span class="n">output_batch</span><span class="p">,</span> <span class="s1">&#39;avg_train&#39;</span><span class="p">)</span>
        <span class="n">loss_and_metrics</span> <span class="o">=</span> <span class="n">reduce_dict</span><span class="p">(</span><