Skip to contents

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

Usage

nv_static_slice(x, start_indices, limit_indices, strides)

Arguments

x

(arrayish)
Input array.

start_indices

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

limit_indices

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

strides

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

Value

arrayish
Has the same data type as x.

See also

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

Examples

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