Skip to contents

Creates a 1-D tensor with integer values from start to end (inclusive), analogous to R's seq(start, end).

Usage

nv_seq(start, end, dtype = "i32", ambiguous = FALSE)

Arguments

start, end

(integer(1))
Start and end values. Must satisfy start <= end.

dtype

(character(1) | stablehlo::TensorDataType)
Data type.

ambiguous

(logical(1))
Whether the type is ambiguous. Ambiguous types usually arise from R literals (e.g., 1L, 1.0) and follow special promotion rules. See the vignette("type-promotion") for more details.

Value

tensorish
1-D tensor of length end - start + 1.

See also

nv_iota() for multi-dimensional sequences.

Examples

jit_eval(nv_seq(3, 7))
#> AnvilTensor
#>  3
#>  4
#>  5
#>  6
#>  7
#> [ CPUi32{5} ]