title: Debugging in Google Colab
body: <p>I am running the following code snippet in google colab in a single cell:</p>
  
  <pre><code>%debug
  # Create tensors of shape (10, 3) and (10, 2).
  x = torch.randn(10, 3)
  y = torch.randn(10, 2)
  
  # Build a fully connected layer.
  linear = nn.Linear(3, 2)
  print ('w: ', linear.weight)
  print ('b: ', linear.bias)
  </code></pre>
  
  <p>I wish to debug a piece of code (step through it line by line) to understand what is going on. I wish to step inside the function nn.Linear. </p>
  
  <p>However, when I step through, it does not enter the function at  all. Is there a way to step through nn.Linear line by line? Also, how exactly do I set a breakpoint in nn.Linear? Besides, I wish to step though the snippet line by line as well. However, as the picture shows, the step command automatically steps through and executes the print statement as well.</p>
  
  <p><a href="https://i.stack.imgur.com/PSBvV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PSBvV.png" alt="Step_though_collab"></a></p>