tf.ragged.cross_hashed
Stay organized with collections
Save and categorize content based on your preferences.
Generates hashed feature cross from a list of tensors.
tf.ragged.cross_hashed(
inputs, num_buckets=0, hash_key=None, name=None
)
The input tensors must have rank=2
, and must all have the same number of
rows. The result is a RaggedTensor
with the same number of rows as the
inputs, where result[row]
contains a list of all combinations of values
formed by taking a single value from each input's corresponding row
(inputs[i][row]
). Values are combined by hashing together their
fingerprints. E.g.:
tf.ragged.cross_hashed([tf.ragged.constant([['a'], ['b', 'c']]),
tf.ragged.constant([['d'], ['e']]),
tf.ragged.constant([['f'], ['g']])],
num_buckets=100)
<tf.RaggedTensor [[78], [66, 74]]>
Args |
inputs
|
A list of RaggedTensor or Tensor or SparseTensor .
|
num_buckets
|
A non-negative int that used to bucket the hashed values. If
num_buckets != 0 , then output = hashed_value % num_buckets .
|
hash_key
|
Integer hash_key that will be used by the FingerprintCat64
function. If not given, a default key is used.
|
name
|
Optional name for the op.
|
Returns |
A 2D RaggedTensor of type int64 .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf.ragged.cross_hashed\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/ops/ragged/ragged_array_ops.py#L768-L802) |\n\nGenerates hashed feature cross from a list of tensors.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.ragged.cross_hashed`](https://www.tensorflow.org/api_docs/python/tf/ragged/cross_hashed)\n\n\u003cbr /\u003e\n\n tf.ragged.cross_hashed(\n inputs, num_buckets=0, hash_key=None, name=None\n )\n\nThe input tensors must have `rank=2`, and must all have the same number of\nrows. The result is a `RaggedTensor` with the same number of rows as the\ninputs, where `result[row]` contains a list of all combinations of values\nformed by taking a single value from each input's corresponding row\n(`inputs[i][row]`). Values are combined by hashing together their\nfingerprints. E.g.: \n\n tf.ragged.cross_hashed([tf.ragged.constant([['a'], ['b', 'c']]),\n tf.ragged.constant([['d'], ['e']]),\n tf.ragged.constant([['f'], ['g']])],\n num_buckets=100)\n \u003ctf.RaggedTensor [[78], [66, 74]]\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------|--------------------------------------------------------------------------------------------------------------------------------|\n| `inputs` | A list of `RaggedTensor` or `Tensor` or `SparseTensor`. |\n| `num_buckets` | A non-negative `int` that used to bucket the hashed values. If `num_buckets != 0`, then `output = hashed_value % num_buckets`. |\n| `hash_key` | Integer hash_key that will be used by the `FingerprintCat64` function. If not given, a default key is used. |\n| `name` | Optional name for the op. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A 2D `RaggedTensor` of type `int64`. ||\n\n\u003cbr /\u003e"]]