Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
tensorflow:: ops:: StringToHashBucketFast
#include <string_ops.h>
Konwertuje każdy ciąg w wejściowym Tensorze na jego mod mieszający przez liczbę segmentów.
Streszczenie
Funkcja skrótu deterministycznie określa zawartość łańcucha w procesie i nigdy się nie zmieni. Nie nadaje się jednak do kryptografii. Tej funkcji można użyć, gdy czas procesora jest ograniczony, a dane wejściowe są zaufane lub nieistotne. Istnieje ryzyko, że przeciwnicy skonstruują dane wejściowe, które będą łączyły się z tym samym segmentem. Aby zapobiec temu problemowi, użyj silnej funkcji skrótu z tf.string_to_hash_bucket_strong
.
Przykłady:
tf.strings.to_hash_bucket_fast(["Witam", "TensorFlow", "2.x"], 3).numpy() array([0, 2, 2])
Argumenty:
- zakres: Obiekt Scope
- dane wejściowe: Ciągi znaków do przypisania zasobnika mieszania.
- num_buckets: Liczba zasobników.
Zwroty:
-
Output
: Tensor o tym samym kształcie co wejściowy string_tensor
.
Atrybuty publiczne
Funkcje publiczne
węzeł
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Wyjście
operator::tensorflow::Output() const
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[null,null,["Ostatnia aktualizacja: 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```"]]