Open Deep Learning API
Loading...
Searching...
No Matches
Enumerations | Functions
odla_ops_process.h File Reference

Go to the source code of this file.

Enumerations

enum  odla_interpolation_mode { ODLA_NEAREST , ODLA_LINEAR , ODLA_CUBIC }
 Interpolation methods. More...
 
enum  odla_resize_coordinate_mode { ODLA_ASSYMMETRIC , ODLA_HALF_PIXEL , ODLA_HALF_PIXEL_TF , ODLA_ALIGN_CORNERS }
 Modes for coordinate transformation during resizing. More...
 
enum  odla_fill_method { ODLA_EyeLike , ODLA_RandomNormal , ODLA_RandomUniform }
 Methods for filling a value. More...
 

Functions

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Broadcast (const odla_value input, odla_value_shape output_shape, const odla_value_id value_id)
 Broadcast the value. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Cast (odla_value input, odla_element_type target_type, const odla_value_id value_id)
 cast the element data type of an input More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Compress (odla_value input, odla_value condition, odla_int32 axis, odla_value_shape max_output_shape, const odla_value_id value_id)
 Select slices based on condition. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Concat (odla_values inputs, odla_int32 axis, odla_value_shape output_shape, const odla_value_id value_id)
 Concatenate multiple values into a single value. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ExpandDims (odla_value input, odla_value_shape output_dims, const odla_value_id value_id)
 Broadcast the input tensor. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Fill (odla_value_type type, odla_fill_method method, odla_float32 p0, odla_float32 p1, odla_float32 seed, const odla_value_id value_id)
 Generate a value with data. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Gather (odla_value input, odla_value indices, odla_int32 axis, odla_value_shape output_dims, const odla_value_id value_id)
 Gather slices. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_GatherND (odla_value input, odla_value indices, odla_int32 num_batch_dims, odla_value_shape output_dims, const odla_value_id value_id)
 Gather slices. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_GatherElements (odla_value input, odla_value indices, odla_int32 axis, odla_value_shape output_dims, const odla_value_id value_id)
 Gather elements. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_OneHot (odla_value indices, odla_int32 depth, odla_value values, odla_int32 axis, odla_value_shape output_dims, const odla_value_id value_id)
 one-hot value More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Pad (odla_value input, const odla_uint32 *padding_front, const odla_uint32 *padding_back, odla_value_shape output_dims, const odla_value_id value_id)
 Pad the input. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Reshape (odla_value input, odla_value_shape output_dims, const odla_value_id value_id)
 Reshape a value. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ReshapeDynamic (odla_value input, odla_value output_shape, const odla_value_id value_id)
 Reshape a value. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Resize (odla_value input, odla_interpolation_mode interpolation, odla_resize_coordinate_mode mode, odla_uint32 axes_mask, odla_value_shape output_dims, const odla_value_id value_id)
 Resize by interpolating. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ResizeDynamic (odla_value input, odla_value scales, odla_value sizes, odla_interpolation_mode interpolation, odla_resize_coordinate_mode mode, odla_value_shape output_dims, const odla_value_id value_id)
 Resize by interpolating (dynamic shape) More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Shape (odla_value input, odla_value_shape output_dims, const odla_value_id value_id)
 Get the shape of input. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Slice (odla_value input, const odla_int32 *start, const odla_int32 *end, const odla_int32 *stride, odla_value_shape output_dims, const odla_value_id value_id)
 Extract a slice. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_DimsExpand (odla_value input, odla_value original, odla_value axes, odla_value_shape output_dims, const odla_value_id id)
 Extract a DimsExpand. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_SliceDynamic (odla_value input, odla_value start, odla_value size, odla_value stride, odla_value_shape output_dims, const odla_value_id value_id)
 Extract a dynamic slice. More...
 
ODLA_API_EXPORT odla_values ODLA_API_CALL odla_Split (odla_value input, odla_value split_dim, odla_int32 num_split, const odla_value_ids value_ids)
 Splits a tensor into num_split tensors along one dimension. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Squeeze (odla_value input, odla_size_t num_of_axes, const odla_uint32 *axes, odla_value_shape output_dims, const odla_value_id value_id)
 Remove dimensions of size 1. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Stack (odla_values inputs, odla_int32 axis, odla_value_shape output_shape, const odla_value_id value_id)
 Join a sequence of Values along a new axis. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Transpose (odla_value input, odla_value_shape permutations, odla_value_shape output_dims, const odla_value_id value_id)
 Transpose the input. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Tile (odla_value input, const odla_uint32 *repeat, odla_value_shape output_dims, const odla_value_id value_id)
 Tile input multiples times. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_TileDynamic (odla_value input, odla_value repeat, odla_value_shape output_dims, const odla_value_id value_id)
 Tile input multiples times dynamically. More...
 

Detailed Description

This file defines the ODLA value process replated operators.

Definition in file odla_ops_process.h.

Enumeration Type Documentation

◆ odla_fill_method

Methods for filling a value.

Enumerator
ODLA_EyeLike 

ones on the diagnoal and zeros elsewhere.

ODLA_RandomNormal 

