Pietro Marchesi
Pietro Marchesi

Reputation: 882

Pytorch .backward() method without CUDA

I am trying to run the code in the Pytorch tutorial on the autograd module. However, when I run the .backwards() call, I get the error:

cuda runtime error (38) : no CUDA-capable device is detected at torch/csrc/autograd/engine.cpp:359

I admittedly have no CUDA-capable device set up at the moment, but it was my understanding that this wasn't strictly necessary (at least I didn't find it specified anywhere in the tutorial). So I was wondering if there is a way to still run the code without a CUDA-enabled GPU.

Upvotes: 2

Views: 718

Answers (1)

russel
russel

Reputation: 343

You should transfer you network, inputs, and labels onto the cpu using: net.cpu(), Variable(inputs.cpu()), Variable(labels.cpu())

Upvotes: 1

Related Questions