70 int32_t output_operand_index,
const void *parameters)
72 const DnnOperand *input = &operands[input_operand_indexes[0]];
73 DnnOperand *output = &operands[output_operand_index];
79 for (
int i = 0;
i < 4; ++
i)
95 for (
int i = 0;
i < dims_count; ++
i) {
96 dst[
i] = params->
v - src[
i];
99 for (
int i = 0;
i < dims_count; ++
i) {
100 dst[
i] = src[
i] - params->
v;
103 const DnnOperand *input1 = &operands[input_operand_indexes[1]];
105 for (
int i = 0;
i < dims_count; ++
i) {
106 dst[
i] = src[
i] - src1[
i];
112 for (
int i = 0;
i < dims_count; ++
i) {
113 dst[
i] = params->
v + src[
i];
116 const DnnOperand *input1 = &operands[input_operand_indexes[1]];
118 for (
int i = 0;
i < dims_count; ++
i) {
119 dst[
i] = src[
i] + src1[
i];
125 for (
int i = 0;
i < dims_count; ++
i) {
126 dst[
i] = params->
v * src[
i];
129 const DnnOperand *input1 = &operands[input_operand_indexes[1]];
131 for (
int i = 0;
i < dims_count; ++
i) {
132 dst[
i] = src[
i] * src1[
i];
138 for (
int i = 0;
i < dims_count; ++
i) {
139 dst[
i] = params->
v / src[
i];
142 for (
int i = 0;
i < dims_count; ++
i) {
143 dst[
i] = src[
i] / params->
v;
146 const DnnOperand *input1 = &operands[input_operand_indexes[1]];
148 for (
int i = 0;
i < dims_count; ++
i) {
149 dst[
i] = src[
i] / src1[
i];
155 for (
int i = 0;
i < dims_count; ++
i) {
159 const DnnOperand *input1 = &operands[input_operand_indexes[1]];
161 for (
int i = 0;
i < dims_count; ++
i) {
162 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 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