tfm.vision.preprocess_ops_3d.sample_sequence

Samples a single segment of size num_steps from a given sequence.

If random is not True, this function will simply sample the central window of the sequence. Otherwise, a random offset will be chosen in a way that the desired num_steps might be extracted from the sequence.

sequence Any tensor where the first dimension is timesteps.
num_steps Number of steps (e.g. frames) to take.
random A boolean indicating whether to random sample the single window. If True, the offset is randomized. If False, the middle frame minus half of num_steps is the first frame.
stride Distance to sample between timesteps.
seed A deterministic seed to use when sampling.

A single tf.Tensor with first dimension num_steps with the sampled segment.