- Add a generic immutable hash table op that is initialized once and used to...
- Add a generic immutable hash table op that is initialized once and used to map key tensors to values. - Add a table initializer given the keys and values as tensors. Example use case: keys = tf.constant([0, 1], tf.int64) values = tf.constant(["hello", "world"]) default_value = "UNK" table = tf.contrib.lookup.HashTable(tf.contrib.lookup.KeyValueTensorInitializer(keys, values), default_value) input_tensor = tf.constant([0, 2], tf.int64) out = table.lookup(input_tensor). tf.initialze_all_tables().run() # or table.init.run() print out.eval() # Returns ["hello", "UNK"] Change: 117301920
Showing
tensorflow/contrib/lookup/BUILD
0 → 100644
想要评论请 注册 或 登录