Save the date! Google I/O returns May 18-20 Register now

Module: tf.ragged

TensorFlow 1 version

Ragged Tensors.

This package defines ops for manipulating ragged tensors (tf.RaggedTensor), which are tensors with non-uniform shapes. In particular, each RaggedTensor has one or more ragged dimensions, which are dimensions whose slices may have different lengths. For example, the inner (column) dimension of rt=[[3, 1, 4, 1], [], [5, 9, 2], [6], []] is ragged, since the column slices (rt[0, :], ..., rt[4, :]) have different lengths. For a more detailed description of ragged tensors, see the tf.RaggedTensor class documentation and the Ragged Tensor Guide.

Additional ops that support RaggedTensor

Arguments that accept RaggedTensors are marked in bold.


boolean_mask(...): Applies a boolean mask to data without flattening the mask dimensions.

constant(...): Constructs a constant RaggedTensor from a nested Python list.

map_flat_values(...): Applies op to the values of one or more RaggedTensors.

range(...): Returns a RaggedTensor containing the specified sequences of numbers.

row_splits_to_segment_ids(...): Generates the segmentation corresponding to a RaggedTensor row_splits.

segment_ids_to_row_splits(...): Generates the RaggedTensor row_splits corresponding to a segmentation.

stack(...): Stacks a list of rank-R tensors into one rank-(R+1) RaggedTensor.

stack_dynamic_partitions(...): Stacks dynamic partitions of a Tensor or RaggedTensor.