AttributeError: module 'tensorflow' has no attribute 'config'怎么解决?

import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))


我也有相同的问题。关键在于我用jupyter notebook打开是可以运行的,但用vscode打开就运行不了。我的tf版本是2.4

我也有相同的问题。关键在于我用jupyter notebook打开是可以运行的,但用vscode打开就运行不了。我的tf版本是2.4

我的tensorflow是1.9的,也有这个问题,该怎么解决啊

tensorflow2.0么,和tf1.x相比有改动
tf.compat.v1.config 试试看