Giorgos Sfikas
Giorgos Sfikas

Reputation: 766

Is local_variables_initializer really necessary?

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?

Upvotes: 3

Views: 1349

Answers (1)

Pop
Pop

Reputation: 12411

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().

Upvotes: 1

Related Questions