Skip to main content

ClikaRT::ops::roll

function

roll()

Tensor roll(
    Tensor x,
    ClikaRT::Span<const std::int64_t> shifts,
    ClikaRT::Span<const std::int64_t> dims = {}
)

Circularly shift elements: shifts[i] positions along dims[i]; elements that fall off one end re-enter at the other.

With dims empty (the default) the tensor is treated as flattened row-major and shifted by shifts[0]. Copies.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when shifts and dims lengths disagree (code_name() carries the reason).

Returns: a new tensor, x's shape and dtype.

Declared in ClikaRT/compute/ops.h, line 3340