bolero
bolero

Reputation: 311

tensorflow Variable Initialization error : Attempting to use uninitialized value Variable

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:

  1. tf.global_variables_initializer()
  2. tf.local_variables_initializer()

Upvotes: 0

Views: 2614

Answers (1)

Maxim
Maxim

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

Related Questions