Skip to content

Commit 6fe5ff5

Browse files
authored
Merge pull request yunjey#128 from timctho/master
Fix requires_grad=True needs float tensor
2 parents 9219526 + 2bfebb0 commit 6fe5ff5

File tree

1 file changed

+3
-3
lines changed
  • tutorials/01-basics/pytorch_basics

1 file changed

+3
-3
lines changed

tutorials/01-basics/pytorch_basics/main.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
# ================================================================== #
2424

2525
# Create tensors.
26-
x = torch.tensor(1, requires_grad=True)
27-
w = torch.tensor(2, requires_grad=True)
28-
b = torch.tensor(3, requires_grad=True)
26+
x = torch.tensor(1., requires_grad=True)
27+
w = torch.tensor(2., requires_grad=True)
28+
b = torch.tensor(3., requires_grad=True)
2929

3030
# Build a computational graph.
3131
y = w * x + b # y = 2 * x + 3

0 commit comments

Comments
 (0)