Missed TensorFlow World? Check out the recap. Learn more

tf.sparse.cross_hashed

tf.sparse.cross_hashed(
    inputs,
    num_buckets=0,
    hash_key=None,
    name=None
)

Defined in tensorflow/python/ops/sparse_ops.py.

Generates hashed sparse cross from a list of sparse and dense tensors.

For example, if the inputs are * inputs[0]: SparseTensor with shape = [2, 2]

  • inputs[1]: SparseTensor with shape = [2, 1]

  • inputs[2]: Tensor [["f"], ["g"]]

then the output will be: shape = [2, 2]

          Fingerprint64("f"), FingerprintCat64(
              Fingerprint64("d"), Fingerprint64("a")))

          Fingerprint64("g"), FingerprintCat64(
              Fingerprint64("e"), Fingerprint64("b")))

          Fingerprint64("g"), FingerprintCat64(
              Fingerprint64("e"), Fingerprint64("c")))

Args:

  • inputs: An iterable of Tensor or SparseTensor.
  • num_buckets: An int that is >= 0. output = hashed_value%num_buckets if num_buckets > 0 else hashed_value.
  • hash_key: Integer hash_key that will be used by the FingerprintCat64 function. If not given, will use a default key.
  • name: Optional name for the op.

Returns:

A SparseTensor of type int64.