#include <sparse_ops.h>
Generates sparse cross from a list of sparse and dense tensors.
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:
SparseTensor
.SparseTensor
.SparseTensor
.Tensor
.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
. Constructors and Destructors | |
---|---|
SparseCross(const ::tensorflow::Scope & scope, ::tensorflow::InputList indices, ::tensorflow::InputList values, ::tensorflow::InputList shapes, ::tensorflow::InputList dense_inputs, bool hashed_output, int64 num_buckets, int64 hash_key, DataType out_type, DataType internal_type) |
Public attributes | |
---|---|
output_indices | |
output_shape | |
output_values |
::tensorflow::Output output_indices
::tensorflow::Output output_shape
::tensorflow::Output output_values
SparseCross( const ::tensorflow::Scope & scope, ::tensorflow::InputList indices, ::tensorflow::InputList values, ::tensorflow::InputList shapes, ::tensorflow::InputList dense_inputs, bool hashed_output, int64 num_buckets, int64 hash_key, DataType out_type, DataType internal_type )
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/sparse-cross.html