def insert(self, keys, values, name=None): """Associates `keys` with `values`. Args: keys: Keys to insert. Can be a tensor of any shape. Must match the table's key type. values: Values to be associated with keys. Must be a tensor of the same shape as `keys` and match the table's value type. name: A name for the operation (optional). Returns: The created Operation. Raises: TypeError: when `keys` or `values` doesn't match the table data types. """ # pylint: disable=protected-access lookup_ops._check_table_dtypes(self, keys.dtype, values.dtype) # pylint: enable=protected-access with ops.name_scope(name, "%s_lookup_table_insert" % self._name, [self._table_ref, keys, values]) as name: with ops.colocate_with(self._table_ref): # pylint: disable=protected-access op = gen_lookup_ops._lookup_table_insert_v2(self._table_ref, keys, values, name=name) return op
def insert(self, keys, values, name=None): """Associates `keys` with `values`. Args: keys: Keys to insert. Can be a tensor of any shape. Must match the table's key type. values: Values to be associated with keys. Must be a tensor of the same shape as `keys` and match the table's value type. name: A name for the operation (optional). Returns: The created Operation. Raises: TypeError: when `keys` or `values` doesn't match the table data types. """ # pylint: disable=protected-access lookup_ops._check_table_dtypes(self, keys.dtype, values.dtype) # pylint: enable=protected-access with ops.name_scope(name, "%s_lookup_table_insert" % self._name, [self._table_ref, keys, values]) as name: with ops.colocate_with(self._table_ref): # pylint: disable=protected-access op = gen_lookup_ops._lookup_table_insert_v2( self._table_ref, keys, values, name=name) return op