{ }
String lengths of input
.
tf.raw_ops.StringLength(
input, unit='BYTE', name=None
)
Computes the length of each string given in the input tensor.
strings = tf.constant(['Hello','TensorFlow', '\U0001F642'])
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 .
|