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

Method lookup

tensorflow/python/ops/lookup_ops.py:1961–1985  ·  view source on GitHub ↗

Looks up `keys` in a table, outputs the corresponding values. The `default_value` is used for keys not present in the table. Args: keys: Keys to look up. Can be a tensor of any shape. Must match the table's key_dtype. name: A name for the operation (optional). Retu

(self, keys, name=None)

Source from the content-addressed store, hash-verified

1959 return gen_lookup_ops.lookup_table_size_v2(self.resource_handle)
1960
1961 def lookup(self, keys, name=None):
1962 """Looks up `keys` in a table, outputs the corresponding values.
1963
1964 The `default_value` is used for keys not present in the table.
1965
1966 Args:
1967 keys: Keys to look up. Can be a tensor of any shape. Must match the
1968 table's key_dtype.
1969 name: A name for the operation (optional).
1970
1971 Returns:
1972 A tensor containing the values in the same shape as `keys` using the
1973 table's value type.
1974
1975 Raises:
1976 TypeError: when `keys` do not match the table data types.
1977 """
1978 with ops.name_scope(name, "%s_lookup_table_find" % self.name,
1979 [self.resource_handle, keys]):
1980 keys = ops.convert_to_tensor(keys, dtype=self._key_dtype, name="keys")
1981 with ops.colocate_with(self.resource_handle):
1982 values = gen_lookup_ops.lookup_table_find_v2(self.resource_handle, keys,
1983 self._default_value)
1984
1985 return values
1986
1987 def insert_or_assign(self, keys, values, name=None):
1988 """Associates `keys` with `values`.

Callers 15

testBasicMethod · 0.95
testBasicBoolMethod · 0.95
testMapStringToFloatMethod · 0.95
testMapInt64ToFloatMethod · 0.95
testVectorValuesMethod · 0.95
testVectorKeysMethod · 0.95
testResizeMethod · 0.95
testSaveRestoreMethod · 0.95
testObjectSaveRestoreMethod · 0.95
testVectorSaveRestoreMethod · 0.95

Calls 2

colocate_withMethod · 0.80
name_scopeMethod · 0.45

Tested by 15

testBasicMethod · 0.76
testBasicBoolMethod · 0.76
testMapStringToFloatMethod · 0.76
testMapInt64ToFloatMethod · 0.76
testVectorValuesMethod · 0.76
testVectorKeysMethod · 0.76
testResizeMethod · 0.76
testSaveRestoreMethod · 0.76
testObjectSaveRestoreMethod · 0.76
testVectorSaveRestoreMethod · 0.76