cs230-code-examples icon indicating copy to clipboard operation
cs230-code-examples copied to clipboard

The Variable API has been deprecated in Pytorch 1.10

Open juansulloa opened this issue 3 years ago • 0 comments

The Variable API has been deprecated in Pytorch 1.10.

From Pytorch 1.10 documentation: "Autograd automatically supports Tensors with requires_grad set to True Variables are no longer necessary to use autograd with tensors."

The code can be further simplified if lines with Variable calls are removed. For example lines 56-57 of train.pyfile:

# convert to torch Variables
train_batch, labels_batch = Variable(train_batch), Variable(labels_batch)

juansulloa avatar Nov 09 '21 21:11 juansulloa