コード例 #1
0
ファイル: lookup_ops.py プロジェクト: zengqiang041/tensorflow
    def __init__(self,
                 initializer,
                 default_value,
                 shared_name=None,
                 name=None):
        """Creates a non-initialized `HashTable` object.

    Creates a table, the type of its keys and values are specified by the
    initializer.
    Before using the table you will have to initialize it. After initialization
    the table will be immutable.

    Args:
      initializer: The table initializer to use.
      default_value: The value to use if a key is missing in the table.
      shared_name: If non-empty, this table will be shared under
        the given name across multiple sessions.
      name: A name for the operation (optional).

    Returns:
      A `HashTable` object.
    """
        with ops.name_scope(name, "hash_table", [initializer]):
            # pylint: disable=protected-access
            table_ref = gen_data_flow_ops._hash_table(
                shared_name=shared_name,
                key_dtype=initializer.key_dtype,
                value_dtype=initializer.value_dtype,
                name=name)
            # pylint: enable=protected-access

            super(HashTable, self).__init__(table_ref, default_value,
                                            initializer)
コード例 #2
0
    def __init__(self,
                 key_dtype,
                 value_dtype,
                 default_value,
                 shared_name=None,
                 name="hash_table"):
        """Create a generic hash table.

    A table holds a key-value pairs. The key and value types are
    described by key_dtype and value_dtype respectively.

    Args:
      key_dtype:  The key data type of the table.
      value_dtype:  The kvalue data type of the table.
      default_value: The scalar tensor to be used when a key is not present in
        the table.
      shared_name: Optional. If non-empty, this table will be shared under
        the given name across multiple sessions.
      name: Optional name for the hash table op.

    Returns:
      A table object that can be used to lookup data.
    """
        table_ref = gen_data_flow_ops._hash_table(shared_name=shared_name,
                                                  key_dtype=key_dtype,
                                                  value_dtype=value_dtype,
                                                  name=name)

        super(HashTable, self).__init__(key_dtype, value_dtype, default_value,
                                        table_ref)
コード例 #3
0
ファイル: lookup_ops.py プロジェクト: 0-T-0/tensorflow
  def __init__(self, initializer, default_value, shared_name=None, name=None):
    """Creates a non-initialized `HashTable` object.

    Creates a table, the type of its keys and values are specified by the
    initializer.
    Before using the table you will have to initialize it. After initialization
    the table will be immutable.

    Args:
      initializer: The table initializer to use.
      default_value: The value to use if a key is missing in the table.
      shared_name: If non-empty, this table will be shared under
        the given name across multiple sessions.
      name: A name for the operation (optional).

    Returns:
      A `HashTable` object.
    """
    with ops.op_scope([initializer], name, "hash_table"):
      # pylint: disable=protected-access
      table_ref = gen_data_flow_ops._hash_table(
          shared_name=shared_name,
          key_dtype=initializer.key_dtype,
          value_dtype=initializer.value_dtype,
          name=name)
      # pylint: enable=protected-access

      super(HashTable, self).__init__(table_ref, default_value, initializer)
コード例 #4
0
ファイル: data_flow_ops.py プロジェクト: maduhu/tensorflow
  def __init__(self, key_dtype, value_dtype, default_value, shared_name=None,
               name="hash_table"):
    """Creates a non-initialized hash table.

    This op creates a hash table, specifying the type of its keys and values.
    Before using the table you will have to initialize it.  After initialization
    the table will be immutable.

    Args:
      key_dtype:  Type of the table keys.
      value_dtype:  Type of the table values.
      default_value: The scalar tensor to be used when a key is missing in the
        table.
      shared_name: Optional. If non-empty, this table will be shared under
        the given name across multiple sessions.
      name: Optional name for the hash table op.

    Returns:
      A `HashTable` object.
    """
    table_ref = gen_data_flow_ops._hash_table(
        shared_name=shared_name, key_dtype=key_dtype,
        value_dtype=value_dtype, name=name)

    super(HashTable, self).__init__(key_dtype, value_dtype, default_value,
                                    table_ref)
コード例 #5
0
ファイル: data_flow_ops.py プロジェクト: bradg19/tensor
  def __init__(self, key_dtype, value_dtype, default_value, shared_name=None,
               name="hash_table"):
    """Create a generic hash table.

    A table holds a key-value pairs. The key and value types are
    described by key_dtype and value_dtype respectively.

    Args:
      key_dtype:  The key data type of the table.
      value_dtype:  The kvalue data type of the table.
      default_value: The scalar tensor to be used when a key is not present in
        the table.
      shared_name: Optional. If non-empty, this table will be shared under
        the given name across multiple sessions.
      name: Optional name for the hash table op.

    Returns:
      A table object that can be used to lookup data.
    """
    table_ref = gen_data_flow_ops._hash_table(
        shared_name=shared_name, key_dtype=key_dtype,
        value_dtype=value_dtype, name=name)

    super(HashTable, self).__init__(key_dtype, value_dtype, default_value,
                                    table_ref)
コード例 #6
0
ファイル: data_flow_ops.py プロジェクト: sumodm/tensorflow
  def __init__(self, key_dtype, value_dtype, default_value, shared_name=None,
               name="hash_table"):
    """Creates a non-initialized hash table.

    This op creates a hash table, specifying the type of its keys and values.
    Before using the table you will have to initialize it.  After initialization
    the table will be immutable.

    Args:
      key_dtype:  Type of the table keys.
      value_dtype:  Type of the table values.
      default_value: The scalar tensor to be used when a key is missing in the
        table.
      shared_name: Optional. If non-empty, this table will be shared under
        the given name across multiple sessions.
      name: Optional name for the hash table op.

    Returns:
      A `HashTable` object.
    """
    table_ref = gen_data_flow_ops._hash_table(
        shared_name=shared_name, key_dtype=key_dtype,
        value_dtype=value_dtype, name=name)

    super(HashTable, self).__init__(key_dtype, value_dtype, default_value,
                                    table_ref)