<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Autograd on Programmer.ie: Modern AI programming</title>
    <link>http://programmer.ie/tags/autograd/</link>
    <description>Recent content in Autograd on Programmer.ie: Modern AI programming</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 08 Aug 2026 12:55:00 +0100</lastBuildDate>
    <atom:link href="http://programmer.ie/tags/autograd/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>PyTorch Autograd Debugging: requires_grad, detach, backward() and NaN Gradients</title>
      <link>http://programmer.ie/post/pytorch-zero-to-hero-02/</link>
      <pubDate>Sat, 08 Aug 2026 12:55:00 +0100</pubDate>
      <guid>http://programmer.ie/post/pytorch-zero-to-hero-02/</guid>
      <description>&lt;h2 id=&#34;pytorch-zero-to-hero--step-02&#34;&gt;PyTorch: Zero to Hero — Step 02&lt;/h2&gt;&#xA;&lt;p&gt;In the previous post we treated tensor shapes as a debugging problem rather than a mathematical vocabulary exercise.&lt;/p&gt;&#xA;&lt;p&gt;We are going to do the same thing with autograd.&lt;/p&gt;&#xA;&lt;p&gt;If you use PyTorch for any serious amount of time, you eventually see errors like:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;or:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;RuntimeError: Trying to backward through the graph a second time...&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;or worse:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
