    <span class="n">loss</span> <span class="o">=</span> <span class="n">softmax_cross_entropy_with_logits</span><span class="p">(</span><span class="n">labels</span><span class="o">=</span><span class="n">y</span><span class="p">,</span> <span class="n">logits</span><span class="o">=</span><span class="n">logits</span><span class="p">)</span>
      <span class="k">if</span> <span class="n">targeted</span><span class="p">:</span>
        <span class="n">loss</span> <span class="o">=</span> <span class="o">-