The value to use if a key is missing in the table.
name
A name for the operation (optional).
checkpoint
if True, the contents of the table are saved to and restored from checkpoints. If shared_name is empty for a checkpointed table, it is shared using the table node name.
experimental_is_anonymous
Whether to use anonymous mode for the table (default is False). In anonymous mode, the table resource can only be accessed via a resource handle. It can't be looked up by a name. When all resource handles pointing to that resource are gone, the resource will be deleted automatically.
Raises
ValueError
If checkpoint is True and no name was specified.
Attributes
key_dtype
The table key dtype.
name
The name of the table.
resource_handle
Returns the resource handle associated with this Resource.
Looks up keys in a table, outputs the corresponding values.
The default_value is used for keys not present in the table.
Args
keys
Keys to look up. Can be a tensor of any shape. Must match the table's key_dtype.
dynamic_default_values
The values to use if a key is missing in the table. If None (by default), the table.default_value will be used. Shape of dynamic_default_values must be same with table.default_value or the lookup result tensor. In the latter case, each key will have a different default value.
For example:
keys = [0, 1, 3]
dynamic_default_values = [[1, 3, 4], [2, 3, 9], [8, 3, 0]]
# The key '0' will use [1, 3, 4] as default value.
# The key '1' will use [2, 3, 9] as default value.
# The key '3' will use [8, 3, 0] as default value.
name
A name for the operation (optional).
Returns
A tensor containing the values in the same shape as keys using the table's value type.