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

Method get_hashtable

tensorflow/python/ops/variable_scope.py:290–357  ·  view source on GitHub ↗
(self,
                    name,
                    shape=None,
                    dtype=dtypes.float32,
                    initializer=None,
                    collections=None,
                    reuse=None,
                    trainable=None,
                    synchronization=VariableSynchronization.AUTO,
                    partitioner=None,
                    children=None)

Source from the content-addressed store, hash-verified

288 self._store_eager_variables = False
289
290 def get_hashtable(self,
291 name,
292 shape=None,
293 dtype=dtypes.float32,
294 initializer=None,
295 collections=None,
296 reuse=None,
297 trainable=None,
298 synchronization=VariableSynchronization.AUTO,
299 partitioner=None,
300 children=None):
301 if context.executing_eagerly():
302 if not self._store_eager_variables and reuse:
303 raise RuntimeError(
304 "When eager execution is enabled variable reuse is only supported"
305 " when an EagerVariableStore is active. See the documentation on"
306 " EagerVariableStore for example usage.")
307 if self._store_eager_variables:
308 reuse = AUTO_REUSE
309 try:
310 dtype = dtype.base_dtype
311 except AttributeError:
312 # .base_dtype not existing means that we will try and use the raw dtype
313 # which was passed in - this might be a NumPy type which is valid.
314 pass
315 def _hashtable_getter(name,
316 shape=None,
317 dtype=dtypes.float32,
318 initializer=None,
319 collections=None,
320 reuse=None,
321 trainable=None,
322 partitioner=None,
323 children=None):
324 # HashTable cases
325 if partitioner is not None:
326 if not callable(partitioner):
327 raise ValueError(
328 "Partitioner must be callable, but received: %s" % partitioner)
329 return self._get_distribute_hashtable(name=name,
330 shape=shape,
331 dtype=dtype,
332 initializer=initializer,
333 collections=collections,
334 reuse=reuse,
335 trainable=trainable,
336 partitioner=partitioner,
337 children=children)
338 else:
339 return self._get_hashtable(name=name,
340 shape=shape,
341 dtype=dtype,
342 initializer=initializer,
343 reuse=reuse,
344 collections=collections,
345 trainable=trainable,
346 partitioner=partitioner,
347 children=children)

Callers 1

get_hash_tableMethod · 0.45

Calls 1

executing_eagerlyMethod · 0.80

Tested by

no test coverage detected