Skip to content
This repository was archived by the owner on Aug 7, 2019. It is now read-only.

Commit a1d4e62

Browse files
zou3519soumith
authored andcommitted
Fix arange in docs. (pytorch#273)
In [the tutorial](https://pytorch.org/tutorials/beginner/blitz/neural_networks_tutorial.html), `torch.arange` is being used as a FloatTensor. This behavior was changed in pytorch/pytorch#7016 to return a LongTensor. I removed the `torch.arange` usage and instead construct a tensor with `torch.randn`
1 parent edfde13 commit a1d4e62

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

beginner_source/blitz/neural_networks_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def num_flat_features(self, x):
156156
# For example:
157157

158158
output = net(input)
159-
target = torch.arange(1, 11) # a dummy target, for example
159+
target = torch.randn(10) # a dummy target, for example
160160
target = target.view(1, -1) # make it the same shape as output
161161
criterion = nn.MSELoss()
162162

0 commit comments

Comments
 (0)