class_docstr: A simple mutable hash table implementation.
  
  Implement a simple hash table as a Resource using ref-counting.
  This demonstrates a Stateful Op for a general Create/Read/Update/Delete
  (CRUD) style use case.  To instead make an op for a specific lookup table
  case, it is preferable to follow the implementation style of
  TensorFlow's internal ops, e.g. use LookupInterface.
  
  Data can be inserted by calling the `insert` method and removed by calling
  the `remove` method. It does not support initialization via the init method.
  
  The `import` and `export` methods allow loading and restoring all of
  the key, value pairs. These methods (or their corresponding kernels)
  are intended to be used for supporting SavedModel.
  
  Example usage:
    hash_table = simple_hash_table_op.SimpleHashTable(key_dtype, value_dtype,
                                                      111)
    result1 = hash_table.find(1, -999)  # -999
    hash_table.insert(1, 100)
    result2 = hash_table.find(1, -999)  # 100
    hash_table.remove(1)
    result3 = hash_table.find(1, -999)  # -999
class_docstr_tok: ["A","simple","mutable","hash","table","implementation",".","Implement","a","simple","hash","table","as","a","Resource","using","ref-counting",".","This","demonstrates","a","Stateful","Op","for","a","general","Create\/Read\/Update\/Delete","(","CRUD",")","style","use","case",".","To","instead","make","an","op","for","a","specific","lookup","table","case",",","it","is","preferable","to","follow","the","implementation","style","of","TensorFlow","'s","internal","ops",",","e.g",".","use","LookupInterface",".","Data","can","be","inserted","by","calling","the","`","insert","`","method","and","removed","by","calling","the","`","remove","`","method",".","It","does","not","support","initialization","via","the","init","method",".","The","`","import","`","and","`","export","`","methods","allow","loading","and","restoring","all","of","the","key",",","value","pairs",".","These","methods","(","or","their","corresponding","kernels",")","are","intended","to","be","used","for","supporting","SavedModel",".","Example","usage",":","hash_table","=","simple_hash_table_op.SimpleHashTable","(","key_dtype",",","value_dtype",",","111",")","result1","=","hash_table.find","(","1",",","-999",")","#","-999","hash_table.insert","(","1",",","100",")","result2","=","hash_table.find","(","1",",","-999",")","#","100","hash_table.remove","(","1",")","result3","=","hash_table.find","(","1",",","-999",")","#","-999"]
docstr: Remove `key`.
  
  Args:
    key: Scalar key to remove.
    name: A name for the operation (optional).
  
  Returns:
    The created Operation.
  
  Raises:
    TypeError: when `key` doesn't match the table data type.
docstr_tok: ["Remove","`","key","`",".","Args",":","key",":","Scalar","key","to","remove",".","name",":","A","name","for","the","operation","(","optional",")",".","Returns",":","The","created","Operation",".","Raises",":","TypeError",":","when","`","key","`","does","n't","match","the","table","data","type","."]
code: def remove(self, key, name=None):
      """Remove `key`.
  
      Args:
        key: Scalar key to remove.
        name: A name for the operation (optional).
  
      Returns:
        The created Operation.
  
      Raises:
        TypeError: when `key` doesn't match the table data type.
      """
      with tf.name_scope(name or "%s_lookup_table_remove" % self._name):
          key = tf.convert_to_tensor(key, self._key_dtype, name="key")
  
          # For remove, just the key is used by the kernel; no value is used.
          # But the kernel is specifc to key_dtype and value_dtype
          # (i.e. it uses a <key_dtype, value_dtype> template).
          # So value_dtype is passed in explicitly. (While
          # key_dtype is specificed implicitly by the dtype of key.)
  
          # pylint: disable=protected-access
          op = gen_simple_hash_table_op.examples_simple_hash_table_remove(
              self.resource_handle, key, value_dtype=self._value_dtype
          )
          return op
  
file_path: tensorflow-upstream/tensorflow/examples/custom_ops_doc/simple_hash_table/simple_hash_table.py
imports: import tensorflow
  from tensorflow.examples.custom_ops_doc.simple_hash_table.simple_hash_table_op import gen_simple_hash_table_op
label_desc: Use image node_id 9 for calling the SimpleHashTable obj's underlying member method code with example usage: obj.remove(key, name) and returns: op