title: pytorch - gradients not calculated for parameters
body: <pre><code>a = torch.nn.Parameter(torch.randn(1, requires_grad=True, dtype=torch.float, device=device))
  b = torch.nn.Parameter(torch.randn(1, requires_grad=True, dtype=torch.float, device=device))
  c = a + 1
  d = torch.nn.Parameter(c, requires_grad=True,)
  for epoch in range(n_epochs):
      yhat = d + b * x_train_tensor
      error = y_train_tensor - yhat
      loss = (error ** 2).mean()
      loss.backward()
      print(a.grad)
      print(b.grad)
      print(c.grad)
      print(d.grad)
  </code></pre>
  
  <p>Prints out</p>
  
  <pre><code>None
  tensor([-0.8707])
  None
  tensor([-1.1125])
  </code></pre>
  
  <p>How do I learn the gradient for a and c? variable d needs to stay a parameter</p>