tft.hash_strings

tft.hash_strings(
    strings,
    hash_buckets,
    key=None,
    name=None
)

Hash strings into buckets.

Args:

  • strings: a Tensor or SparseTensor of dtype tf.string.
  • hash_buckets: the number of hash buckets.
  • key: optional. An array of two Python uint64. If passed, output will be a deterministic function of strings and key. Note that hashing will be slower if this value is specified.
  • name: (Optional) A name for this operation.

Returns:

A Tensor or SparseTensor of dtype tf.int64 with the same shape as the input strings.

Raises:

  • TypeError: if strings is not a Tensor or SparseTensor of dtype tf.string.