lifang
lifang

Reputation: 1705

What is the right context for using tf.contrib.lookup and tf.python.ops.lookup_ops?

I know that tf.contrib.lookup and tf.python.ops.lookup_ops include the same functions. But is there any difference between using tf.contrib.lookup.index_table_from_file and tf.python.ops.lookup_ops.index_table_from_file? I came across the code using tf.python.ops.lookup_ops.index_table_from_file in the seq2seq tutorial, so I am wondering why not use tf.contrib.lookup.index_table_from_file instead? If I want to use it in my code, which one should I use?

Upvotes: 0

Views: 382

Answers (1)

P-Gn
P-Gn

Reputation: 24591

They are the same, tensorflow.contrib.lookup.lookup_ops.* being simply imported as-is in tf.contrib.lookup.

Use tf.contrib.lookup.* rather than tf.python.ops.lookup_ops.*, not only because it is shorter, but simply because the former is part of the official python API, and not the later.

As for why they used tf.python.ops.lookup_ops.index_table_from_file directly in the example you provide, I am not sure. Maybe they felt that a file named utils/vocab_utils.py is an "internal" thing that they own and that could by-pass the public API. Not a practice to import into your own code IMHO.

Upvotes: 1

Related Questions