title: pytorch loss.backward() keeps running for hours
body: <p>I am using pytorch to train some x-ray images but I ran into the following issue:</p>
  
  <p>in the line : <code>loss.backward()</code>, the program just keeps running and never end, and there is no error or warning.</p>
  
  <pre><code>            loss, outputs = self.forward(images, targets)  
              loss = loss / self.accumulation_steps
              print("loss calculated: " + str(loss))
  
              if phase == "train":
                  print("running loss backwarding!") 
                  loss.backward()
                  print("loss is backwarded!")
                  if (itr + 1 ) % self.accumulation_steps == 0:
                      self.optimizer.step()
                      self.optimizer.zero_grad()
  </code></pre>
  
  <p>The loss calculated before this is something like <code>tensor(0.8598, grad_fn=&lt;DivBackward0&gt;)</code>.</p>
  
  <p>Could anyone help me with why this keeps running or any good ways to debug the backward() function?</p>
  
  <p>I am using torch 1.2.0+cu92 with the compatible cuda 10.0.</p>
  
  <p>Thank you so much!!</p>