Cuda unkown error

Because of some issue i removed pytorch and again installed it, after that i am getting this error on running my models

File "train_unet.py", line 46, in <module>
    g = UNet(3).type(dtype)
  File "/data/anaconda2/lib/python2.7/site-packages/torch/nn/modules/modul
e.py", line 277, in type
    return self._apply(lambda t: t.type(dst_type))
  File "/data/anaconda2/lib/python2.7/site-packages/torch/nn/modules/modul
e.py", line 185, in _apply
    module._apply(fn)
  File "/data/anaconda2/lib/python2.7/site-packages/torch/nn/modules/modu$
e.py", line 185, in _apply
    module._apply(fn)

  File "/data/anaconda2/lib/python2.7/site-packages/torch/nn/modules/modu$
e.py", line 185, in _apply
    module._apply(fn)
  File "/data/anaconda2/lib/python2.7/site-packages/torch/nn/modules/modu$
e.py", line 185, in _apply
    module._apply(fn)
  File "/data/anaconda2/lib/python2.7/site-packages/torch/nn/modules/modu$
e.py", line 191, in _apply
    param.data = fn(param.data)
  File "/data/anaconda2/lib/python2.7/site-packages/torch/nn/modules/modu$
e.py", line 277, in <lambda>
    return self._apply(lambda t: t.type(dst_type))
RuntimeError: CUDA error: unknown error

How to fix this?

Do you get the same error using dummy CUDA calls like:

torch.cuda.init()
# or
a = torch.randn(1, device='cuda')

Did you update the NVIDIA drivers? If so, I would restart the machine and see, if the error disappears.

No, actually the pytorch version got updated to 0.4 which was not compatible with cuda version ,so i downgraded it to 0.3, now everything is working fine. Thanks