class tf.contrib.lookup.HashTableA generic hash table implementation.
Example usage:
table = tf.contrib.lookup.HashTable(
tf.contrib.lookup.KeyValueTensorInitializer(keys, values), -1)
out = table.lookup(input_tensor).
table.init.run()
print out.eval()
default_valueThe default value of the table.
initThe table initialization op.
key_dtypeThe table key dtype.
nameThe name of the table.
table_refGet the underlying table reference.
value_dtypeThe table value dtype.
__init__(initializer, default_value, shared_name=None, name=None)Creates a non-initialized HashTable object.
Creates a table, the type of its keys and values are specified by the initializer. Before using the table you will have to initialize it. After initialization the table will be immutable.
initializer: The table initializer to use.default_value: The value to use if a key is missing in the table.shared_name: If non-empty, this table will be shared under the given name across multiple sessions.name: A name for the operation (optional).A HashTable object.
check_table_dtypes(key_dtype, value_dtype)Check that the given key_dtype and value_dtype matches the table dtypes.
key_dtype: The key data type to check.value_dtype: The value data type to check.TypeError: when 'key_dtype' or 'value_dtype' doesn't match the table data types.lookup(keys, name=None)Looks up keys in a table, outputs the corresponding values.
The default_value is used for keys not present in the table.
keys: Keys to look up. May be either a SparseTensor or dense Tensor.name: A name for the operation (optional).A SparseTensor if keys are sparse, otherwise a dense Tensor.
TypeError: when keys or default_value doesn't match the table data types.size(name=None)Compute the number of elements in this table.
name: A name for the operation (optional).A scalar tensor containing the number of elements in this table.
Defined in tensorflow/contrib/lookup/lookup_ops.py.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/lookup/HashTable