解决AttributeError: module ‘tensorflow‘ has no attribute ‘ConfigProto‘

解决AttributeError: module ‘tensorflow’ has no attribute ‘ConfigProto’

错误

执行tf.ConfigProto时报错
在这里插入图片描述

错误产生原因

这是由于tensorflow 2.0版本与1.0版本的用法不兼容导致的

错误解决方法

将tf.ConfigProto改为tf.compat.v1.ConfigProto
即可解决
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/zjlwdqca/article/details/111414184