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

Go to the source code of this file.

Enumerations

enum  odla_memory_layout {
  ODLA_CHANNELS_FIRST , ODLA_CHANNELS_LAST , ODLA_SIO , ODLA_SOI ,
  ODLA_OIS , ODLA_IOS
}
 Memory layout of data. More...
 
enum  odla_rnn_direction { ODLA_RNN_FORWARD , ODLA_RNN_REVERSE , ODLA_RNN_BIDIRECTIONAL }
 RNN direction. More...
 
enum  odla_rnn_outputs { ODLA_RNN_NO_STATE , ODLA_RNN_HIDDEN_STATE , ODLA_RNN_CELL_STATE , ODLA_RNN_HIDDEN_CELL_STATE }
 RNN outputs. More...
 
enum  odla_reduction_mode { ODLA_REDUCE_NONE , ODLA_REDUCE_MEAN , ODLA_REDUCE_SUM }
 
enum  odla_rnn_weight_format { ODLA_RNN_LDGOI , ODLA_RNN_LDIGO }
 RNN weight layout. More...
 
enum  odla_rnn_gate_order {
  ODLA_RNN_IOFC , ODLA_RNN_IFCO , ODLA_RNN_IFOC , ODLA_RNN_ICOF ,
  ODLA_RNN_URO
}
 RNN data layout. More...
 
enum  odla_tf_idf_mode { ODLA_TFIDF_TF , ODLA_TFIDF_IDF , ODLA_TFIDF_TFIDF }
 TF-IDF computation mode. More...
 

Functions

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_AveragePool (odla_value input, odla_memory_layout input_layout, const odla_uint32 *window_dims, const odla_uint32 *strides, const odla_uint32 *paddings_front, const odla_uint32 *paddings_back, odla_bool padding_included, odla_value_shape output_dims, const odla_value_id value_id)
 Avgerage pooling. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Hardmax (odla_value input, odla_int32 axis, const odla_value_id value_id)
 Hardmax computation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_LRN (odla_value input, odla_memory_layout input_layout, odla_int32 window_size, odla_float32 alpha, odla_float32 beta, odla_float32 bias, const odla_value_id value_id)
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_BatchNormalization (odla_value input, odla_memory_layout input_layout, odla_value mean, odla_value var, odla_float32 epsilon, odla_value scale, odla_value offset, odla_float32 scalar_scale, odla_float32 scalar_offset, const odla_value_id value_id)
 Compute batch normalization. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Celu (odla_value input, odla_float32 alpha, const odla_value_id value_id)
 Celu activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Conv (odla_value input, odla_memory_layout input_layout, odla_uint32 group, odla_value kernel, odla_memory_layout kernel_layout, const odla_uint32 *strides, const odla_uint32 *dilations, const odla_uint32 *paddings_front, const odla_uint32 *paddings_back, odla_value bias, odla_value_shape output_dims, const odla_value_id value_id)
 N-dimensional Convolution. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_DeConv (odla_value input, odla_memory_layout input_layout, odla_uint32 group, odla_value kernel, odla_memory_layout kernel_layout, const odla_uint32 *strides, const odla_uint32 *dilations, const odla_uint32 *paddings_front, const odla_uint32 *paddings_back, odla_value bias, odla_value_shape output_dims, const odla_value_id value_id)
 N-dimensional Deconvolution. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Elu (odla_value input, odla_float32 alpha, const odla_value_id value_id)
 Elu activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Gelu (odla_value input, odla_bool use_approx, const odla_value_id value_id)
 Gelu activation. More...
 
ODLA_API_EXPORT odla_values ODLA_API_CALL odla_GRU (odla_value input, odla_rnn_weight_format weight_format, odla_rnn_gate_order gate_order, odla_value_shape weight_dims, odla_value W, odla_value R, odla_value B, odla_value sequence_lens, odla_value initial_h, odla_int32 hidden_size, odla_rnn_direction direction, odla_bool linear_before_reset, odla_rnn_outputs outputs, const odla_value_ids value_id)
 Compute a one-layer GRU. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_HardSigmoid (odla_value input, odla_float32 alpha, odla_float32 beta, const odla_value_id value_id)
 HardSigmoid activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_GroupNormalization (odla_value input, odla_memory_layout input_layout, odla_int32 groups, odla_float32 epsilon, odla_value scale, odla_value offset, odla_float32 scalar_scale, odla_float32 scalar_offset, const odla_value_id value_id)
 Group Normalization. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_InstanceNormalization (odla_value input, odla_memory_layout input_layout, odla_float32 epsilon, odla_value scale, odla_value offset, odla_float32 scalar_scale, odla_float32 scalar_offset, const odla_value_id value_id)
 Instance Normalization. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_LpNormalize (odla_value input, odla_int32 p, odla_memory_layout input_layout, odla_size_t axes_size, const odla_int32 *axes, odla_float32 epsilon, odla_value scale, const odla_value_id value_id)
 LpNormalize. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_LeakyRelu (odla_value input, odla_float32 alpha, const odla_value_id value_id)
 LeakyRelu activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_LogSoftmax (odla_value input, odla_int32 axis, const odla_value_id value_id)
 LogSoftmax activation. More...
 
