physicist
physicist

Reputation: 904

What does tensorflow's tables_initializer do?

The documentation is not very clear link The vague description says that it initializes tables. What tables are those?

Upvotes: 4

Views: 1874

Answers (1)

javidcf
javidcf

Reputation: 59711

Tables in TensorFlow generally refer to data structures supporting lookup operations, i.e. map-like collections. So far, these operations have lived under tf.contrib.lookup, but it seems the TensorFlow team are moving these to TensorFlow core (probably as part of the efforts towards TensorFlow 2.0, where tf.contrib will not be included). In fact, you can see classes that are actually already in core TensorFlow:

import tensorflow as tf
from tensorflow.python.ops import lookup_ops  # This is inside core TensorFlow

print(tf.contrib.lookup.HashTable is lookup_ops.HashTable)
# True

tf.initializers.tables_initializer being there in the documentation seems more of an accident right now, since the public API for lookup operations is still tf.contrib.lookup. That documentation page is caused by the @tf_export decorators in python/ops/lookup_ops.py. As more of the API is moved, all the pieces of the documentation will fit better (although the documentation for that function could be a bit more descriptive anyway).

In any case, if you are not using lookup operations or data structures, it is probably not relevant to you.

Upvotes: 4

Related Questions