mirror of
https://github.com/yunjey/pytorch-tutorial.git
synced 2025-07-05 00:24:02 +08:00
Merge pull request #128 from timctho/master
Fix requires_grad=True needs float tensor
This commit is contained in:
@ -23,9 +23,9 @@ import torchvision.transforms as transforms
|
||||
# ================================================================== #
|
||||
|
||||
# Create tensors.
|
||||
x = torch.tensor(1, requires_grad=True)
|
||||
w = torch.tensor(2, requires_grad=True)
|
||||
b = torch.tensor(3, requires_grad=True)
|
||||
x = torch.tensor(1., requires_grad=True)
|
||||
w = torch.tensor(2., requires_grad=True)
|
||||
b = torch.tensor(3., requires_grad=True)
|
||||
|
||||
# Build a computational graph.
|
||||
y = w * x + b # y = 2 * x + 3
|
||||
|
Reference in New Issue
Block a user