[size=16 px] nvidia 1660 s, the first to install tensorflow - gpu2.1.0, found that tf. Test_is_gpu_available () is True, but a run resnet18, CPU100 % usage, and the GPU is almost untouched, all kinds of search, to find the cause of the problem,
Before this problem bothering me for a long time, really thought it was a version is too high, from tensorflow - gpu2.10 to 2.0.0, or not, the corresponding cuda, cudnn version also is according to the corresponding official documents,
Had almost gave up, carefully check the error message:
The Loaded runtime CuDNN library: 7.4.1 but the source was compiled with: 7.6.0.
Then download the 7.6.0 cudnn, replace, there is a problem again:
Could not create cublas handle: CUBLAS_STATUS_ALLOC_FAILED
It doesn't matter, continue to search,
Online solutions
The config=tf. ConfigProto ()
The session=tf. The session (config=config)
Also not line, this is tensorflow1. X version of the code, so let's add tf.com. Pat v1, otherwise cannot find ConfigProto module,
To:
The config=tf.com pat. V1. ConfigProto ()
The session=tf. The session (config=config)
The results also not line,
Finally found less one line of code, as shown in figure:
We focus on the red box code, the rest of the code is to search out, but tried no matter use,
Hope for the same problem, help, [/size]