W3cubDocs

/TensorFlow 2.4

tf.nn.ctc_unique_labels

Get unique labels and indices for batched labels for tf.nn.ctc_loss.

For use with tf.nn.ctc_loss optional argument unique: This op can be used to preprocess labels in input pipeline to for better speed/memory use computing the ctc loss on TPU.

Example:

ctc_unique_labels([[3, 4, 4, 3]]) -> unique labels padded with 0: [[3, 4, 0, 0]] indices of original labels in unique: [0, 1, 1, 0]

Args
labels tensor of shape [batch_size, max_label_length] padded with 0.
name A name for this Op. Defaults to "ctc_unique_labels".
Returns
tuple of
  • unique labels, tensor of shape [batch_size, max_label_length]
  • indices into unique labels, shape [batch_size, max_label_length]

© 2020 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/versions/r2.4/api_docs/python/tf/nn/ctc_unique_labels