Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
flujo tensor:: operaciones:: Cruz dispersa
#include <sparse_ops.h>
Genera un cruce disperso a partir de una lista de tensores densos y dispersos.
Resumen
La operación toma dos listas, una de 2D SparseTensor
y otra de 2D Tensor
, cada una de las cuales representa características de una columna de características. Genera un SparseTensor
2D con los cruces por lotes de estas características.
Por ejemplo, si las entradas son
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"]]
entonces la salida será
shape = [2, 2]
[0, 0]: "a_X_d_X_f"
[1, 0]: "b_X_e_X_g"
[1, 1]: "c_X_e_X_g"
si hashed_output=true entonces la salida será
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")))
Argumentos:
- alcance: un objeto de alcance
- índices: 2-D. Índices de cada entrada
SparseTensor
. - valores: 1-D. valores de cada
SparseTensor
. - formas: 1-D. Formas de cada
SparseTensor
. - entradas_densas: 2-D. Columnas representadas por
Tensor
denso. - hash_output: si es verdadero, devuelve el hash de la cruz en lugar de la cadena. Esto nos permitirá evitar manipulaciones de cadenas.
- num_buckets: se usa si hasded_output es verdadero. salida = valor_hashednum_buckets si num_buckets > 0 en caso contrario valor_hashed.
- hash_key: especifique la clave hash que utilizará la función
FingerprintCat64
para combinar las huellas dactilares cruzadas.
Devoluciones:
-
Output
índices_salida: 2-D. Índices del SparseTensor
concatenado. -
Output
valores_salida: 1-D. Valores no vacíos del SparseTensor
concatenado o hash. -
Output
forma_salida: 1-D. Forma del SparseTensor
concatenado.
Atributos públicos
Funciones públicas
A menos que se indique lo contrario, el contenido de esta página está sujeto a la licencia Reconocimiento 4.0 de Creative Commons y las muestras de código están sujetas a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio web de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-25 (UTC).
[null,null,["Última actualización: 2025-07-25 (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```"]]