View source on GitHub |
A generic KV table creator.
KV table instance will be created by the create function with config. And also a config class for specific table instance backend should be inited before callling the creator function. And then, the KVCreator class instance will be passed to the Variable class for creating the real KV table backend(TF resource).
hkv_config=tfra.dynamic_embedding.HkvHashTableConfig(
init_capacity=1024 * 1024,
max_capacity=1024 * 1024,
max_hbm_for_values=0,
)
hkv_creator=tfra.dynamic_embedding.HkvHashTableCreator(config=hkv_config)
__init__(config=None)
Initialize self. See help(type(self)) for accurate signature.
create(
key_dtype=None,
value_dtype=None,
default_value=None,
name=None,
checkpoint=None,
init_size=KHkvHashTableInitCapacity,
config=None,
device=None,
shard_saveable_object_fn=None,
)
get_config()
#return as follow
config = {
'key_dtype': self.key_dtype,
'value_dtype': self.value_dtype,
'default_value': self.default_value.numpy(),
'name': self.name,
'checkpoint': self.checkpoint,
'init_capacity': self.init_capacity,
'max_capacity': self.max_capacity,
'max_hbm_for_values': self.max_hbm_for_values
'config': self.config,
'device': self.device,
}