Creates an array with [0, n] values along the seq_dim which is tiled across other dimensions. More...

Functions

AFAPI array range (const dim4 &dims, const int seq_dim=-1, const dtype ty=f32)
 
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)
 
AFAPI af_err af_range (af_array *out, const unsigned ndims, const dim_t *const dims, const int seq_dim, const af_dtype type)
 

Detailed Description

Creates an array with [0, n] values along the seq_dim which is tiled across other dimensions.

// 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)); // a = [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

AFAPI af_err af_range ( af_array out,
const unsigned  ndims,
const dim_t *const  dims,
const int  seq_dim,
const af_dtype  type 
)
Parameters
[out]outis the generated array
[in]ndimsis size of dimension array dims
[in]dimsis the array containing sizes of the dimension
[in]seq_dimis dimension along which [0, dim[seq_dim] - 1] is generated
[in]typeis the type of array to generate
AFAPI array af::range ( const dim4 dims,
const int  seq_dim = -1,
const dtype  ty = f32 
)
Parameters
[in]dimsis dim4 for size of all dimensions
[in]seq_dimis dimesion along which [0, dim[seq_dim] - 1] is generated
[in]tyis the type of array to generate
Returns
an array of integral range specified dimension and type
Examples:
image_processing/binary_thresholding.cpp, and machine_learning/neural_network.cpp.
AFAPI array af::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 
)
Parameters
[in]d0is size of first dimension
[in]d1is size of second dimension
[in]d2is size of third dimension
[in]d3is size of fourth dimension
[in]seq_dimis dimesion along which [0, dim[seq_dim] - 1] is generated
[in]tyis the type of array to generate
Returns
an array of integral range specified dimension and type