更新时间:2023-12-02 18:58:40
我怀疑错误是因为在 save_model.py
中你声明变量为 tf.float32
类型code>(1.32
和 1.33
的隐式类型),而在 restore_model.py
中,您将变量定义为具有 tf.int32
(0
的隐式类型).
I suspect the error is raised because in save_model.py
you declare the variables as having type tf.float32
(the implicit type of 1.32
and 1.33
), whereas in restore_model.py
you define the variables as having type tf.int32
(the implicit type of 0
).
最简单的解决方案是修改 restore_model.py
以将变量声明为 tf.float32
.例如,您可以执行以下操作:
The easiest solution would be to modify restore_model.py
to declare the variables as tf.float32
. For example, you could do the following:
v1 = tf.Variable(0.0, name="v1")
v2 = tf.Variable(0.0, name="v2")