I would recommend to update to the latest PyTorch version, if you are using an older one.
If you are already using the latest release, could you post an executable code snippet, which would recreate the issue and post your setup (GPU, CUDA version, cudnn version, PyTorch version)?
Also, as a workaround you could try to use torch.backends.cudnn.benchmark=True or disable cudnn via torch.backends.cudnn.enabled=False.