Computes the count of each element of a Tensor
.
tft.count_per_key(
key: common_types.TensorType,
key_vocabulary_filename: Optional[str] = None,
name: Optional[str] = None
)
Args |
key
|
A Tensor , SparseTensor , or RaggedTensor of dtype tf.string or
tf.int.
|
key_vocabulary_filename
|
(Optional) The file name for the key-output mapping
file. If None and key are provided, this combiner assumes the keys fit in
memory and will not store the result in a file. If empty string, a file
name will be chosen based on the current scope. If not an empty string,
should be unique within a given preprocessing function.
|
name
|
(Optional) A name for this operation.
|
Returns |
Either
|
(A) Two Tensor s: one the key vocab with dtype of input;
the other the count for each key, dtype tf.int64. (if
key_vocabulary_filename is None).
(B) The filename where the key-value mapping is stored (if
key_vocabulary_filename is not None).
|
Raises |
TypeError
|
If the type of x is not supported.
|