Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::SparseCross
#include <sparse_ops.h>
Generates sparse cross from a list of sparse and dense tensors.
Summary
The op takes two lists, one of 2D SparseTensor
and one of 2D Tensor
, each representing features of one feature column. It outputs a 2D SparseTensor
with the batchwise crosses of these features.
For example, if the inputs are
inputs[0]: SparseTensor with shape = [2, 2]
[0, 0]: "a"
[1, 0]: "b"
[1, 1]: "c"
inputs[1]: SparseTensor with shape = [2, 1]
[0, 0]: "d"
[1, 0]: "e"
inputs[2]: Tensor [["f"], ["g"]]
then the output will be
shape = [2, 2]
[0, 0]: "a_X_d_X_f"
[1, 0]: "b_X_e_X_g"
[1, 1]: "c_X_e_X_g"
if hashed_output=true then the output will be
shape = [2, 2]
[0, 0]: FingerprintCat64(
Fingerprint64("f"), FingerprintCat64(
Fingerprint64("d"), Fingerprint64("a")))
[1, 0]: FingerprintCat64(
Fingerprint64("g"), FingerprintCat64(
Fingerprint64("e"), Fingerprint64("b")))
[1, 1]: FingerprintCat64(
Fingerprint64("g"), FingerprintCat64(
Fingerprint64("e"), Fingerprint64("c")))
Arguments:
- scope: A Scope object
- indices: 2-D. Indices of each input
SparseTensor
.
- values: 1-D. values of each
SparseTensor
.
- shapes: 1-D. Shapes of each
SparseTensor
.
- dense_inputs: 2-D. Columns represented by dense
Tensor
.
- hashed_output: If true, returns the hash of the cross instead of the string. This will allow us avoiding string manipulations.
- num_buckets: It is used if hashed_output is true. output = hashed_valuenum_buckets if num_buckets > 0 else hashed_value.
- hash_key: Specify the hash_key that will be used by the
FingerprintCat64
function to combine the crosses fingerprints.
Returns:
Output
output_indices: 2-D. Indices of the concatenated SparseTensor
.
Output
output_values: 1-D. Non-empty values of the concatenated or hashed SparseTensor
.
Output
output_shape: 1-D. Shape of the concatenated SparseTensor
.
Public attributes
Public functions
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.
Last updated 2020-04-20 UTC.
[null,null,["Last updated 2020-04-20 UTC."],[],[],null,["# tensorflow::ops::SparseCross Class Reference\n\ntensorflow::ops::SparseCross\n============================\n\n`#include \u003csparse_ops.h\u003e`\n\nGenerates sparse cross from a list of sparse and dense tensors.\n\nSummary\n-------\n\nThe op takes two lists, one of 2D `SparseTensor` and one of 2D [Tensor](/versions/r1.15/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor), each representing features of one feature column. It outputs a 2D `SparseTensor` with the batchwise crosses of these features.\n\nFor example, if the inputs are \n\n```text\ninputs[0]: SparseTensor with shape = [2, 2]\n[0, 0]: \"a\"\n[1, 0]: \"b\"\n[1, 1]: \"c\"\n\ninputs[1]: SparseTensor with shape = [2, 1]\n[0, 0]: \"d\"\n[1, 0]: \"e\"\n\ninputs[2]: Tensor [[\"f\"], [\"g\"]]\n```\n\n\u003cbr /\u003e\n\nthen the output will be \n\n```scdoc\nshape = [2, 2]\n[0, 0]: \"a_X_d_X_f\"\n[1, 0]: \"b_X_e_X_g\"\n[1, 1]: \"c_X_e_X_g\"\n```\n\n\u003cbr /\u003e\n\nif hashed_output=true then the output will be \n\n```text\nshape = [2, 2]\n[0, 0]: FingerprintCat64(\n Fingerprint64(\"f\"), FingerprintCat64(\n Fingerprint64(\"d\"), Fingerprint64(\"a\")))\n[1, 0]: FingerprintCat64(\n Fingerprint64(\"g\"), FingerprintCat64(\n Fingerprint64(\"e\"), Fingerprint64(\"b\")))\n[1, 1]: FingerprintCat64(\n Fingerprint64(\"g\"), FingerprintCat64(\n Fingerprint64(\"e\"), Fingerprint64(\"c\")))\n```\n\n\u003cbr /\u003e\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- indices: 2-D. Indices of each input `SparseTensor`.\n- values: 1-D. values of each `SparseTensor`.\n- shapes: 1-D. Shapes of each `SparseTensor`.\n- dense_inputs: 2-D. Columns represented by dense [Tensor](/versions/r1.15/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor).\n- hashed_output: If true, returns the hash of the cross instead of the string. This will allow us avoiding string manipulations.\n- num_buckets: It is used if hashed_output is true. output = hashed_valuenum_buckets if num_buckets \\\u003e 0 else hashed_value.\n- hash_key: Specify the hash_key that will be used by the `FingerprintCat64` function to combine the crosses fingerprints.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_indices: 2-D. Indices of the concatenated `SparseTensor`.\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_values: 1-D. Non-empty values of the concatenated or hashed `SparseTensor`.\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_shape: 1-D. Shape of the concatenated `SparseTensor`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [SparseCross](#classtensorflow_1_1ops_1_1_sparse_cross_1aed8888154d0f2d69bb849055ef8805ae)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::InputList](/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` indices, ::`[tensorflow::InputList](/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` values, ::`[tensorflow::InputList](/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` shapes, ::`[tensorflow::InputList](/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list)` dense_inputs, bool hashed_output, int64 num_buckets, int64 hash_key, DataType out_type, DataType internal_type)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_sparse_cross_1aa80e22c2b5a8b8c00fdfbed5f6da6e03) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output_indices](#classtensorflow_1_1ops_1_1_sparse_cross_1aff3e5729686b249a84f3047cd2c7b2fa) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [output_shape](#classtensorflow_1_1ops_1_1_sparse_cross_1a168d4af0a9f32f170b7fd033550d0d24) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [output_values](#classtensorflow_1_1ops_1_1_sparse_cross_1a811794f95c743d1e8f345356e773447a) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output_indices\n\n```scdoc\n::tensorflow::Output output_indices\n``` \n\n### output_shape\n\n```scdoc\n::tensorflow::Output output_shape\n``` \n\n### output_values\n\n```scdoc\n::tensorflow::Output output_values\n``` \n\nPublic functions\n----------------\n\n### SparseCross\n\n```gdscript\n SparseCross(\n const ::tensorflow::Scope & scope,\n ::tensorflow::InputList indices,\n ::tensorflow::InputList values,\n ::tensorflow::InputList shapes,\n ::tensorflow::InputList dense_inputs,\n bool hashed_output,\n int64 num_buckets,\n int64 hash_key,\n DataType out_type,\n DataType internal_type\n)\n```"]]