My cuda works well in cnn,but when i run rnn.cuda, it is error? I donot know what is wrong?(NVIDIA GeForce GTX1070, cuda 9.0)please help me!
【my code】:
model = Rnn(28, 128, 2, 10)
use_gpu = torch.cuda.is_available()
if use_gpu:
model = model.cuda()
【ERROR】:
Traceback (most recent call last):
File “”, line 1, in
runfile(‘C:/Users/yd/.spyder-py3/MyTorch/pytorch-beginner-master/05-Recurrent Neural Network/recurrent_network.py’, wdir=‘C:/Users/yd/.spyder-py3/MyTorch/pytorch-beginner-master/05-Recurrent Neural Network’)
File “D:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize. py”, line 710, in runfile
execfile(filename, namespace)
File “D:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize. py”, line 101, in execfile
exec(compile(f.read(), filename, ‘exec’), namespace)
File “C:/Users/yd/.spyder-py3/MyTorch/pytorch-beginner-master/05-Recurrent Neural Network/recurrent_network. py”, line 49, in
model = model.cuda()
File “D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module. py”, line 147, in cuda
return self._apply(lambda t: t.cuda(device_id))
File “D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module. py”, line 118, in _apply
module._apply(fn)
File “D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\rnn. py”, line 116, in _apply
self.flatten_parameters()
File “D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\rnn. py”, line 95, in flatten_parameters
fn.rnn_desc = rnn.init_rnn_descriptor(fn, handle)
File “D:\ProgramData\Anaconda3\lib\site-packages\torch\backends\cudnn\rnn. py”, line 54, in init_rnn_descriptor
fn.datatype
File “D:\ProgramData\Anaconda3\lib\site-packages\torch\backends\cudnn_init_.py”, line 229, in init
if version() >= 6000:
TypeError: ‘>=’ not supported between instances of ‘NoneType’ and ‘int’