A buffer shouldn’t require gradients. Instead use nn.Parameter if your tensor should require gradients (by default requires_grad will be True). Generally, you can now pass the requires_grad argument to torch.tensor(1, requires_grad=True).