Skip to contents

Reverses the order of elements along specified dimensions.

Usage

nvl_reverse(operand, dims)

Arguments

operand

(tensorish)
Tensorish value of any data type.

dims

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

Value

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

Implemented Rules

  • stablehlo

  • backward

StableHLO

Lowers to stablehlo::hlo_reverse().

See also

Examples

jit_eval({
  x <- nv_tensor(c(1, 2, 3, 4, 5))
  nvl_reverse(x, dims = 1L)
})
#> AnvilTensor
#>  5
#>  4
#>  3
#>  2
#>  1
#> [ CPUf32{5} ]