gogasca
gogasca

Reputation: 10058

Option for tf.contrib.lookup.index_table_from_tensor

I heard that TF 2.0 will remove tf.contrib, what is the best alternative for tf.contrib.lookup.index_table_from_tensor function in TF 1.12?

Upvotes: 3

Views: 1767

Answers (1)

dynamicwebpaige
dynamicwebpaige

Reputation: 393

Much of the functionality in tf.contrib.lookup has been migrated to tf.lookup, though I do not believe there is a 1:1 mapping for tf.contrib.lookup.index_table_from_tensor. To date, the available endpoints are:

  • KeyValueTensorInitializer - table initializers given keys and values tensors.
  • StaticHashTable - a generic hash table implementation.
  • StaticVocabularyTable - string to ID table wrapper that assigns out-of-vocabulary keys to buckets.
  • TextFileInitializer - table initializers from a text file.
  • experimental.DenseHashTable - generic mutable hash table implementation using tensors as the backing store.

You can find out more about tf.contrib deprecation and functionality migration in the Sunsetting tf.contrib RFC.

Upvotes: 4

Related Questions