https://github.com/hunkim/PyTorchZeroToAll/blob/edd7ba1f19a8d2e74188d6caf6b020dc20130e53/03_auto_gradient.py#L7 The class `torch.autograd.Variable` is deprecated. This line must be updated to `w = torch.tensor([1.0], requires_grad=True) # Any random value`