Skip to contents

Reverses the order of elements along specified dimensions.

Usage

prim_reverse(operand, dims)

Arguments

operand

(arrayish)
Arrayish value of any data type.

dims

(integer())
Dimensions to reverse (1-indexed).

Value

arrayish
Has the same data type and shape as operand. It is ambiguous if the input is ambiguous.

Implemented Rules

  • stablehlo

  • quickr

  • reverse

StableHLO

Lowers to stablehlo::hlo_reverse().

See also

Examples

x <- nv_array(c(1, 2, 3, 4, 5))
prim_reverse(x, dims = 1L)
#> AnvlArray
#>  5
#>  4
#>  3
#>  2
#>  1
#> [ CPUf32{5} ]