Reputation: 311
Why is this happening? Error message - Attempting to uninitialized Variable Error here is my source: source - Learning .JPG Image in computer using tensorflow
I don't know why this error occur... I already used two types of variable initialization function:
tf.global_variables_initializer()
tf.local_variables_initializer()
Upvotes: 0
Views: 2614
Reputation: 53758
You should use tf.global_variables_initializer()
and invoke it after you defined all the variables, not before. The simplest thing would be to do simply:
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
...
Upvotes: 1