{ }
View source on GitHub |
Computes the length of each string given in the input tensor.
tf.compat.v1.strings.length(
input, name=None, unit='BYTE'
)
strings = tf.constant(['Hello','TensorFlow', '🙂'])
tf.strings.length(strings).numpy() # default counts bytes
array([ 5, 10, 4], dtype=int32)
tf.strings.length(strings, unit="UTF8_CHAR").numpy()
array([ 5, 10, 1], dtype=int32)
Returns | |
---|---|
A Tensor of type int32 , containing the length of the input string in
the same element of the input tensor.
|