ODLA_API_EXPORT odla_values ODLA_API_CALL odla_LSTM (odla_value input, odla_rnn_weight_format weight_format, odla_rnn_gate_order gate_order, odla_value_shape weight_dims, odla_value W, odla_value R, odla_value B, odla_value sequence_lens, odla_value initial_h, odla_value initial_c, odla_value P, odla_int32 hidden_size, odla_rnn_direction direction, odla_rnn_outputs outputs, const odla_value_ids value_ids)
 LSTM. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_MaxPool (odla_value input, odla_memory_layout input_layout, const odla_uint32 *window_dims, const odla_uint32 *strides, const odla_uint32 *paddings_front, const odla_uint32 *paddings_back, odla_value_shape output_dims, const odla_value_id value_id)
 Max Pooling. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_NegativeLogLikeliHoodLoss (odla_value input, odla_value gt, odla_int32 ignored, odla_reduction_mode reduction, odla_value weight, odla_value_shape output_shape, odla_value_id value_id)
 Negative Log Likelihood Loss. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_NMS (odla_value boxes, odla_value scores, odla_uint32 max_num_outputs, odla_float32 iou_threshold, odla_float32 score_threshold, odla_value_type output_value_type, const odla_value_id value_id)
 Non-Max Suppression. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_PRelu (odla_value input, odla_value slope, const odla_value_id value_id)
 PRelu activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Relu (odla_value input, const odla_value_id value_id)
 Relu activation. More...
 
ODLA_API_EXPORT odla_values ODLA_API_CALL odla_RNN (odla_value input, odla_rnn_weight_format weight_format, odla_value_shape weight_dims, odla_value W, odla_value R, odla_value B, odla_value sequence_lens, odla_value initial_h, odla_int32 hidden_size, odla_rnn_direction direction, odla_rnn_outputs outputs, const odla_value_ids value_id)
 Compute a one-layer RNN. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ROIAlign (odla_value input, odla_memory_layout input_layout, odla_value rois, odla_int32 sampling_ratio, odla_float32 scale, odla_value_shape output_dim, const odla_value_id value_id)
 Region of Interest align. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ROIMaxPool (odla_value input, odla_memory_layout input_layout, odla_value rois, odla_int32 win_h, odla_int32 win_w, odla_float32 scale, odla_value_shape output_dim, const odla_value_id value_id)
 ROI max pooling. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Selu (odla_value input, odla_float32 alpha, odla_float32 gamma, const odla_value_id value_id)
 Selu activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Shrink (odla_value input, odla_float32 bias, odla_float32 lambd, const odla_value_id value_id)
 Shrink activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Sigmoid (odla_value input, const odla_value_id value_id)
 Sigmoid activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Softmax (odla_value input, odla_int32 axis, const odla_value_id value_id)
 Softmax activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Softplus (odla_value input, const odla_value_id value_id)
 Softplus activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Softsign (odla_value input, const odla_value_id value_id)
 Softsign activation. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_TFIDFVectorize (odla_value input, odla_int32 min_gram_length, odla_int32 max_gram_length, odla_int32 max_skip_count, odla_tf_idf_mode mode, odla_value pool, odla_value gram_counts, odla_value output_indices, odla_value weights, odla_value_shape output_shape, odla_value_id value_id)
 TF-IDF vectorization. More...
 
ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ThresholdedRelu (odla_value input, odla_float32 alpha, const odla_value_id value_id)
 ThresholdedRelu activation. More...
 
