A high-performance general-purpose compute library

Create an array with [0, n-1] values along the seq_dim dimension and tiled across other dimensions. More...

Functions

AFAPI array range (const dim4 &dims, const int seq_dim=-1, const dtype ty=f32)
 C++ Interface for creating an array with [0, n-1] values along the seq_dim dimension and tiled across other dimensions of shape dim4.
 
AFAPI array range (const dim_t d0, const dim_t d1=1, const dim_t d2=1, const dim_t d3=1, const int seq_dim=-1, const dtype ty=f32)
 C++ Interface for creating an array with [0, n-1] values along the seq_dim dimension and tiled across other dimensions described by dimension parameters.
 
AFAPI af_err af_range (af_array *out, const unsigned ndims, const dim_t *const dims, const int seq_dim, const af_dtype type)
 C Interface for creating an array with [0, n-1] values along the seq_dim dimension and tiled across other dimensions specified by an array of ndims dimensions.
 

Detailed Description

Create an array with [0, n-1] values along the seq_dim dimension and tiled across other dimensions.

Examples:

// Generates an array of [0, 4] along first dimension
array a = range(dim4(5)); // a = [0,
// 1,
// 2,
// 3,
// 4]
// Generates an array of [0, 4] along first dimension, tiled along second dimension
array b = range(dim4(5, 2)); // b = [0, 0,
// 1, 1,
// 2, 2,
// 3, 3,
// 4, 4]
// Generates an array of [0, 2] along second dimension, tiled along first dimension
array c = range(dim4(5, 3), 1); // c = [0, 1, 2,
// 0, 1, 2,
// 0, 1, 2,
// 0, 1, 2,
// 0, 1, 2]

Function Documentation

◆ af_range()

AFAPI af_err af_range ( af_array out,
const unsigned  ndims,
const dim_t *const  dims,
const int  seq_dim,
const af_dtype  type 
)

C Interface for creating an array with [0, n-1] values along the seq_dim dimension and tiled across other dimensions specified by an array of ndims dimensions.

Parameters
[out]outthe generated array
[in]ndimsthe size of dimension array dims
[in]dimsthe array containing the dimension sizes
[in]seq_dimthe dimension along which [0, dim[seq_dim] - 1] is created
[in]typethe type of the generated array

◆ range() [1/2]

AFAPI array range ( const dim4 dims,
const int  seq_dim = -1,
const dtype  ty = f32 
)

C++ Interface for creating an array with [0, n-1] values along the seq_dim dimension and tiled across other dimensions of shape dim4.

Parameters
[in]dimsthe dim4 object describing the shape of the generated array
[in]seq_dimthe dimesion along which [0, dim[seq_dim] - 1] is created
[in]tythe type of the generated array
Returns
the generated array

◆ range() [2/2]

AFAPI array range ( const dim_t  d0,
const dim_t  d1 = 1,
const dim_t  d2 = 1,
const dim_t  d3 = 1,
const int  seq_dim = -1,
const dtype  ty = f32 
)

C++ Interface for creating an array with [0, n-1] values along the seq_dim dimension and tiled across other dimensions described by dimension parameters.

Parameters
[in]d0the size of first dimension
[in]d1the size of second dimension
[in]d2the size of third dimension
[in]d3the size of fourth dimension
[in]seq_dimthe dimesion along which [0, dim[seq_dim] - 1] is created
[in]tythe type of the generated array
Returns
the generated array