nvidia.dali.experimental.dynamic.sequence_rearrange#

nvidia.dali.experimental.dynamic.sequence_rearrange(input, /, *, batch_size=None, device=None, new_order)#

Rearranges frames in a sequence.

Assumes that the outermost dimension represents the frame index in the sequence. If the input has a non-empty layout description, it must start with F (frame).

This operator allows sequence inputs.

Supported backends
  • ‘cpu’

  • ‘gpu’

Parameters:

input (Tensor/Batch) – Input to the operator.

Keyword Arguments:

new_order (int or list of int or Tensor/Batch of int) –

List that describes the new order for the elements in each sample.

Output sequence at position i will contain element new_order[i] from input sequence:

out[i, ...] = in[new_order[i], ...]

Elements can be repeated or dropped, but empty output sequences are not allowed. Only indices in [0, input_outermost_extent) are allowed to be used in new_order. Can be specified per sample as 1D tensors.