PyTorchZeroToAll icon indicating copy to clipboard operation
PyTorchZeroToAll copied to clipboard

Replace deprecated `Variable` class

Open fredpolicarpo opened this issue 7 years ago • 2 comments
trafficstars

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

fredpolicarpo avatar Aug 09 '18 04:08 fredpolicarpo

I really don't get why everyone is still using Variable. It's deprefuckingcated :laughing:

Vermeille avatar Feb 08 '19 16:02 Vermeille

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

Thanks for the update. It is funny when I code in PyCharm because the IDE suggests the 'w = torch.tensor([1.0], requires_grad=True)' is discouraged...

hchen98 avatar Mar 11 '20 02:03 hchen98