def __init__(self,
key_dtype,
value_dtype,
default_value,
num_shards=1,
name='ShardedMutableHashTable'):
with ops.name_scope(name, 'sharded_mutable_hash_table') as scope:
super(_ShardedMutableHashTable, self).__init__(key_dtype, value_dtype,
scope)
table_shards = []
for i in range(num_shards):
table_shards.append(lookup_ops.MutableHashTable(
key_dtype=key_dtype,
value_dtype=value_dtype,
default_value=default_value,
name='%s-%d-of-%d' % (name, i + 1, num_shards)))
self._table_shards = table_shards
# TODO(andreasst): add a value_shape() method to LookupInterface
# pylint: disable=protected-access
self._value_shape = self._table_shards[0]._value_shape
# pylint: enable=protected-access
评论列表
文章目录