|
Open Deep Learning API
|
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... | |
This file defines the ODLA neural network related operators.
Definition in file odla_ops_nn.h.
| enum odla_memory_layout |
Memory layout of data.
Definition at line 33 of file odla_ops_nn.h.
| enum odla_reduction_mode |
Definition at line 59 of file odla_ops_nn.h.
| enum 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.
| enum odla_rnn_gate_order |
RNN data layout.
Definition at line 75 of file odla_ops_nn.h.
| enum 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.
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.
| enum 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.
| 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.
| input | the input value |
| input_layout | the memory layout of input |
| window_dims | the spatial dimension of window |
| strides | the stride along each spatial axis |
| paddings_front | paddings applied to the start of each spatial dimension |
| paddings_back | paddings applied to the end of each spatial dimension |
| padding_included | padded values included when computing average |
| output_dims | the optional output shape (can be undefined) |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| input_layout | the memory layout of input |
| mean | the mean value |
| var | the variance value |
| epsilon | the epsilon |
| scale | optional scale vector (can be NULL). If not NULL, it must be a vector with the same size as number of channels. |
| offset | optional offset vector (can be NULL). If not NULL, it must be a vector with the same size as number of channels. |
| scalar_scale | If scale is NULL, this value will be used. |
| scalar_offset | if offset is NULL, this value will be used. |
| value_id | a unique value id (can be NULL) |
| 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
| input | the input value |
| alpha | the coefficient |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| input_layout | the memory layout of input |
| group | number of groups input and output channels are divided into |
| kernel | the kernel value |
| kernel_layout | the memory layout of kernel |
| strides | the stride along each spatial axis |
| dilations | dilations (same number of values as strides) |
| paddings_front | paddings applied to the start of each spatial dim |
| paddings_back | paddings applied to the end of each spatial dim |
| bias | optional bias. NULL if not needed. |
| output_dims | the optional output shape (can be undefined) |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| input_layout | the memory layout of input |
| group | number of groups input and output channels are divided into |
| kernel | the kernel value |
| kernel_layout | the storage layout of kernel in memory |
| strides | the stride along each spatial axis |
| dilations | dilations (same number of values as strides) |
| paddings_front | paddings applied to the start of each spatial dim |
| paddings_back | paddings applied to the end of each spatial dim |
| bias | optional bias. NULL if not needed. |
| output_dims | the optional output shape (can be undefined) |
| value_id | a unique value id (can be NULL) |
| 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
| input | the input value |
| alpha | the coefficient |
| value_id | a unique value id (can be NULL) |
| 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)))
| input | the input value |
| use_approx | use the approximated version or not |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| input_layout | the memory layout of input |
| groups | the number of groups |
| epsilon | the epsilon |
| scale | optional scale value (can be NULL) |
| offset | optional offset value (Default is NULL) |
| scalar_scale | If scale is NULL, this value will be used. |
| scalar_offset | if offset is NULL, this value will be used. |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| weight_format | the data layout of weights |
| gate_order | the order of gates in weights |
| weight_dims | the dims of weights |
| W | the weights for gates. Assuming layout of [in, out, forget, cell] |
| R | the recurrence weight |
| B | the optional bias |
| sequence_lens | the sequence length |
| initial_h | the initial value of the hidden(can be NULL) |
| hidden_size | the size of hidden neurons |
| direction | the directon of network |
| linear_before_reset | Whether to apply linear transformation before multiplying by the output of reset gate |
| outputs | speicify needed option outputs |
| value_ids | an array of values ids (can be NULL) |
| 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.
| input | the input value |
| axis | the dimension alone with hardmax will perform on |
| value_id | a unique value id (can be NULL) |
| 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
| input | the input value |
| alpha | value of alpha |
| beta | value of beta |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| input_layout | the memory layout of input |
| epsilon | the epsilon |
| scale | optional scale value (can be NULL) |
| offset | optional offset value (Default is NULL) |
| scalar_scale | If scale is NULL, this value will be used. |
| scalar_offset | if offset is NULL, this value will be used. |
| value_id | a unique value id (can be NULL) |
| 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
| input | the input value |
| alpha | the alpha value |
| value_id | a unique value id (can be NULL) |
| 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))
| input | the input value |
| axis | the dimension it will perform on |
| value_id | a unique value id (can be NULL) |
| 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) )
.
| input | the input value |
| p | the exponent value in the norm formulation |
| input_layout | the memory layout of input |
| axes_size | nubmer of axes |
| axes | the axes along which to normalize |
| epsilon | the epsilon |
| scale | optional scale value (can be NULL) |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value. |
| input_layout | the memory layout of input. |
| window_size | the size of the local region. |
| alpha | the scalaing factor. |
| beta | the exponent. |
| bias | the offset. |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| weight_format | the data layout of weights |
| gate_order | the order of gates in weights |
| weight_dims | the dims of weights |
| W | the weights for gates. Assuming layout of [in, out, forget, cell] |
| R | the recurrence weight |
| B | the optional bias |
| sequence_lens | the lengths of the sequences in a batch |
| initial_h | the initial value of the hidden(can be NULL) |
| initial_c | the initial value of the cell(can be NULL) |
| P | the weight tensor for peepholes(can be NULL). |
| hidden_size | the size of hidden neurons |
| direction | the directon of network |
| outputs | speicify needed option outputs |
| value_ids | an array of value ids (can be NULL) |
| 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.
| input | the input value |
| input_layout | the memory layout of input |
| window_dims | the spatial dimension of window |
| strides | the stride along each spatial axis |
| paddings_front | paddings applied to the start of each spatial dim |
| paddings_back | paddings applied to the end of each spatial dim |
| output_dims | the optional output shape (can be undefined) |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| gt | the ground truth (label) value |
| ignored | the ignored label value |
| reduction | optional reduction |
| weight | optional weight |
| output_shape | output shape |
| value_id | a unique value id (can be NULL) |
| 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.
| boxes | the coordinates of boxes |
| scores | the scores |
| max_num_outputs | the maximum number of outputs |
| iou_threshold | the threshold of IoU |
| score_threhold | the threshold of scores |
| output_value_type | the output value type (an integer value type) |
| value_id | a unique value id (can be NULL) |
| 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
| orig_img_w | the width of original image |
| orig_img_h | the height of original image |
| bb13 | BBoxes 13 x 13 |
| bb26 | BBoxes 26 x 26 |
| bb52 | BBoxes 52 x 52 |
| value_id | a unique value id (can be NULL) |
| 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
| input | the input value |
| slope | the slope value |
| value_id | a unique value id (can be NULL) |
| 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
| input | the input value |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| weight_format | the data layout of weights |
| weight_dims | the dims of weights |
| W | the weights for gates. Assuming layout of [in, out, forget, cell] |
| R | the recurrence weight |
| B | the optional bias |
| sequence_lens | the sequence length |
| initial_h | the initial value of the hidden(can be NULL) |
| hidden_size | the size of hidden neurons |
| direction | the directon of network |
| outputs | speicify needed option outputs |
| value_ids | an array of values ids (can be NULL) |
| 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.
| input | the input value |
| input_layout | the memory layout of input |
| rois | the ROIs to pool. Dims of [num of ROIs, 4] |
| sampling_ratio | number of sampling points in the interpolation grid |
| scale | the scale factor to translate the ROI coordinates when pooling |
| output_dim | output dimension |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| input_layout | the memory layout of input |
| rois | the ROIs to pool. Dims of [num of ROIs, 4] |
| win_h | the height of the pooling window |
| win_w | the width of the pooling window |
| scale | the scale factor to translate the ROI coordinates when pooling |
| output_dim | output dimension |
| value_id | a unique value id (can be NULL) |
| 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
| input | the input value |
| alpha | the alpha value |
| gamma | the gamma value |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| bias | value of bias |
| lambd | value of lambd |
| value_id | a unique value id (can be NULL) |
| 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))
| input | the input value |
| value_id | a unique value id (can be NULL) |
| 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)
| input | the input value |
| axis | the dimension it will perform on |
| value_id | a unique value id (can be NULL) |
| 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)
| input | the input value |
| value_id | a unique value id (can be NULL) |
| 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|)
| input | the input value |
| value_id | a unique value id (can be NULL) |
| 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.
| input | the input value |
| min_gram_length | the minimum gram length to extract |
| max_gram_length | the maximum gram length to extract |
| max_skip_count | the maximum items to be skipped |
| mode | the weighting metric to be used |
| pool | the grams pool |
| gram_counts | zero-based starting indices of n-grams in the pool |
| output_indices | the mapping of gram indices to output tensor |
| weights | optional weights used when mode is ODLA_TFIDF_IDF or ODLA_TFIDF_TFIDF |
| output_shape | shape of output |
| value_id | a unique value id (can be NULL) |
| 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
| input | the input value |
| alpha | the alpha value |
| value_id | a unique value id (can be NULL) |
| 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
| input | the input value |
| K | the number of top values to be returned |
| largest | indicates largest (true) or smallest values to retrieve |
| sorted | indicates if the results are sorted or in original order |
| dimension | on which to do the sort |
| output_value_type | the output 0 type |
| output_value_index_type | the output 1 type |
| value_ids | an array of value ids (can be NULL) |