MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / __init__

Method __init__

tensorflow/python/ops/lookup_ops.py:262–291  ·  view source on GitHub ↗

Creates a non-initialized `HashTable` object. Creates a table, the type of its keys and values are specified by the initializer. Before using the table you will have to initialize it. After initialization the table will be immutable. Args: initializer: The table initializ

(self, initializer, default_value, name=None)

Source from the content-addressed store, hash-verified

260 """
261
262 def __init__(self, initializer, default_value, name=None):
263 """Creates a non-initialized `HashTable` object.
264
265 Creates a table, the type of its keys and values are specified by the
266 initializer.
267 Before using the table you will have to initialize it. After initialization
268 the table will be immutable.
269
270 Args:
271 initializer: The table initializer to use. See `HashTable` kernel for
272 supported key and value types.
273 default_value: The value to use if a key is missing in the table.
274 name: A name for the operation (optional).
275
276 Returns:
277 A `HashTable` object.
278 """
279 self._initializer = initializer
280 self._default_value = default_value
281 self._shared_name = self._initializer._shared_name # pylint: disable=protected-access
282 if not self._shared_name:
283 # Force using a shared name so that StaticHashTable resources can be
284 # shared across different kernels. If no "shared_name" is set and
285 # "use_node_name_sharing" is False, then each kernel gets its own local
286 # resource.
287 self._shared_name = "hash_table_%s" % (str(uuid.uuid4()),)
288 self._name = name or "hash_table"
289 self._table_name = None
290 super(StaticHashTable, self).__init__(default_value, initializer)
291 self._value_shape = self._default_value.get_shape()
292
293 def _create_resource(self):
294 table_ref = gen_lookup_ops.hash_table_v2(

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45
get_shapeMethod · 0.45

Tested by

no test coverage detected