tensorflow:: ops:: StringToHashBucketStrong

#include <string_ops.h>

入力テンソル内の各文字列を、バケット数で割った余りのハッシュ値に変換します。

まとめ

ハッシュ関数は、処理内の文字列の内容に対して決定論的です。ハッシュ関数はキー付きハッシュ関数であり、属性keyハッシュ関数のキーを定義します。key key 2 つの要素からなる配列です。

A strong hash is important when inputs may be malicious, eg URLs with additional components. Adversaries could try to make their inputs hash to the same bucket for a denial-of-service attack or to skew the results. A strong hash can be used to make it difficult to find inputs with a skewed hash value distribution over buckets. This requires that the hash function is seeded by a high-entropy (random) "key" unknown to the adversary.

この堅牢性の向上には、 tf.string_to_hash_bucket_fastと比較して約 4 倍の計算時間が必要となります。

例:

tf.strings.to_hash_bucket_strong(["Hello", "TF"], 3, [1, 2]).numpy() array([2, 0])

議論:

  • スコープ:スコープオブジェクト
  • 入力: ハッシュバケットを割り当てる文字列。
  • num_buckets: バケットの数。
  • key: ハッシュ関数のシード値として使用されるキー。2つのuint64要素のリストとして渡されます。

返品:

コンストラクターとデストラクタ

StringToHashBucketStrong (const :: tensorflow::Scope & scope, :: tensorflow::Input input, int64 num_buckets, const gtl::ArraySlice< int > & key)

公開属性

operation
output

公的機能

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

公開属性

手術

Operation operation

出力

::tensorflow::Output output

公的機能

StringToHashBucketStrong

 StringToHashBucketStrong(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  int64 num_buckets,
  const gtl::ArraySlice< int > & key
)

ノード

::tensorflow::Node * node() const 

operator::tensorflow::Input

 operator::tensorflow::Input() const 

operator::tensorflow::Output

 operator::tensorflow::Output() const