diff options
Diffstat (limited to 'runtimes/include/NeuralNetworksEx.h')
-rw-r--r-- | runtimes/include/NeuralNetworksEx.h | 747 |
1 files changed, 747 insertions, 0 deletions
diff --git a/runtimes/include/NeuralNetworksEx.h b/runtimes/include/NeuralNetworksEx.h new file mode 100644 index 000000000..601bb2cf7 --- /dev/null +++ b/runtimes/include/NeuralNetworksEx.h @@ -0,0 +1,747 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file NeuralNetworksEx.h + * @brief This file contains ANeuralNetworksModel_addOperationEx function definition + * @note This header describes experimental feature, + * so specification here can be changed or/and removed + */ +#ifndef NN_RUNTIME_NEURAL_NETWORKS_EX_H +#define NN_RUNTIME_NEURAL_NETWORKS_EX_H + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +/** + * @brief Extended operation types + */ +typedef enum { + /** extends operation. */ + + /** + * Casts a tensor/tensor-values to a new type + * + * The output value is calucated as: + * + * output = new_type(input) + * + * Ex: + * X = {1.8,2.2}, dtype of X = float32 + * Y = Cast(X), dtype of Y = int32 + * then Y = {1,2} + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D tensor, specifying the first input. + * + * Outputs: + * * 0: The output tensor, of the same {@link OperandCode} and shape as input0. + */ + ANEURALNETWORKS_CAST_EX = 50000, + + /** + * Gathers values along an axis. + * + * Produces an output tensor with shape + * input0.dimension[:axis] + indices.dimension + input0.dimension[axis + 1:] + * where: + * # Vector indices (output is rank(input0)). + * output[a_0, ..., a_n, i, b_0, ..., b_n] = + * input0[a_0, ..., a_n, indices[i], b_0, ..., b_n] + * + * # Higher rank indices (output is rank(input0) + rank(indices) - 1). + * output[a_0, ..., a_n, i, ..., j, b_0, ... b_n] = + * input0[a_0, ..., a_n, indices[i, ..., j], b_0, ..., b_n] + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: from 1 + * + * Inputs: + * * 0: An n-D tensor from which to gather values. + * * 1: A k-D tensor {@link ANEURALNETWORKS_TENSOR_INT32} of indices. + * The values must be in the bounds of the corresponding dimensions + * of input0. + * * 2: An {@link ANEURALNETWORKS_INT32} scalar specifying the axis. + * Negative index is used to specify axis from the end + * (e.g. -1 for the last axis). Must be in the range [-n, n). + * + * Outputs: + * * 0: An (n + k - 1)-D tensor with the same {@link OperandCode} as input0. + */ + ANEURALNETWORKS_GATHER_EX = 50001, /**< Gather slices according to indexes and axis */ + + /** + * Finds values and indices of the k largest entries for the last dimension. + * + * Resulting values in each dimensions are sorted in descending order. If + * two values are equal, the one with larger index appears first. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: from 1 + * + * Inputs: + * * 0: input, an n-D tensor specifying the input. + * * 1: k, an {@link ANEURALNETWORKS_INT32} scalar, specifying the number of + * top elements to look for along the last dimension. + * + * Outputs: + * * 0: An n-D tensor of the same type as the input, containing the k + * largest elements along each last dimensional slice. + * * 1: An n-D tensor of type {@link ANEURALNETWORKS_TENSOR_INT32} + * containing the indices of values within the last dimension of input. + */ + ANEURALNETWORKS_TOPK_V2_EX = 50002, + + /** + * Computes the maximum of elements across dimensions of a tensor. + * + * Reduces the input tensor along the given dimensions to reduce. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: A tensor, specifying the input. + * * 1: A 1-D Tensor of {@link ANEURALNETWORKS_TENSOR_INT32}. The dimensions + * to reduce. + * + * Outputs: + * * 0: A tensor of the same {@link OperandCode} as input0. + */ + ANEURALNETWORKS_REDUCE_MAX_EX = 50003, + + /** + * Splits a tensor along a given axis into num_splits subtensors. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: from 1 + * + * Inputs: + * * 0: An n-D tensor to split. + * * 1: An {@link ANEURALNETWORKS_INT32} scalar specifying the axis along + * which to split. + * * 2: An {@link ANEURALNETWORKS_INT32} scalar indicating the number of + * splits along given axis. Must evenly divide axis size. + * + * Outputs: + * * 0 ~ (num_splits - 1): Resulting subtensors. + */ + ANEURALNETWORKS_SPLIT_EX = 50004, /**< Splits a tensor into sub tensors */ + + /** + * Computes element-wise reciprocal of square root of the input tensor. + * + * The output is calculated using this formula: + * + * output = 1/sqrt(input) + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D tensor, specifying the first input. + * + * Outputs: + * * 0: The output tensor, of the same {@link OperandCode} and shape as input0. + */ + ANEURALNETWORKS_RSQRT_EX = 50005, + + /** + * Computes element-wise squared difference on the input tensors. + * + * Takes two input tensors of identical {@link OperandCode} and compatible dimensions. + * The output is the result of squaring of difference given by subtracting the second input tensor + * from the first one. + * + * Two dimensions are compatible when: + * 1. they are equal, or + * 2. one of them is 1 + * + * The size of the output is the maximum size along each dimension of the + * input operands. It starts with the trailing dimensions, and works its way + * forward. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D tensor, specifying the first input. + * * 1: A tensor of the same {@link OperandCode}, and compatible dimensions + * as input0. + * + * Outputs: + * * 0: The output tensor, of the same {@link OperandCode} as input0. + */ + ANEURALNETWORKS_SQUARED_DIFFERENCE_EX = 50006, + + /** + * Computes numerical negative value element-wise on the input tensor. + * + * Given an input tensor of {@link OperandCode}, + * The output is the numerical negative value element-wise on the input tensor. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D tensor, specifying the input. + * + * Outputs: + * * 0: The output tensor, of the same {@link OperandCode} and shape as input0. + */ + ANEURALNETWORKS_NEG_EX = 50007, + + /** + * Computes exponential value element-wise on the input tensor. + * + * Given an input tensor of {@link OperandCode}, + * The output is the exponential value element-wise on the input tensor. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D tensor, specifying the input. + * + * Outputs: + * * 0: The output tensor, of the same {@link OperandCode} and shape as input0. + */ + ANEURALNETWORKS_EXP_EX = 50008, + + /** + * Computes the sum of elements across dimensions of a tensor. + * + * Reduces the input tensor along the given dimensions to reduce. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: A tensor, specifying the input. + * * 1: A 1-D Tensor of {@link ANEURALNETWORKS_TENSOR_INT32}. The dimensions + * to reduce. + * + * Outputs: + * * 0: A tensor of the same {@link OperandCode} as input0. + */ + ANEURALNETWORKS_REDUCE_SUM_EX = 50009, + + /** + * A transposed convolutional layer carries out a regular convolution + * but reverts its spatial transformation. + * Transpose convolution basically performs convolution with transposed weights. + * + * Supported tensor {@link OperandCode}: + * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: only 4 + * + * Inputs: + * 0: An {@link ANEURALNETWORKS_INT32} 1-D four element tensor, specifying the output shape. + * 1: A 4-D tensor, of shape [depth_out, filter_height, filter_width, depth_in], + * specifying the filter. + * 2: A 4-D tensor, of shape [batches, height, width, depth_in], specifying the input. + * 3: An {@link ANEURALNETWORKS_INT32} scalar, specifying the padding type. + * 4: An {@link ANEURALNETWORKS_INT32} scalar, specifying the stride when + * walking through input in the ‘width’ dimension. + * 5: An {@link ANEURALNETWORKS_INT32} scalar, specifying the stride when + * walking through input in the height dimension. + * + * Outputs: + * 0: The output 4-D tensor, of shape [batches, out_height, out_width, depth_out]. + */ + ANEURALNETWORKS_TRANSPOSE_CONV_EX = 50010, + + /** + * Computes element-wise truth value by comparing the two input tensors for equality. + * + * Takes two input tensors of identical {@link OperandCode} and compatible dimensions. + * The output is the result of comparison of two input tensors. + * + * Two dimensions are compatible when: + * 1. they are equal, or + * 2. one of them is 1 + * + * The size of the output is the maximum size along each dimension of the + * input operands. It starts with the trailing dimensions, and works its way + * forward. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D tensor, specifying the first input. + * * 1: A tensor of the same {@link OperandCode}, and compatible dimensions + * as input0. + * + * Outputs: + * * 0: A boolean tensor indicating the truth value of (x == y) + * Stored as {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} with offset 0 + * and scale 1.0f. + * A non-zero byte represents True, a hit. A zero indicates otherwise. + */ + ANEURALNETWORKS_EQUAL_EX = 50011, + + /** + * Computes element-wise absolute value of the input tensor. + * + * The output is calculated using this formula: + * + * output = fabs(input) + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D tensor, specifying the first input. + * + * Outputs: + * * 0: The output tensor, of the same {@link OperandCode} and shape as input0. + */ + ANEURALNETWORKS_ABS_EX = 50012, + /** + * Packs a list of rank-R tensors into one rank- (R+1) tensor along the axis dimension. + * + * The input tensors must have identical {@link OperandCode} and the same + * dimensions. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 3 + * + * Inputs: + * * 0 ~ n-1: The list of n input tensors, of shape + * [D0, D1, ..., Daxis(i), ..., Dm]. For inputs of + * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM}, all input tensors + * must have the same scale and zeroPoint. + * * n: An {@link ANEURALNETWORKS_INT32} scalar, specifying the + * number of input tensors. + * * n+1: An {@link ANEURALNETWORKS_INT32} scalar, specifying the + * pack axis. + * + * Outputs: + * * 0: The output, a tensor of the same {@link OperandCode} as the input + * tensors. The output shape is [D0, D1, ..., N at Daxis(i), ..., Dm+1] + * where N is the number of tensors to be packed. + */ + ANEURALNETWORKS_PACK_EX = 50013, + /** + * Unpacks a given rank-R tensors into num_splits rank- (R-1) tensors along the axis dimension. + * num_splits has to respect integral divisibility of dimension value along axis dimension + * of the input. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: The input shape is [D0, D1, ..., N at Daxis(i), ..., Dm+1]. + * * 1: An {@link ANEURALNETWORKS_INT32} scalar, specifying the + * number of splits along unpack axis. + * * 2: An {@link ANEURALNETWORKS_INT32} scalar, specifying the + * unpack axis. + * + * Outputs: + * * 0 ~ n-1: The list of n output tensors, of shape + * [D0, D1, ..., Daxis(i), ..., Dm]. The output tensors are of the same + * {@link OperandCode} as the input tensor 0. + */ + ANEURALNETWORKS_UNPACK_EX = 50014, + + /** + * Returns the index of the largest element along an axis. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: from 1 + * + * Inputs: + * * 0: An n-D tensor, specifying the input. + * * 1: An {@link ANEURALNETWORKS_INT32} scalar specifying the axis to + * reduce across. Negative index is used to specify axis from the + * end (e.g. -1 for the last axis). Must be in the range [-n, n). + * + * Outputs: + * * 0: An (n - 1)-D {@link ANEURALNETWORKS_TENSOR_INT32} tensor. + */ + ANEURALNETWORKS_ARGMAX_EX = 50015, + + /** + * Element-wise square root computation of the input tensor. + * + * The output is calculated using this formula: + * + * output = sqrt(input) + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D tensor, specifying the first input. + * + * Outputs: + * * 0: The output tensor, of the same {@link OperandCode} and shape as input0. + */ + ANEURALNETWORKS_SQRT_EX = 50016, + + /** + * Computes element-wise truth value by comparing the input tensors for non-equality. + * + * Takes two input tensors of identical {@link OperandCode} and compatible dimensions. + * The output is the result of comparison of two input tensors. + * + * Two dimensions are compatible when: + * 1. they are equal, or + * 2. one of them is 1 + * + * The size of the output is the maximum size along each dimension of the + * input operands. It starts with the trailing dimensions, and works its way + * forward. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D tensor, specifying the first input. + * * 1: A tensor of the same {@link OperandCode}, and compatible dimensions + * as input0. + * + * Outputs: + * * 0: A boolean tensor indicating the truth value of non-equality of input tensors + * Stored as {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} with offset 0 + * and scale 1.0f. + * A non-zero byte represents True, a hit. A zero indicates otherwise. + */ + ANEURALNETWORKS_NOT_EQUAL_EX = 50017, + + /** + * Computes element-wise truth value of the input tensor negation. + * + * Takes one input tensor. + * The output is the negation, which is logical complement, of the input tensor. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D boolean tensor, specifying the input. + * Stored as {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} with offset 0 + * and scale 1.0f. + * A non-zero byte represents True. A zero indicates otherwise. + * + * Outputs: + * * 0: A boolean tensor of the same size as input indicating the truth value of (NOT x) + * Stored as {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} with offset 0 + * and scale 1.0f. + * A non-zero byte represents True. A zero indicates otherwise. + */ + ANEURALNETWORKS_LOGICAL_NOT_EX = 50018, + + /** + * Computes element-wise truth value of two input tensors for LOGICAL AND. + * + * Takes two input tensors of identical {@link OperandCode} and compatible dimensions. + * The output is the result of comparison of two input tensors. + * + * Two dimensions are compatible when: + * 1. they are equal, or + * 2. one of them is 1 + * + * The size of the output is the maximum size along each dimension of the + * input operands. It starts with the trailing dimensions, and works its way + * forward. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D boolean tensor, specifying the first input. + * Stored as {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} with offset 0 + * and scale 1.0f. + * A non-zero byte represents True, a hit. A zero indicates otherwise. + * * 1: A tensor of the same {@link OperandCode}, and compatible dimensions + * as input0. + * + * Outputs: + * * 0: A boolean tensor indicating the truth value of two input tensors for LOGICAL AND. + * Stored as {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} with offset 0 + * and scale 1.0f. + * A non-zero byte represents True, a hit. A zero indicates otherwise. + */ + ANEURALNETWORKS_LOGICAL_AND_EX = 50019, + + /** + * Computes element-wise truth value of two input tensors for LOGICAL OR. + * + * Takes two input tensors of identical {@link OperandCode} and compatible dimensions. + * The output is the result of comparison of two input tensors. + * + * Two dimensions are compatible when: + * 1. they are equal, or + * 2. one of them is 1 + * + * The size of the output is the maximum size along each dimension of the + * input operands. It starts with the trailing dimensions, and works its way + * forward. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An n-D boolean tensor, specifying the first input. + * Stored as {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} with offset 0 + * and scale 1.0f. + * A non-zero byte represents True, a hit. A zero indicates otherwise. + * * 1: A tensor of the same {@link OperandCode}, and compatible dimensions + * as input0. + * + * Outputs: + * * 0: A boolean tensor indicating the truth value of two input tensors for LOGICAL OR. + * Stored as {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} with offset 0 + * and scale 1.0f. + * A non-zero byte represents True, a hit. A zero indicates otherwise. + */ + ANEURALNETWORKS_LOGICAL_OR_EX = 50020, + + /** + * Computes the minimum of elements across dimensions of a tensor. + * + * Reduces the input tensor along the given dimensions to reduce. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: A tensor, specifying the input. + * * 1: A 1-D Tensor of {@link ANEURALNETWORKS_TENSOR_INT32}. The dimensions + * to reduce. + * + * Outputs: + * * 0: A tensor of the same {@link OperandCode} as input0. + */ + ANEURALNETWORKS_REDUCE_MIN_EX = 50021, + + /** + * Parametric Rectified Linear Unit. + * + * It follows: f(x) = alpha * x for x < 0, f(x) = x for x >= 0, where alpha + * is a learned array with the same {@link OperandCode} and compatible + * dimensions as input x. + * + * Two dimensions are compatible when: + * 1. they are equal, or + * 2. one of them is 1 + * + * The size of the output is the maximum size along each dimension of the + * input operands. It starts with the trailing dimensions, and works its way + * forward. + * + * Example: + * input.dimension = {4, 1, 2} + * alpha.dimension = {5, 4, 3, 1} + * output.dimension = {5, 4, 3, 2} + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: A tensor, specifying the input. + * * 1: A tensor of the same {@link OperandCode}, and compatible dimensions + * as input0, specifying the alpha. + * + * Outputs: + * * 0: A tensor of the same {@link OperandCode} as input0. + */ + ANEURALNETWORKS_PRELU_EX = 50022, + + /** + * Returns a one-hot tensor. + * + * The locations represented by indices in indices take value on_value, while all other locations + * take value off_value. + * The on_value and off_value must have matching data types. They must be the same data type as + * specified by the data type of output. + * + * If the input indices is rank N, the output will have rank N+1. The new axis is created at + * dimension axis. + * If indices is a scalar the output shape will be a vector of length depth. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * + * Supported tensor rank: up to 4 + * + * Inputs: + * * 0: An {@link ANEURALNETWORKS_INT32} tensor, specifying the indices. + * * 1: An {@link ANEURALNETWORKS_INT32} scalar, specifying the depth. + * * 2: A scalar, specifying the on_value. + * * 3: A scalar, specifying the off_value. + * * 4: An {@link ANEURALNETWORKS_INT32} scalar, specifying the axis to fill. Optional. + * (default: -1, a new inner-most axis). + * + * Outputs: + * * 0: The one-hot tensor. + */ + ANEURALNETWORKS_ONE_HOT_EX = 50023, + + /** + * For input tensors x and y, computes x >= y elementwise. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: from 1 + * + * This operation supports broadcasting. + * + * Inputs: + * * 0: A tensor. + * * 1: A tensor of the same {@link OperandCode} and dimensions compatible + * with input0. + * + * Outputs: + * * 0: A boolean tensor of {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * with offset 0 and scale 1.0f. + */ + ANEURALNETWORKS_GREATER_EQUAL_EX = 50024, + + /** + * For input tensors x and y, computes x < y elementwise. + * + * Supported tensor {@link OperandCode}: + * * {@link ANEURALNETWORKS_TENSOR_FLOAT32} + * * {@link ANEURALNETWORKS_TENSOR_INT32} + * * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * + * Supported tensor rank: from 1 + * + * This operation supports broadcasting. + * + * Inputs: + * * 0: A tensor. + * * 1: A tensor of the same {@link OperandCode} and dimensions compatible + * with input0. + * + * Outputs: + * * 0: A tensor of {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} + * with offset 0 and scale 1.0f. + */ + ANEURALNETWORKS_LESS_EX = 50025, +} OperationCodeEx; // extends OperationCode + +typedef OperationCodeEx ANeuralNetworksOperationTypeEx; + +/** + * @brief Add an extended operation to a model. + * + * @param[in] model The model to be modified. + * @param[in] type The type of extended operation. + * @param[in] inputCount The number of entries in the inputs array. + * @param[in] inputs An array of indexes identifying each operand. + * @param[in] outputCount The number of entries in the outputs array. + * @param[in] outputs An array of indexes identifying each operand. + * + * @note The operands specified by inputs and outputs must have been + * previously added by calls to {@link ANeuralNetworksModel_addOperand}.\n + * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has been + * called will return an error.\n + * See {@link ANeuralNetworksModel} for information on multithreaded usage. + * + * @return ANEURALNETWORKS_NO_ERROR if successful. + */ +int ANeuralNetworksModel_addOperationEx(ANeuralNetworksModel *model, + ANeuralNetworksOperationTypeEx type, uint32_t inputCount, + const uint32_t *inputs, uint32_t outputCount, + const uint32_t *outputs); + +__END_DECLS + +#endif // NN_RUNTIME_NEURAL_NETWORKS_EX_H |