From 04e3d04bcf91d38a1213918eba70dc43e9b0ce45 Mon Sep 17 00:00:00 2001 From: Shishir Patil Date: Tue, 23 Apr 2019 14:53:17 +0530 Subject: [PATCH] moving input data to device --- beginner_source/blitz/cifar10_tutorial.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beginner_source/blitz/cifar10_tutorial.py b/beginner_source/blitz/cifar10_tutorial.py index 1fe8343a792..d84e2fab7e0 100644 --- a/beginner_source/blitz/cifar10_tutorial.py +++ b/beginner_source/blitz/cifar10_tutorial.py @@ -160,7 +160,7 @@ def forward(self, x): running_loss = 0.0 for i, data in enumerate(trainloader, 0): - # get the inputs + # get the inputs; data is a list of [inputs, labels] inputs, labels = data # zero the parameter gradients @@ -295,7 +295,7 @@ def forward(self, x): # # .. code:: python # -# inputs, labels = inputs.to(device), labels.to(device) +# inputs, labels = data[0].to(device), data[1].to(device) # # Why dont I notice MASSIVE speedup compared to CPU? Because your network # is realllly small.