@ptrblck
I have found the reason for the error. I moved my model to gpu by model.cuda(). Then I created some new tensors in this model without moving them to gpu. But  why the traceback indicate the error RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED.