Model.cuda can't work

I don’t know how to figure the follow problem.

Traceback (most recent call last):
  File "pos.py", line 177, in <module>
    model = model.cuda()
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 147, in cuda
    return self._apply(lambda t: t.cuda(device_id))
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 118, in _apply
    module._apply(fn)
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/rnn.py", line 116, in _apply
    self.flatten_parameters()
  File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/rnn.py", line 78, in flatten_parameters
    handle = cudnn.get_handle()
  File "/usr/local/lib/python3.5/dist-packages/torch/backends/cudnn/__init__.py", line 268, in get_handle
    handle = CuDNNHandle()
  File "/usr/local/lib/python3.5/dist-packages/torch/backends/cudnn/__init__.py", line 87, in __init__
    check_error(lib.cudnnCreate(ctypes.byref(ptr)))
  File "/usr/local/lib/python3.5/dist-packages/torch/backends/cudnn/__init__.py", line 255, in check_error
    raise CuDNNError(status)
torch.backends.cudnn.CuDNNError: 4: b'CUDNN_STATUS_INTERNAL_ERROR'
Exception ignored in: <bound method CuDNNHandle.__del__ of <torch.backends.cudnn.CuDNNHandle object at 0x7fae98efdcf8>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/torch/backends/cudnn/__init__.py", line 91, in __del__
    check_error(lib.cudnnDestroy(self))
ctypes.ArgumentError: argument 1: <class 'TypeError'>: Don't know how to convert parameter 1

Yikes. Could you post some more details (what code you’re running, version of pytorch, your system cuda/cudnn setup?)

I am running a simple lstm model.
Here is the main code.https://paste.ubuntu.com/26301189/
The pytorch version is 0.2.0_3.
The cuda version is 8.0.61.

In fact, I was able to run this code successfully last week. So I have no idea where the bug come from.

I’m not sure why your model would work last week but not now, if you haven’t changed anything. Does upgrading pytorch to 0.3 help?