Example #1
0
    def remove(self, keys, name=None):
        """Removes `keys` and its associated values from the table.

    If a key is not present in the table, it is silently ignored.

    Args:
      keys: Keys to remove. Can be a tensor of any shape. Must match the table's
        key type.
      name: A name for the operation (optional).

    Returns:
      The created Operation.

    Raises:
      TypeError: when `keys` do not match the table data types.
    """
        if keys.dtype != self._key_dtype:
            raise TypeError(
                "Signature mismatch. Keys must be dtype %s, got %s." %
                (self._key_dtype, keys.dtype))

        with ops.name_scope(
                name, "%s_lookup_table_remove" % self.name,
            (self.resource_handle, keys, self._default_value)) as name:
            # pylint: disable=protected-access
            op = gen_lookup_ops.lookup_table_remove_v2(self.resource_handle,
                                                       keys,
                                                       name=name)

        return op
Example #2
0
  def remove(self, keys, name=None):
    """Removes `keys` and its associated values from the table.

    If a key is not present in the table, it is silently ignored.

    Args:
      keys: Keys to remove. Can be a tensor of any shape. Must match the table's
        key type.
      name: A name for the operation (optional).

    Returns:
      The created Operation.

    Raises:
      TypeError: when `keys` do not match the table data types.
    """
    if keys.dtype != self._key_dtype:
      raise TypeError("Signature mismatch. Keys must be dtype %s, got %s." %
                      (self._key_dtype, keys.dtype))

    with ops.name_scope(
        name, "%s_lookup_table_remove" % self.name,
        (self.resource_handle, keys, self._default_value)) as name:
      # pylint: disable=protected-access
      op = gen_lookup_ops.lookup_table_remove_v2(
          self.resource_handle, keys, name=name)

    return op