Skip to contents

Extracts a slice from a tensor using static (compile-time) indices. For dynamic indexing, use nv_subset() instead.

Usage

nv_static_slice(operand, start_indices, limit_indices, strides)

Arguments

operand

(tensorish)
Operand.

start_indices

(integer())
Start indices (inclusive), one per dimension.

limit_indices

(integer())
End indices (inclusive), one per dimension.

strides

(integer())
Step sizes, one per dimension. A stride of 1 selects every element.

Value

tensorish
Has the same data type as operand.

See also

nv_subset(), nvl_static_slice() for the underlying primitive.

Examples

jit_eval({
  x <- nv_tensor(1:10)
  nv_static_slice(x, start_indices = 2L, limit_indices = 5L, strides = 1L)
})
#> AnvilTensor
#>  2
#>  3
#>  4
#>  5
#> [ CPUi32{4} ]