with tf.compat.v1.Session() as sess:
model = Model(reversed_dict,article_max_len,summary_max_len,args)
sess.run(tf.compat.v1.global_variables_initializer())
saver = tf.compat.v1.train.Saver(tf.compat.v1.global_variables())
我收到此错误:
---------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-19-42e9e3d94e79> in <module>
37 model = Model(reversed_dict,args)
38 sess.run(tf.compat.v1.global_variables_initializer())
---> 39 saver = tf.compat.v1.train.Saver(tf.compat.v1.global_variables())
ValueError: No variables to save
我认为通过初始化全局变量创建了“要保存的变量”?从tf1到tf2.0有什么中断吗?
背景:这是我正在开发的2.0版的tensorflow 1.0代码