コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
テンソルフロー::作戦:: StringToHashBucketFast
#include <string_ops.h>
入力Tensorの各文字列をバケットの数によってそのハッシュ mod に変換します。
まとめ
ハッシュ関数はプロセス内の文字列の内容に対して決定的であり、決して変更されません。ただし、暗号化には適していません。この関数は、CPU 時間が不足していて、入力が信頼できるか重要ではない場合に使用できます。攻撃者がすべて同じバケットにハッシュする入力を構築するリスクがあります。この問題を防ぐには、 tf.string_to_hash_bucket_strong
で強力なハッシュ関数を使用します。
例:
tf.strings.to_hash_bucket_fast(["Hello", "TensorFlow", "2.x"], 3).numpy() array([0, 2, 2])
引数:
- スコープ:スコープオブジェクト
- input: ハッシュ バケットを割り当てる文字列。
- num_buckets: バケットの数。
戻り値:
パブリック属性
公共機能
ノード
::tensorflow::Node * node() const
operator::tensorflow::Input() const
演算子::tensorflow::出力
operator::tensorflow::Output() const
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-27 UTC。
[null,null,["最終更新日 2025-07-27 UTC。"],[],[],null,["# tensorflow::ops::StringToHashBucketFast Class Reference\n\ntensorflow::ops::StringToHashBucketFast\n=======================================\n\n`#include \u003cstring_ops.h\u003e`\n\nConverts each string in the input [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) to its hash mod by a number of buckets.\n\nSummary\n-------\n\nThe hash function is deterministic on the content of the string within the process and will never change. However, it is not suitable for cryptography. This function may be used when CPU time is scarce and inputs are trusted or unimportant. There is a risk of adversaries constructing inputs that all hash to the same bucket. To prevent this problem, use a strong hash function with `tf.string_to_hash_bucket_strong`.\n\nExamples:\n\ntf.strings.to_hash_bucket_fast(\\[\"Hello\", \"TensorFlow\", \"2.x\"\\], 3).numpy() array(\\[0, 2, 2\\])\n\nArguments:\n\n- scope: A [Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: The strings to assign a hash bucket.\n- num_buckets: The number of buckets.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): A [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) of the same shape as the input `string_tensor`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [StringToHashBucketFast](#classtensorflow_1_1ops_1_1_string_to_hash_bucket_fast_1aeb05e5b10fdc6f834f05a653d410f7f7)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, int64 num_buckets)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_string_to_hash_bucket_fast_1a0952b49db809f413e63d82b3f012df4f) | [Operation](/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_string_to_hash_bucket_fast_1a18fa68753ab137a6da6fdd02e1eca30f) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_string_to_hash_bucket_fast_1ae3368d6c128d5c8bd06c2ba972391f6e)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_string_to_hash_bucket_fast_1adc1ece493cd1b706ea7d316631c56148)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_string_to_hash_bucket_fast_1a0a330a80b9f8aa32ee15556dd3e68aa4)`() const ` | ` ` ` ` |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### StringToHashBucketFast\n\n```gdscript\n StringToHashBucketFast(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n int64 num_buckets\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n```"]]