As you’ve already mentioned, the cudnn error might be raised, if you are in fact running out of memory.
Try to reduce the batch size until the use case fits in your GPU memory and let us know, if you still encounter a cudnn error.