class tf.contrib.lookup.InitializableLookupTableBase
Initializable lookup table interface.
An initializable lookup tables persist across different steps.
default_value
The default value of the table.
init
The table initialization op.
key_dtype
The table key dtype.
name
The name of the table.
table_ref
Get the underlying table reference.
value_dtype
The table value dtype.
__init__(table_ref, default_value, initializer)
Construct a table object from a table reference.
If requires a table initializer object (subclass of TableInitializerBase
). It provides the table key and value types, as well as the op to initialize the table. The caller is responsible to execute the initialization op.
table_ref
: The table reference, i.e. the output of the lookup table ops.default_value
: The value to use if a key is missing in the table.initializer
: The table initializer to use.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/InitializableLookupTableBase