update to torch 0.4
This commit is contained in:
@ -3,11 +3,10 @@ View more, visit my tutorial page: https://morvanzhou.github.io/tutorials/
|
||||
My Youtube Channel: https://www.youtube.com/user/MorvanZhou
|
||||
|
||||
Dependencies:
|
||||
torch: 0.1.11
|
||||
torch: 0.4
|
||||
matplotlib
|
||||
"""
|
||||
import torch
|
||||
from torch.autograd import Variable
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# torch.manual_seed(1) # reproducible
|
||||
@ -15,7 +14,9 @@ import matplotlib.pyplot as plt
|
||||
# fake data
|
||||
x = torch.unsqueeze(torch.linspace(-1, 1, 100), dim=1) # x data (tensor), shape=(100, 1)
|
||||
y = x.pow(2) + 0.2*torch.rand(x.size()) # noisy y data (tensor), shape=(100, 1)
|
||||
x, y = Variable(x, requires_grad=False), Variable(y, requires_grad=False)
|
||||
|
||||
# The code below is deprecated in Pytorch 0.4. Now, autograd directly supports tensors
|
||||
# x, y = Variable(x, requires_grad=False), Variable(y, requires_grad=False)
|
||||
|
||||
|
||||
def save():
|
||||
|
||||
Reference in New Issue
Block a user