import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
我也有相同的问题。关键在于我用jupyter notebook打开是可以运行的,但用vscode打开就运行不了。我的tf版本是2.4