Data can be inserted by calling the insert method and removed by calling the remove method. It does not support initialization via the init method.
It uses "open addressing" with quadratic reprobing to resolve collisions. Compared to MutableHashTable the insert, remove and lookup operations in a DenseHashTable are typically faster, but memory usage can be higher. However, DenseHashTable does not require additional memory for temporary tensors created during checkpointing and restore operations.
The value to use if a key is missing in the table.
empty_key
the key to use to represent empty buckets internally. Must not be used in insert, remove or lookup operations.
deleted_key
the key to use to represent deleted buckets internally. Must not be used in insert, remove or lookup operations and be different from the empty_key.
initial_num_buckets
the initial number of buckets.
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.
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.