Hereは、TensorFlowのtf.string_to_hash_bucket_fast
を説明するページです。 (バージョンは現在1.3です。)この関数を定義するファイルはtensorflow/python/ops/gen_string_ops.py
であり、githubには存在しないようです。 gen
が生成されている可能性があります。はい。テンソルフローハッシュ関数とは何ですか?
この関数の基本的な定義は何ですか(別のプラットフォームで使用したい場合は再実装できます)。
Hereは、TensorFlowのtf.string_to_hash_bucket_fast
を説明するページです。 (バージョンは現在1.3です。)この関数を定義するファイルはtensorflow/python/ops/gen_string_ops.py
であり、githubには存在しないようです。 gen
が生成されている可能性があります。はい。テンソルフローハッシュ関数とは何ですか?
この関数の基本的な定義は何ですか(別のプラットフォームで使用したい場合は再実装できます)。
string_to_hash_bucket_op.ccの登録情報に基づいています。 tf.string_to_hash_bucket_fast
の実装は、対応する.hファイルからStringToHashBucketOpクラスにあると思います。
はい、Tensorflowをインストールするとそのファイルが生成されるため、そのパスのマシン上でそのファイルを見つけることができます。私にとっては、次の場所にあります。
/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_string_ops.py
PS:あなたは、エラーが発生したときは、そのようなパスを見ることができます。
固体の定義は次のとおりです。
def string_to_hash_bucket(string_tensor, num_buckets, name=None):
r"""Converts each string in the input Tensor to its hash mod by a number of buckets.
The hash function is deterministic on the content of the string within the
process.
Note that the hash function may change from time to time.
This functionality will be deprecated and it's recommended to use
`tf.string_to_hash_bucket_fast()` or `tf.string_to_hash_bucket_strong()`.
Args:
string_tensor: A `Tensor` of type `string`.
num_buckets: An `int` that is `>= 1`. The number of buckets.
name: A name for the operation (optional).
Returns:
A `Tensor` of type `int64`.
A Tensor of the same shape as the input `string_tensor`.
"""
result = _op_def_lib.apply_op("StringToHashBucket",
string_tensor=string_tensor,
num_buckets=num_buckets, name=name)
return result
あなたは/usr/local/lib/python2.7/dist-packages/
の下であなたが欲しいものを追跡することができます(それはあなたの設定に応じて異なります)。絶対にPythonの定義は真の定義ではなく、真の定義は前の答えで述べられているC++の定義です。