What does tf.global_variables_initializer() do under the hood?

Viewed 11149

There have been many cases (here and here) of TensorFlow users adding

init_op = tf.global_variables_initializer()

before defining any variables or operations and then getting an error along the lines of

Attempting to use uninitialized value

There is an explanation here but it makes no mention of the underlying tf.global_variables_initializer calls. It's almost copying TF API wholesale. This question focuses on the fact that there are still uninitialized values when some users call sess.run(init_op). Example code and an analysis into what tf.global_variables_initializer would be great.

2 Answers
Related