tfq.padded_to_ragged

View source on GitHub

Utility tf.function that converts a padded tensor to ragged.

Convert a state tf.Tensor padded with the value -2 to a tf.RaggedTensor using efficient boolean masking.

masked_state tf.State tensor with -2 padding.

state_ragged State tensor without padding as a tf.RaggedTensor.