From 6456a5213eb8e807f639d82596da639fd4b79609 Mon Sep 17 00:00:00 2001 From: Richard Zou Date: Tue, 17 Jul 2018 16:06:38 -0400 Subject: [PATCH] Fix arange in docs. 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 https://github.com/pytorch/pytorch/pull/7016 to return a LongTensor. I removed the `torch.arange` usage and instead construct a tensor with `torch.randn` --- beginner_source/blitz/neural_networks_tutorial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beginner_source/blitz/neural_networks_tutorial.py b/beginner_source/blitz/neural_networks_tutorial.py index f9405c6b078..10c774f8ed3 100644 --- a/beginner_source/blitz/neural_networks_tutorial.py +++ b/beginner_source/blitz/neural_networks_tutorial.py @@ -156,7 +156,7 @@ def num_flat_features(self, x): # For example: output = net(input) -target = torch.arange(1, 11) # a dummy target, for example +target = torch.randn(10) # a dummy target, for example target = target.view(1, -1) # make it the same shape as output criterion = nn.MSELoss()