1

In Tensorflow, what is the difference in global_variables_initializer() and initialize_all_variables()? I had used both methods to initialize the variables.

nbro
  • 15,395
  • 32
  • 113
  • 196
  • Possible duplicate of [What are the differences between tf.initialize\_all\_variables() and tf.global\_variables\_initializer()](https://stackoverflow.com/questions/41439254/what-are-the-differences-between-tf-initialize-all-variables-and-tf-global-var) – nbro Oct 31 '19 at 21:13

2 Answers2

1

If you look at the docs, you will see that they do the same, but tf.initialize_all_variables is now deprecated in favour of tf.global_variables_initializer.

jdehesa
  • 58,456
  • 7
  • 77
  • 121
0

I haven't check it out but according to this answer and my personal experience from code in previous versions of tensorflow initialize_all_variables() used to initialize both global and local variables when was not deprecated but in recent version (where it's considered deprecated) it's just a (deprecated) equivalent to global_variables_initializer().

So, depending on the version it might change the answer.

Eypros
  • 5,370
  • 6
  • 42
  • 75