📌  相关文章
📜  名称 tf.train.Optimizer 已弃用.请改用 tf.compat.v1.train.Optimizer. - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:23.497000             🧑  作者: Mango

代码示例1
# To make TensorFlow be more "Pythonic" in version 2.0, by design TF 2.0 does 
# not have tf.Session. TensorFlow 1.X requires users to manually stitch together
# an abstract syntax tree (the graph) by making tf.* API calls. It then requires
# users to manually compile the abstract syntax tree by passing a set of output
# tensors and input tensors to a session.run() call. TensorFlow 2.0 executes 
# eagerly (like Python normally does) and in 2.0, graphs and sessions should
# feel like implementation details.

# You could use:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()