normal distribution.

ODLA_RandomUniform 

random uniform distrubution.

Definition at line 49 of file odla_ops_process.h.

49 {
odla_fill_method
Methods for filling a value.
@ ODLA_RandomUniform
@ ODLA_EyeLike
@ ODLA_RandomNormal

◆ odla_interpolation_mode

Interpolation methods.

Enumerator
ODLA_NEAREST 

nearest-neighbor interpolation.

ODLA_LINEAR 

N-Linear interpolation. E.g. bilinear for 2D plane.

ODLA_CUBIC 

N-Cubic interpolation .E.g. bicubic for 2D plane.

Definition at line 33 of file odla_ops_process.h.

33 {
odla_interpolation_mode
Interpolation methods.
@ ODLA_LINEAR
@ ODLA_CUBIC
@ ODLA_NEAREST

◆ odla_resize_coordinate_mode

Modes for coordinate transformation during resizing.

Enumerator
ODLA_ASSYMMETRIC 

new_coord = orig_coord * scale

ODLA_HALF_PIXEL 

new_coord = (orig_coord + 0.5) * scale - 0.5

ODLA_HALF_PIXEL_TF 

new_coord = orig_coord * scale - 0.5

ODLA_ALIGN_CORNERS 

new_coord = orig_coord * (orig_dim - 1) / (new_dim - 1)

Definition at line 40 of file odla_ops_process.h.

40 {
odla_resize_coordinate_mode
Modes for coordinate transformation during resizing.
@ ODLA_HALF_PIXEL
@ ODLA_HALF_PIXEL_TF
@ ODLA_ASSYMMETRIC
@ ODLA_ALIGN_CORNERS

Function Documentation

◆ odla_Broadcast()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Broadcast ( const odla_value  input,
odla_value_shape  output_shape,
const odla_value_id  value_id 
)

Broadcast the value.

Broadcast broadcasts the input based on output_shape.

Parameters
inputthe input value
output_shapethe shape after broadcasting
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Cast()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Cast ( odla_value  input,
odla_element_type  target_type,
const odla_value_id  value_id 
)

cast the element data type of an input

Cast casts the input element type to target_type.

Parameters
inputthe input value
target_typethe data type of casted value
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Compress()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Compress ( odla_value  input,
odla_value  condition,
odla_int32  axis,
odla_value_shape  max_output_shape,
const odla_value_id  value_id 
)

Select slices based on condition.

Select slices from input along specified axis based on condition vector.

Parameters
inputthe input value
conditionthe condition value (1-D)
axisthe axis on which the slices to be selected
max_output_shapethe maximum result shape (assume all conditions are true)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Concat()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Concat ( odla_values  inputs,
odla_int32  axis,
odla_value_shape  output_shape,
const odla_value_id  value_id 
)

Concatenate multiple values into a single value.

Concat concatenates multiple values into single one. All inputs must have the same dimension except for the dimension size of the axis to concatenate on.

Parameters
inputsthe input values
axisthe axis on which the inputs to be concatenated
output_shapethe result shape
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_DimsExpand()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_DimsExpand ( odla_value  input,
odla_value  original,
odla_value  axes,
odla_value_shape  output_dims,
const odla_value_id  id 
)

Extract a DimsExpand.

odla_Axes_cal extracts a DimsExpand from axes.

Parameters
inputthe input value
originalthe original value
axesthe axes to slice
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_ExpandDims()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ExpandDims ( odla_value  input,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Broadcast the input tensor.

ExpandDims broadcast the input tensor into the shape of output_dims .

Parameters
inputthe input value
output_dimsthe output shape
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Fill()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Fill ( odla_value_type  type,
odla_fill_method  method,
odla_float32  p0,
odla_float32  p1,
odla_float32  seed,
const odla_value_id  value_id 
)

Generate a value with data.

Fill genrates a value with type and dimensions sepecified by type and fill it with data as using the specified method. When filling with normal distribution, p0 and p1 are for mean and standard deviation, respectively. When filling with unform distribution, p0 and p1 are for the lower and upper bounds, respectively. For othere filling methods, p0 and p1 are ignored.

Parameters
typethe type of generated odla_value
methodthe method for filling the value
p0mean for normal distribution, or lower bound for uniform distribution
p1stddev for normal distribution, or upper bound for uniform distribution
seedthe seed to the random generator
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Gather()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Gather ( odla_value  input,
odla_value  indices,
odla_int32  axis,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Gather slices.

Gather slices from input according to indices.

Parameters
inputthe input value
indicesthe indices value
axisthe axis on which the input is to gather
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_GatherElements()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_GatherElements ( odla_value  input,
odla_value  indices,
odla_int32  axis,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Gather elements.

Gather slices from input according to indices.

Parameters
inputthe input value
indicesthe indices value
axisthe axis on which the input is to gather
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_GatherND()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_GatherND ( odla_value  input,
odla_value  indices,
odla_int32  num_batch_dims,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Gather slices.

Gather slices from input according to indices.

Parameters
inputthe input value
indicesthe indices value
num_batch_dimsthe number of leading dimensions to be omitted
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_OneHot()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_OneHot ( odla_value  indices,
odla_int32  depth,
odla_value  values,
odla_int32  axis,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

one-hot value

OneHot returns a one-hot value from values based on indices and depth.

Parameters
indicesthe indices of "on value"
depththe size of the new dimension
valuesthe pair of off and on values
axisthe axis of new dimension on
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Pad()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Pad ( odla_value  input,
const odla_uint32 padding_front,
const odla_uint32 padding_back,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Pad the input.

Pad pads the input with given padding amount.

Parameters
inputthe input value
padding_frontthe padding amount applied to the start of input
padding_backthe padding amount applied to the end of input
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Reshape()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Reshape ( odla_value  input,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Reshape a value.

Reshape reshapes the input with a new dimension specified by output_dims.

Parameters
inputthe input value
output_dimsthe output shape
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_ReshapeDynamic()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ReshapeDynamic ( odla_value  input,
odla_value  output_shape,
const odla_value_id  value_id 
)

Reshape a value.

ReshapeDynamic reshapes the input with a new dimension specified by output_shape.

Parameters
inputthe input value
output_shapethe output shape
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Resize()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Resize ( odla_value  input,
odla_interpolation_mode  interpolation,
odla_resize_coordinate_mode  mode,
odla_uint32  axes_mask,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Resize by interpolating.

Resize resizes the input using specified interploation method.

Parameters
inputthe input value
interpolationthe interpolation method
modethe coordinate transformation mode
axes_maskthe mask that indicates which axes need to be resized. The LSB corresponds to the shape dimension with stride of 1. For example, to resize a tensor in NHWC layout, the mask would be 0b0110.
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_ResizeDynamic()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ResizeDynamic ( odla_value  input,
odla_value  scales,
odla_value  sizes,
odla_interpolation_mode  interpolation,
odla_resize_coordinate_mode  mode,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Resize by interpolating (dynamic shape)

Resize resizes the input using specified interpolation method. The shape of output is determined by either scales or sizes. It is an error if both are specified (non-null).

Parameters
inputthe input value
scalesthe scaling value
sizesthe size of output value
interpolationthe interpolation method
modethe coordinate transformation mode
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Shape()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Shape ( odla_value  input,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Get the shape of input.

Shape returns the shape of input as a 1D odla_value. The element type of the result value is implementation determined.

Parameters
inputthe input value
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Slice()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Slice ( odla_value  input,
const odla_int32 start,
const odla_int32 end,
const odla_int32 stride,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Extract a slice.

Slice extracts a slice from input.

Parameters
inputthe input value
startthe offets at each slicing dimension
endthe ending indices(exclusive) at each slicing dimension
stridethe stride at each slicing dimension
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_SliceDynamic()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_SliceDynamic ( odla_value  input,
odla_value  start,
odla_value  size,
odla_value  stride,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Extract a dynamic slice.

SliceDynamic extracts a dynamic slice from input.

Parameters
inputthe input value
startthe offets at each slicing dimension
sizethe number of elements at each slicing dimension
stridethe stride at each slicing dimension
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Split()

ODLA_API_EXPORT odla_values ODLA_API_CALL odla_Split ( odla_value  input,
odla_value  split_dim,
odla_int32  num_split,
const odla_value_ids  value_ids 
)

Splits a tensor into num_split tensors along one dimension.

Split extracts a slice from input.

Parameters
inputthe input value
split_dimthe dimension along which to split
num_splitthe number of ways to split
value_idsan array of values ids (can be NULL)
Returns
odla_values

◆ odla_Squeeze()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Squeeze ( odla_value  input,
odla_size_t  num_of_axes,
const odla_uint32 axes,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Remove dimensions of size 1.

Squeeze removes dimensions of size 1 from the shape of input. All single dimensions will be squeezed if num_of_axes is zero.

Parameters
inputthe input value
num_of_axesnubmer of axes to squeeze
axesthe axes to squeeze
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Stack()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Stack ( odla_values  inputs,
odla_int32  axis,
odla_value_shape  output_shape,
const odla_value_id  value_id 
)

Join a sequence of Values along a new axis.

Stack joins multiple values into single one along a new axis. All inputs must have the same dimension.

Parameters
inputsthe input values
axisthe index of the new axis in the dimensions of the result
output_shapethe result shape
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Tile()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Tile ( odla_value  input,
const odla_uint32 repeat,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Tile input multiples times.

Replicate a given input value multiples times.

Parameters
inputthe input value
repeatthe dimension numbers of repeated copies along input's dimensions.
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_TileDynamic()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_TileDynamic ( odla_value  input,
odla_value  repeat,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Tile input multiples times dynamically.

Replicate a given input value multiples times dynamically.

Parameters
inputthe input value
repeatthe dimension numbers of repeated copies along input's dimensions.
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Transpose()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Transpose ( odla_value  input,
odla_value_shape  permutations,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Transpose the input.

Transpose returns a transposed value based on the permutation.

Parameters
inputthe input value
permutationsthe axies for permutation. It should be the same size as input_dims and output_dims
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value