tf.strings.format

Formats a string template using a list of tensors.

Formats a string template using a list of tensors, abbreviating tensors by only printing the first and last summarize elements of each dimension (recursively). If formatting only one tensor into a template, the tensor does not have to be wrapped in a list.

Example:

Formatting a single-tensor template:

tensor = tf.range(5)
tf.strings.format("tensor: {}, suffix", tensor)
<tf.Tensor: shape=(), dtype=string, numpy=b'tensor: [0 1 2 3 4], suffix'>

Formatting a multi-tensor template:

tensor_a = tf.range(2)
tensor_b = tf.range(1, 4, 2)
tf.strings.format("a: {}, b: {}, suffix", (tensor_a, tensor_b))
<tf.Tensor: shape=(), dtype=string, numpy=b'a: [0 1], b: [1 3], suffix'>

template A string template to format tensor values into.
inputs A list of Tensor objects, or a single Tensor. The list of tensors to format into the template str