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: Looks up `key` in a table, outputs the corresponding value.
  
  The `default_value` is used if key not present in the table.
  
  Args:
    key: Key to look up. Must match the table's key_dtype.
    dynamic_default_value: The value to use if the key is missing in the
      table. If None (by default), the `table.default_value` will be used.
    name: A name for the operation (optional).
  
  Returns:
    A tensor containing the value in the same shape as `key` using the
      table's value type.
  
  Raises:
    TypeError: when `key` do not match the table data types.
docstr_tok: ["Looks","up","`","key","`","in","a","table",",","outputs","the","corresponding","value",".","The","`","default_value","`","is","used","if","key","not","present","in","the","table",".","Args",":","key",":","Key","to","look","up",".","Must","match","the","table","'s","key_dtype",".","dynamic_default_value",":","The","value","to","use","if","the","key","is","missing","in","the","table",".","If","None","(","by","default",")",",","the","`","table.default_value","`","will","be","used",".","name",":","A","name","for","the","operation","(","optional",")",".","Returns",":","A","tensor","containing","the","value","in","the","same","shape","as","`","key","`","using","the","table","'s","value","type",".","Raises",":","TypeError",":","when","`","key","`","do","not","match","the","table","data","types","."]
code: def find(self, key, dynamic_default_value=None, name=None):
      """Looks up `key` in a table, outputs the corresponding value.
  
      The `default_value` is used if key not present in the table.
  
      Args:
        key: Key to look up. Must match the table's key_dtype.
        dynamic_default_value: The value to use if the key is missing in the
          table. If None (by default), the `table.default_value` will be used.
        name: A name for the operation (optional).
  
      Returns:
        A tensor containing the value in the same shape as `key` using the
          table's value type.
  
      Raises:
        TypeError: when `key` do not match the table data types.
      """
      with tf.name_scope(name or "%s_lookup_table_find" % self._name):
          key = tf.convert_to_tensor(
              key, dtype=self._key_dtype, name="key"
          )
          if dynamic_default_value is not None:
              dynamic_default_value = tf.convert_to_tensor(
                  dynamic_default_value,
                  dtype=self._value_dtype,
                  name="default_value",
              )
          value = (
              gen_simple_hash_table_op.examples_simple_hash_table_find(
                  self.resource_handle,
                  key,
                  dynamic_default_value
                  if dynamic_default_value is not None
                  else self._default_value,
              )
          )
      return value
  
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 7 for calling the SimpleHashTable obj's underlying member method code with example usage: obj.find(key, dynamic_default_value, name) and returns: value