tf.global_variables_initializer().run() AttributeError: ‘NoneType‘ object has no attribute ‘run‘

提示错误:in tf.compat.v1.global_variables_initializer().run() AttributeError: 'NoneType' object has no attribute 'run'
或者:The Session graph is empty. Add operations to the graph before calling run().的解决办法:
在sess之前添加tf.compat.v1.disable_eager_execution()

你可能感兴趣的:(tensorflow)