80 int32_t output_operand_index,
const void *parameters)
82 const DnnOperand *input = &operands[input_operand_indexes[0]];
83 DnnOperand *output = &operands[output_operand_index];
89 for (
int i = 0;
i < 4; ++
i)
107 for (
int i = 0;
i < dims_count; ++
i) {
108 dst[
i] = params->
v - src[
i];
111 for (
int i = 0;
i < dims_count; ++
i) {
112 dst[
i] = src[
i] - params->
v;
115 const DnnOperand *input1 = &operands[input_operand_indexes[1]];
117 for (
int i = 0;
i < dims_count; ++
i) {
118 dst[
i] = src[
i] - src1[
i];
124 for (
int i = 0;
i < dims_count; ++
i) {
125 dst[
i] = params->
v + src[
i];
128 const DnnOperand *input1 = &operands[input_operand_indexes[1]];
130 for (
int i = 0;
i < dims_count; ++
i) {
131 dst[
i] = src[
i] + src1[
i];
137 for (
int i = 0;
i < dims_count; ++
i) {
138 dst[
i] = params->
v * src[
i];
141 const DnnOperand *input1 = &operands[input_operand_indexes[1]];
143 for (
int i = 0;
i < dims_count; ++
i) {
144 dst[
i] = src[
i] * src1[
i];
150 for (
int i = 0;
i < dims_count; ++
i) {
151 dst[
i] = params->
v / src[
i];
154 for (
int i = 0;
i < dims_count; ++
i) {
155 dst[
i] = src[
i] / params->
v;
158 const DnnOperand *input1 = &operands[input_operand_indexes[1]];
160 for (
int i = 0;
i < dims_count; ++
i) {
161 dst[
i] = src[
i] / src1[
i];
167 for (
int i = 0;
i < dims_count; ++
i) {
171 const DnnOperand *input1 = &operands[input_operand_indexes[1]];
173 for (
int i = 0;
i < dims_count; ++
i) {
174 dst[
i] =
FFMIN(src[
i], src1[i]);
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
DNN inference functions interface for native backend.
int32_t calculate_operand_dims_count(const DnnOperand *oprd)
int32_t input_operand_indexes[4]
a layer can have multiple inputs and one output.
DNN inference functions interface for native backend.
int dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num)
int dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_operand_indexes, int32_t output_operand_index, const void *parameters)
DNNDataType data_type
support different kinds of data type such as float, half float, int8 etc, first support float now...
#define i(width, name, range_min, range_max)
unsigned int avio_rl32(AVIOContext *s)
void * data
data pointer with data length in bytes.
simple assert() macros that are a bit more flexible than ISO C assert().
int32_t dims[4]
there are two memory layouts, NHWC or NCHW, so we use dims, dims[0] is Number.
DNNMathBinaryOperation bin_op
int32_t calculate_operand_data_length(const DnnOperand *oprd)
int32_t output_operand_index