Module: tf.ragged

TensorFlow 2 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.

Classes

class RaggedTensorValue: Represents the value of a RaggedTensor.

Functions

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

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

constant_value(...): Constructs a RaggedTensorValue from a nested Python list.

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

placeholder(...): Creates a placeholder for a tf.RaggedTensor that will always be fed.

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.