[CUDA warning]

I encountered the problem when I was running the WGAN-GP code by pytorch in python.(There is no error when I remove the gradient penalty part in the program.)
The following is the content of the error:
D:\anaconda3\envs\py312\Lib\site-packages\torch\autograd\graph.py:825: UserWarning: Attempting to run cuBLAS, but there was no current CUDA context! Attempting to set the primary context… (Triggered internally at C:\cb\pytorch_1000000000000\work\aten\src\ATen\cuda\CublasHandlePool.cpp:135.)
return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass

I suggest asking pytorch questions on a pytorch forum such as discuss.pytorch.org There are CUDA experts that patrol that forum.

Attempting to run CUBLAS with no primary context is a user coding error, not a CUDA or CUBLAS defect. The problem needs to be dealt with upstream, such as in pytorch ATen, or higher up.

thanks