![]() '' % ', '.join(value.rjust(max_width) for value in row) # max_width = max(len(value) for row in elements for value in row) Nrows, ncols = batch_chars_nse_shape.numpy()Įlements = for j in range(nrows)]įor (row, col), value in zip(batch_chars_(), batch_chars_()): batch_chars_padded = batch_chars_ragged.to_tensor(default_value=-1)īatch_chars_sparse = batch_chars_ragged.to_sparse() You can use this tf.RaggedTensor directly, or convert it to a dense tf.Tensor with padding or a tf.sparse.SparseTensor using the methods tf.RaggedTensor.to_tensor and tf.RaggedTensor.to_sparse. ]īatch_chars_ragged = tf.strings.unicode_decode(batch_utf8,įor sentence_chars in batch_chars_ragged.to_list(): # A batch of Unicode strings, each represented as a UTF8-encoded string. The return result is a tf.RaggedTensor, where the innermost dimension length varies depending on the number of characters in each string. When decoding multiple strings, the number of characters in each string may not be equal.
0 Comments
Leave a Reply. |