ODLA_API_EXPORT odla_values ODLA_API_CALL odla_TopK (odla_value input, odla_uint32 K, odla_bool largest, odla_bool sorted, odla_uint32 axis, odla_value_type output_value_type, odla_value_type output_value_index_type, const odla_value_ids value_ids)
 Find Top-K elements. More...
 
ODLA_API_EXPORT odla_values ODLA_API_CALL odla_PostProcess (odla_value orig_img_w, odla_value orig_img_h, odla_value bb13, odla_value bb26, odla_value bb52, const odla_value_id value_id)
 Yolov3 Post Process. More...
 

Detailed Description

This file defines the ODLA neural network related operators.

Definition in file odla_ops_nn.h.

Enumeration Type Documentation

◆ odla_memory_layout

Memory layout of data.

Enumerator
ODLA_CHANNELS_FIRST 

layout channel dimension prior to spatial dimension

ODLA_CHANNELS_LAST 

layout channel dimension prior to spatial dimension

ODLA_SIO 

spatial dimension, input and output channels

ODLA_SOI 

spatial first, output and input channels

ODLA_OIS 

output channls, input channels and spatial dimensions

ODLA_IOS 

input channles, output channels and spatial dimensions

Definition at line 33 of file odla_ops_nn.h.

33 {
38 ODLA_SIO,
39 ODLA_SOI,
40 ODLA_OIS,
41 ODLA_IOS,
odla_memory_layout
Memory layout of data.
Definition: odla_ops_nn.h:33
@ ODLA_CHANNELS_LAST
Definition: odla_ops_nn.h:36
@ ODLA_IOS
Definition: odla_ops_nn.h:41
@ ODLA_SIO
Definition: odla_ops_nn.h:38
@ ODLA_SOI
Definition: odla_ops_nn.h:39
@ ODLA_OIS
Definition: odla_ops_nn.h:40
@ ODLA_CHANNELS_FIRST
Definition: odla_ops_nn.h:34

◆ odla_reduction_mode

enum odla_reduction_mode

Definition at line 59 of file odla_ops_nn.h.

59 {
60 ODLA_REDUCE_NONE,
61 ODLA_REDUCE_MEAN,
62 ODLA_REDUCE_SUM,
63} odla_reduction_mode;

◆ odla_rnn_direction

RNN direction.

Enumerator
ODLA_RNN_FORWARD 

forward

ODLA_RNN_REVERSE 

reverse

ODLA_RNN_BIDIRECTIONAL 

both

Definition at line 45 of file odla_ops_nn.h.

45 {
odla_rnn_direction
RNN direction.
Definition: odla_ops_nn.h:45
@ ODLA_RNN_BIDIRECTIONAL
Definition: odla_ops_nn.h:48
@ ODLA_RNN_FORWARD
Definition: odla_ops_nn.h:46
@ ODLA_RNN_REVERSE
Definition: odla_ops_nn.h:47

◆ odla_rnn_gate_order

RNN data layout.

Enumerator
ODLA_RNN_IOFC 

input gate, output gate, forget gate, cell gate

ODLA_RNN_IFCO 

input gate, forget gate, cell gate, output gate

ODLA_RNN_IFOC 

input gate, forget gate, output gate, cell gate

ODLA_RNN_ICOF 

input gate, cell gate, output gate, forget gate

ODLA_RNN_URO 

update gate, reset gate, hidden gate

Definition at line 75 of file odla_ops_nn.h.

75 {
odla_rnn_gate_order
RNN data layout.
Definition: odla_ops_nn.h:75
@ ODLA_RNN_URO
Definition: odla_ops_nn.h:80
@ ODLA_RNN_ICOF
Definition: odla_ops_nn.h:79
@ ODLA_RNN_IFOC
Definition: odla_ops_nn.h:78
@ ODLA_RNN_IFCO
Definition: odla_ops_nn.h:77
@ ODLA_RNN_IOFC
Definition: odla_ops_nn.h:76

◆ odla_rnn_outputs

RNN outputs.

Enumerator
ODLA_RNN_NO_STATE 

default output

ODLA_RNN_HIDDEN_STATE 

output hidden state

ODLA_RNN_CELL_STATE 

output cell state

ODLA_RNN_HIDDEN_CELL_STATE 

output both hidden and cell states

Definition at line 52 of file odla_ops_nn.h.

52 {
odla_rnn_outputs
RNN outputs.
Definition: odla_ops_nn.h:52
@ ODLA_RNN_HIDDEN_STATE
Definition: odla_ops_nn.h:54
@ ODLA_RNN_HIDDEN_CELL_STATE
Definition: odla_ops_nn.h:56
@ ODLA_RNN_CELL_STATE
Definition: odla_ops_nn.h:55
@ ODLA_RNN_NO_STATE
Definition: odla_ops_nn.h:53

◆ odla_rnn_weight_format

RNN weight layout.

Enumerator
ODLA_RNN_LDGOI 

layers, directions, num gates, output channels, input channels

ODLA_RNN_LDIGO 

layers, directions, input_channels, num gates, output channels,

Definition at line 66 of file odla_ops_nn.h.

66 {
odla_rnn_weight_format
RNN weight layout.
Definition: odla_ops_nn.h:66
@ ODLA_RNN_LDIGO
Definition: odla_ops_nn.h:69
@ ODLA_RNN_LDGOI
Definition: odla_ops_nn.h:67

◆ odla_tf_idf_mode

TF-IDF computation mode.

Enumerator
ODLA_TFIDF_TF 

term frequency

ODLA_TFIDF_IDF 

inverse document frequency

ODLA_TFIDF_TFIDF 

the combination of TF and IDF

Definition at line 84 of file odla_ops_nn.h.

84 {
odla_tf_idf_mode
TF-IDF computation mode.
Definition: odla_ops_nn.h:84
@ ODLA_TFIDF_TFIDF
Definition: odla_ops_nn.h:87
@ ODLA_TFIDF_IDF
Definition: odla_ops_nn.h:86
@ ODLA_TFIDF_TF
Definition: odla_ops_nn.h:85

Function Documentation

◆ odla_AveragePool()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_AveragePool ( odla_value  input,
odla_memory_layout  input_layout,
const odla_uint32 window_dims,
const odla_uint32 strides,
const odla_uint32 paddings_front,
const odla_uint32 paddings_back,
odla_bool  padding_included,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Avgerage pooling.

AveragePool computes the average pooling across the input according to the window size, strides and paddings.

Parameters
inputthe input value
input_layoutthe memory layout of input
window_dimsthe spatial dimension of window
stridesthe stride along each spatial axis
paddings_frontpaddings applied to the start of each spatial dimension
paddings_backpaddings applied to the end of each spatial dimension
padding_includedpadded values included when computing average
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_BatchNormalization()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_BatchNormalization ( odla_value  input,
odla_memory_layout  input_layout,
odla_value  mean,
odla_value  var,
odla_float32  epsilon,
odla_value  scale,
odla_value  offset,
odla_float32  scalar_scale,
odla_float32  scalar_offset,
const odla_value_id  value_id 
)

Compute batch normalization.

BatchNormalization computes the batch normalization on input as y = (x - mean) / sqrt(var + epsilon). The result can then be scaled and biased. If scale is not null, it will be applied. Otherwise, scalar value scalar_scale will be applied. Similar to offset and scalar_offset.

Parameters
inputthe input value
input_layoutthe memory layout of input
meanthe mean value
varthe variance value
epsilonthe epsilon
scaleoptional scale vector (can be NULL). If not NULL, it must be a vector with the same size as number of channels.
offsetoptional offset vector (can be NULL). If not NULL, it must be a vector with the same size as number of channels.
scalar_scaleIf scale is NULL, this value will be used.
scalar_offsetif offset is NULL, this value will be used.
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Celu()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Celu ( odla_value  input,
odla_float32  alpha,
const odla_value_id  value_id 
)

Celu activation.

Celu computes the celu activaion as y = x < 0 ? alpha * (exp(x / alpha) - 1) : x

Parameters
inputthe input value
alphathe coefficient
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Conv()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Conv ( odla_value  input,
odla_memory_layout  input_layout,
odla_uint32  group,
odla_value  kernel,
odla_memory_layout  kernel_layout,
const odla_uint32 strides,
const odla_uint32 dilations,
const odla_uint32 paddings_front,
const odla_uint32 paddings_back,
odla_value  bias,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

N-dimensional Convolution.

Conv computes convolution of input and kernel based on the strides, dialiations, padding and group. The result can be added with bias optionally.

Parameters
inputthe input value
input_layoutthe memory layout of input
groupnumber of groups input and output channels are divided into
kernelthe kernel value
kernel_layoutthe memory layout of kernel
stridesthe stride along each spatial axis
dilationsdilations (same number of values as strides)
paddings_frontpaddings applied to the start of each spatial dim
paddings_backpaddings applied to the end of each spatial dim
biasoptional bias. NULL if not needed.
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_DeConv()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_DeConv ( odla_value  input,
odla_memory_layout  input_layout,
odla_uint32  group,
odla_value  kernel,
odla_memory_layout  kernel_layout,
const odla_uint32 strides,
const odla_uint32 dilations,
const odla_uint32 paddings_front,
const odla_uint32 paddings_back,
odla_value  bias,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

N-dimensional Deconvolution.

DeConv computes the deconvolution (transposed convolution) based on the strides, dialiations, padding and group. The result can be added with bias optionally.

Parameters
inputthe input value
input_layoutthe memory layout of input
groupnumber of groups input and output channels are divided into
kernelthe kernel value
kernel_layoutthe storage layout of kernel in memory
stridesthe stride along each spatial axis
dilationsdilations (same number of values as strides)
paddings_frontpaddings applied to the start of each spatial dim
paddings_backpaddings applied to the end of each spatial dim
biasoptional bias. NULL if not needed.
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Elu()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Elu ( odla_value  input,
odla_float32  alpha,
const odla_value_id  value_id 
)

Elu activation.

Elu computes the elu activaion as y = x < 0 ? alpha * (exp(x) - 1) : x

Parameters
inputthe input value
alphathe coefficient
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Gelu()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Gelu ( odla_value  input,
odla_bool  use_approx,
const odla_value_id  value_id 
)

Gelu activation.

Gelu computes gaussian error linear unit activation as 0.5 * x *(1 + erf(x / sqrt(2)))

Parameters
inputthe input value
use_approxuse the approximated version or not
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_GroupNormalization()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_GroupNormalization ( odla_value  input,
odla_memory_layout  input_layout,
odla_int32  groups,
odla_float32  epsilon,
odla_value  scale,
odla_value  offset,
odla_float32  scalar_scale,
odla_float32  scalar_offset,
const odla_value_id  value_id 
)

Group Normalization.

GroupNormalization normalizes the features within channel groups.

Parameters
inputthe input value
input_layoutthe memory layout of input
groupsthe number of groups
epsilonthe epsilon
scaleoptional scale value (can be NULL)
offsetoptional offset value (Default is NULL)
scalar_scaleIf scale is NULL, this value will be used.
scalar_offsetif offset is NULL, this value will be used.
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_GRU()

ODLA_API_EXPORT odla_values ODLA_API_CALL odla_GRU ( odla_value  input,
odla_rnn_weight_format  weight_format,
odla_rnn_gate_order  gate_order,
odla_value_shape  weight_dims,
odla_value  W,
odla_value  R,
odla_value  B,
odla_value  sequence_lens,
odla_value  initial_h,
odla_int32  hidden_size,
odla_rnn_direction  direction,
odla_bool  linear_before_reset,
odla_rnn_outputs  outputs,
const odla_value_ids  value_id 
)

Compute a one-layer GRU.

GRU computes one-layer GRU. The output values are determined by outputs.

Parameters
inputthe input value
weight_formatthe data layout of weights
gate_orderthe order of gates in weights
weight_dimsthe dims of weights
Wthe weights for gates. Assuming layout of [in, out, forget, cell]
Rthe recurrence weight
Bthe optional bias
sequence_lensthe sequence length
initial_hthe initial value of the hidden(can be NULL)
hidden_sizethe size of hidden neurons
directionthe directon of network
linear_before_resetWhether to apply linear transformation before multiplying by the output of reset gate
outputsspeicify needed option outputs
value_idsan array of values ids (can be NULL)
Returns
odla_value

◆ odla_Hardmax()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Hardmax ( odla_value  input,
odla_int32  axis,
const odla_value_id  value_id 
)

Hardmax computation.

Hardmax computes one-hot tensor for the location of the highest value alone with specified axis.

Parameters
inputthe input value
axisthe dimension alone with hardmax will perform on
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_HardSigmoid()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_HardSigmoid ( odla_value  input,
odla_float32  alpha,
odla_float32  beta,
const odla_value_id  value_id 
)

HardSigmoid activation.

HardSigmoid computes the hard sigmoid function as y = max(0, min( 1, alpha * x

  • beta)).
Parameters
inputthe input value
alphavalue of alpha
betavalue of beta
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_InstanceNormalization()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_InstanceNormalization ( odla_value  input,
odla_memory_layout  input_layout,
odla_float32  epsilon,
odla_value  scale,
odla_value  offset,
odla_float32  scalar_scale,
odla_float32  scalar_offset,
const odla_value_id  value_id 
)

Instance Normalization.

InstanceNormalization computes the instance normalization as
y = scale * (x - mean) / sqrt(variance + epsilon) + bias
mean and var are per channel per instance.

Parameters
inputthe input value
input_layoutthe memory layout of input
epsilonthe epsilon
scaleoptional scale value (can be NULL)
offsetoptional offset value (Default is NULL)
scalar_scaleIf scale is NULL, this value will be used.
scalar_offsetif offset is NULL, this value will be used.
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_LeakyRelu()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_LeakyRelu ( odla_value  input,
odla_float32  alpha,
const odla_value_id  value_id 
)

LeakyRelu activation.

LeakyRelu computes the LeakyRelu activation as y = x < 0 ? alpha * x : x

Parameters
inputthe input value
alphathe alpha value
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_LogSoftmax()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_LogSoftmax ( odla_value  input,
odla_int32  axis,
const odla_value_id  value_id 
)

LogSoftmax activation.

LogSoftmax computes the log softmax activation as y = x - log(reduce_sum(exp(x), axis))

Parameters
inputthe input value
axisthe dimension it will perform on
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_LpNormalize()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_LpNormalize ( odla_value  input,
odla_int32  p,
odla_memory_layout  input_layout,
odla_size_t  axes_size,
const odla_int32 axes,
odla_float32  epsilon,
odla_value  scale,
const odla_value_id  value_id 
)

LpNormalize.

LpNormalize currently supports L1Normalize and L2Normalize L1Normalize computes the L1 normalization as
yi = scale * ( xi / sum(abs(xi) + epsilon) )
. L2Normalize computes the L2 normalization as
yi = scale * ( xi / sqrt(sum(xi^2) + epsilon) )
.

Parameters
inputthe input value
pthe exponent value in the norm formulation
input_layoutthe memory layout of input
axes_sizenubmer of axes
axesthe axes along which to normalize
epsilonthe epsilon
scaleoptional scale value (can be NULL)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_LRN()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_LRN ( odla_value  input,
odla_memory_layout  input_layout,
odla_int32  window_size,
odla_float32  alpha,
odla_float32  beta,
odla_float32  bias,
const odla_value_id  value_id 
)

Local Response Normalization normalizes over local regions on input The result can then be scaled and biased.

Parameters
inputthe input value.
input_layoutthe memory layout of input.
window_sizethe size of the local region.
alphathe scalaing factor.
betathe exponent.
biasthe offset.
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_LSTM()

ODLA_API_EXPORT odla_values ODLA_API_CALL odla_LSTM ( odla_value  input,
odla_rnn_weight_format  weight_format,
odla_rnn_gate_order  gate_order,
odla_value_shape  weight_dims,
odla_value  W,
odla_value  R,
odla_value  B,
odla_value  sequence_lens,
odla_value  initial_h,
odla_value  initial_c,
odla_value  P,
odla_int32  hidden_size,
odla_rnn_direction  direction,
odla_rnn_outputs  outputs,
const odla_value_ids  value_ids 
)

LSTM.

LSTM computes one-layer LSTM.

Parameters
inputthe input value
weight_formatthe data layout of weights
gate_orderthe order of gates in weights
weight_dimsthe dims of weights
Wthe weights for gates. Assuming layout of [in, out, forget, cell]
Rthe recurrence weight
Bthe optional bias
sequence_lensthe lengths of the sequences in a batch
initial_hthe initial value of the hidden(can be NULL)
initial_cthe initial value of the cell(can be NULL)
Pthe weight tensor for peepholes(can be NULL).
hidden_sizethe size of hidden neurons
directionthe directon of network
outputsspeicify needed option outputs
value_idsan array of value ids (can be NULL)
Returns
odla_values

◆ odla_MaxPool()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_MaxPool ( odla_value  input,
odla_memory_layout  input_layout,
const odla_uint32 window_dims,
const odla_uint32 strides,
const odla_uint32 paddings_front,
const odla_uint32 paddings_back,
odla_value_shape  output_dims,
const odla_value_id  value_id 
)

Max Pooling.

MaxPool computes the max pooling across the input according to the window size, strides and paddings.

Parameters
inputthe input value
input_layoutthe memory layout of input
window_dimsthe spatial dimension of window
stridesthe stride along each spatial axis
paddings_frontpaddings applied to the start of each spatial dim
paddings_backpaddings applied to the end of each spatial dim
output_dimsthe optional output shape (can be undefined)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_NegativeLogLikeliHoodLoss()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_NegativeLogLikeliHoodLoss ( odla_value  input,
odla_value  gt,
odla_int32  ignored,
odla_reduction_mode  reduction,
odla_value  weight,
odla_value_shape  output_shape,
odla_value_id  value_id 
)

Negative Log Likelihood Loss.

NegativeLogLikeliHoodLoss computes negative log likelihood loss.

Parameters
inputthe input value
gtthe ground truth (label) value
ignoredthe ignored label value
reductionoptional reduction
weightoptional weight
output_shapeoutput shape
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_NMS()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_NMS ( odla_value  boxes,
odla_value  scores,
odla_uint32  max_num_outputs,
odla_float32  iou_threshold,
odla_float32  score_threshold,
odla_value_type  output_value_type,
const odla_value_id  value_id 
)

Non-Max Suppression.

NMS applies the Non-max suppression on boxes that have overlap above iou_threshold.

Parameters
boxesthe coordinates of boxes
scoresthe scores
max_num_outputsthe maximum number of outputs
iou_thresholdthe threshold of IoU
score_threholdthe threshold of scores
output_value_typethe output value type (an integer value type)
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_PostProcess()

ODLA_API_EXPORT odla_values ODLA_API_CALL odla_PostProcess ( odla_value  orig_img_w,
odla_value  orig_img_h,
odla_value  bb13,
odla_value  bb26,
odla_value  bb52,
const odla_value_id  value_id 
)

Yolov3 Post Process.

PostProcess Return Selected Info (cx, cy, w, h, pred_cls) of Each Class

Parameters
orig_img_wthe width of original image
orig_img_hthe height of original image
bb13BBoxes 13 x 13
bb26BBoxes 26 x 26
bb52BBoxes 52 x 52
value_ida unique value id (can be NULL)
Returns
odla_values

◆ odla_PRelu()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_PRelu ( odla_value  input,
odla_value  slope,
const odla_value_id  value_id 
)

PRelu activation.

PRelu computes the PRelu activation as y = x < 0 ? slope * x : x

Parameters
inputthe input value
slopethe slope value
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Relu()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Relu ( odla_value  input,
const odla_value_id  value_id 
)

Relu activation.

Relu computes the relu activation as y = x < 0 : 0 ? x

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

◆ odla_RNN()

ODLA_API_EXPORT odla_values ODLA_API_CALL odla_RNN ( odla_value  input,
odla_rnn_weight_format  weight_format,
odla_value_shape  weight_dims,
odla_value  W,
odla_value  R,
odla_value  B,
odla_value  sequence_lens,
odla_value  initial_h,
odla_int32  hidden_size,
odla_rnn_direction  direction,
odla_rnn_outputs  outputs,
const odla_value_ids  value_id 
)

Compute a one-layer RNN.

RNN computes one-layer Recurrent Neuron Network. The output values are determined by outputs.

Parameters
inputthe input value
weight_formatthe data layout of weights
weight_dimsthe dims of weights
Wthe weights for gates. Assuming layout of [in, out, forget, cell]
Rthe recurrence weight
Bthe optional bias
sequence_lensthe sequence length
initial_hthe initial value of the hidden(can be NULL)
hidden_sizethe size of hidden neurons
directionthe directon of network
outputsspeicify needed option outputs
value_idsan array of values ids (can be NULL)
Returns
odla_value

◆ odla_ROIAlign()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ROIAlign ( odla_value  input,
odla_memory_layout  input_layout,
odla_value  rois,
odla_int32  sampling_ratio,
odla_float32  scale,
odla_value_shape  output_dim,
const odla_value_id  value_id 
)

Region of Interest align.

ROIAlign computes the corresponding data from input using rois via bilinear interpolation.

Parameters
inputthe input value
input_layoutthe memory layout of input
roisthe ROIs to pool. Dims of [num of ROIs, 4]
sampling_rationumber of sampling points in the interpolation grid
scalethe scale factor to translate the ROI coordinates when pooling
output_dimoutput dimension
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_ROIMaxPool()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ROIMaxPool ( odla_value  input,
odla_memory_layout  input_layout,
odla_value  rois,
odla_int32  win_h,
odla_int32  win_w,
odla_float32  scale,
odla_value_shape  output_dim,
const odla_value_id  value_id 
)

ROI max pooling.

ROIMaxPool Computes corresponding data from input using rois via max pooling.

Parameters
inputthe input value
input_layoutthe memory layout of input
roisthe ROIs to pool. Dims of [num of ROIs, 4]
win_hthe height of the pooling window
win_wthe width of the pooling window
scalethe scale factor to translate the ROI coordinates when pooling
output_dimoutput dimension
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Selu()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Selu ( odla_value  input,
odla_float32  alpha,
odla_float32  gamma,
const odla_value_id  value_id 
)

Selu activation.

Selu computes the selu activation as y = x <= 0 ? gamma * (alpha * e^x - alpha) : gamma * x

Parameters
inputthe input value
alphathe alpha value
gammathe gamma value
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Shrink()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Shrink ( odla_value  input,
odla_float32  bias,
odla_float32  lambd,
const odla_value_id  value_id 
)

Shrink activation.

Shrink computes the function if x < -lambd, y = x + bias; if x > lambd, y = x - bias; Otherwise, y = 0.

Parameters
inputthe input value
biasvalue of bias
lambdvalue of lambd
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Sigmoid()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Sigmoid ( odla_value  input,
const odla_value_id  value_id 
)

Sigmoid activation.

Sigmoid computes the sigmoid activation as y = 1 / (1 + exp(-x))

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

◆ odla_Softmax()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Softmax ( odla_value  input,
odla_int32  axis,
const odla_value_id  value_id 
)

Softmax activation.

Softmax computes the softmax activation as y = exp(x) / reduce_sum(exp(x), axis)

Parameters
inputthe input value
axisthe dimension it will perform on
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_Softplus()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Softplus ( odla_value  input,
const odla_value_id  value_id 
)

Softplus activation.

Softplus computes the Softplus activation as y = ln(exp(x) + 1)

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

◆ odla_Softsign()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_Softsign ( odla_value  input,
const odla_value_id  value_id 
)

Softsign activation.

Softsign computes the Softsign activation as y = x / (1 + |x|)

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

◆ odla_TFIDFVectorize()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_TFIDFVectorize ( odla_value  input,
odla_int32  min_gram_length,
odla_int32  max_gram_length,
odla_int32  max_skip_count,
odla_tf_idf_mode  mode,
odla_value  pool,
odla_value  gram_counts,
odla_value  output_indices,
odla_value  weights,
odla_value_shape  output_shape,
odla_value_id  value_id 
)

TF-IDF vectorization.

TFIDF vectorizes input sequence into a vector.

Parameters
inputthe input value
min_gram_lengththe minimum gram length to extract
max_gram_lengththe maximum gram length to extract
max_skip_countthe maximum items to be skipped
modethe weighting metric to be used
poolthe grams pool
gram_countszero-based starting indices of n-grams in the pool
output_indicesthe mapping of gram indices to output tensor
weightsoptional weights used when mode is ODLA_TFIDF_IDF or ODLA_TFIDF_TFIDF
output_shapeshape of output
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_ThresholdedRelu()

ODLA_API_EXPORT odla_value ODLA_API_CALL odla_ThresholdedRelu ( odla_value  input,
odla_float32  alpha,
const odla_value_id  value_id 
)

ThresholdedRelu activation.

ThresholdedRelu computes the ThresholdedRelu activation as y = x > alpha ? x : 0

Parameters
inputthe input value
alphathe alpha value
value_ida unique value id (can be NULL)
Returns
odla_value

◆ odla_TopK()

ODLA_API_EXPORT odla_values ODLA_API_CALL odla_TopK ( odla_value  input,
odla_uint32  K,
odla_bool  largest,
odla_bool  sorted,
odla_uint32  axis,
odla_value_type  output_value_type,
odla_value_type  output_value_index_type,
const odla_value_ids  value_ids 
)

Find Top-K elements.

TopK returns the top-K largest or smallest elements and index

Parameters
inputthe input value
Kthe number of top values to be returned
largestindicates largest (true) or smallest values to retrieve
sortedindicates if the results are sorted or in original order
dimensionon which to do the sort
output_value_typethe output 0 type
output_value_index_typethe output 1 type
value_idsan array of value ids (can be NULL)
Returns
odla_values