在tf.train.string_input_producer上设置num_epochs会产生错误

Jer*_*ewi 4 tensorflow

在tf.train.string_input_producerto上设置num_epochs以外的任何其他内容都会产生错误

Attempting to use uninitialized value input_producer/limit_epochs/epoch
Run Code Online (Sandbox Code Playgroud)

是什么导致这种情况以及如何解决?

Jer*_*ewi 9

此错误是由未初始化局部变量引起的.要确保初始化局部变量,您应该执行以下操作.

init_op = tf.group(tf.global_variables_initializer(),
                   tf.local_variables_initializer())
sess.run(init_op)
Run Code Online (Sandbox Code Playgroud)