3

In practice, isn't running global_variables_initializer enough to initialize model variables?

local_variables_initializer seems to be unnecessary and absent even in official and semi-official tensorflow example code. See for example:

In both cases only global_variables_initializer is used.

Am I missing something here? Is there any case where I should call local_variables_initializer explicitly?

Pop
  • 12,135
  • 5
  • 55
  • 68
Giorgos Sfikas
  • 707
  • 1
  • 8
  • 19

1 Answers1

1

local_variables_initializer is useful in particular for streaming metrics (e.g. tf.contrib.metrics.streaming_auc). As said in the doc of contrib.metrics:

Because the streaming metrics use local variables, the Initialization stage is performed by running the op returned by tf.local_variables_initializer().

Pop
  • 12,135
  • 5
  • 55
  • 68