From e19eb5d0601e4ed70c8520c0a949737b69b73dfc Mon Sep 17 00:00:00 2001 From: Ayush Chaurasia Date: Tue, 29 May 2018 21:02:10 +0530 Subject: [PATCH] Remove deprecated code The use of Variable() explicitly is deprecated as Autograd now supports tensors directly. --- tutorial-contents/301_regression.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tutorial-contents/301_regression.py b/tutorial-contents/301_regression.py index 897d3e8..4c67c90 100644 --- a/tutorial-contents/301_regression.py +++ b/tutorial-contents/301_regression.py @@ -17,8 +17,8 @@ x = torch.unsqueeze(torch.linspace(-1, 1, 100), dim=1) # x data (tensor), shape y = x.pow(2) + 0.2*torch.rand(x.size()) # noisy y data (tensor), shape=(100, 1) # torch can only train on Variable, so convert them to Variable -x, y = Variable(x), Variable(y) - +#x, y = Variable(x), Variable(y) +#The above code is depricated. Now,autograd directly supports tensors # plt.scatter(x.data.numpy(), y.data.numpy()) # plt.show() @@ -60,4 +60,4 @@ for t in range(100): plt.pause(0.1) plt.ioff() -plt.show() \ No newline at end of file +plt.show()