nvidia.dali.fn.sequence_rearrange

nvidia.dali.fn.sequence_rearrange(__input, /, *, new_order, bytes_per_sample_hint=[0], preserve=False, seed=-1, device=None, name=None)

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 (TensorList) – Input to the operator.

Keyword Arguments:
  • new_order (int or list of int or TensorList 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.

  • bytes_per_sample_hint (int or list of int, optional, default = [0]) –

    Output size hint, in bytes per sample.

    If specified, the operator’s outputs residing in GPU or page-locked host memory will be preallocated to accommodate a batch of samples of this size.

  • preserve (bool, optional, default = False) – Prevents the operator from being removed from the graph even if its outputs are not used.

  • seed (int, optional, default = -1) –

    Random seed.

    If not provided, it will be populated based on the global seed of the pipeline.