Skip to contents

Creates an array with values increasing along the specified axis.

Usage

prim_iota(axis, dtype, shape, start = 1L, device = NULL)

Arguments

axis

(integer(1))
Axis along which values increase. Negative values count from the end of shape, i.e. -1 refers to the last axis.

dtype

(character(1) | DataType)
Data type of the result. Can be any numeric data type, boolean being the one exception.

shape

(integer())
Shape of the output array.

start

(integer(1))
Starting value.

device

(NULL | character(1) | device)
The device the data lives on, given either as:

  • a device string naming the platform (e.g. "cpu", "cuda", "cuda:<n>"), which is resolved against the backend in use, or

  • a device object as returned by nv_device(): a PJRTDevice for the "pjrt" backend or a quickr_device for the "quickr" backend. Because a device object is backend-specific, it also determines the backend.

The default (NULL) uses default_device().

Value

(arrayish)
Has the given dtype and shape.

Implemented Rules

  • stablehlo

  • quickr

StableHLO

Lowers to hlo_iota(), specified under iota.

See also

Examples

# the sequence is built at the requested data type
prim_iota(axis = 1L, dtype = "i32", shape = 5L)
#> AnvlArray
#>  1
#>  2
#>  3
#>  4
#>  5
#> [ CPUi32{5} ]