MCPcopy Create free account
hub / github.com/OAID/Tengine / GetOutResult

Function GetOutResult

executor/operator/ref/kernel/softmax/ref_softmax_kernel.h:62–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62static void GetOutResult(float* input, float* output, float* array, float* sum_array, int in_size, int on_size)
63{
64 float* input_ptr = ( float* )input;
65 float* output_ptr = ( float* )output;
66 float* array_ptr = ( float* )array;
67 float* sum_array_ptr = ( float* )sum_array;
68
69 memset(sum_array, 0x0, in_size * sizeof(float));
70
71 /* get the exp and the summary */
72
73 for(int j = 0; j < on_size; j++)
74 {
75
76 for(int l = 0; l < in_size; l++)
77 {
78 int index = j * in_size + l;
79 output_ptr[index] = exp(input_ptr[index] - array_ptr[l]);
80 sum_array_ptr[l] += output_ptr[index];
81
82 }
83 }
84
85 /* the final result */
86 for(int j = 0; j < on_size; j++)
87 {
88 for(int l = 0; l < in_size; l++)
89 {
90 int index = j * in_size + l;
91 output_ptr[index] /= sum_array_ptr[l];
92 }
93 }
94}
95
96typedef int (*ref_softmax_kernel_t)(void* input, void* output, void* max_array, void* sum_array, op_data* op_param);
97

Callers 7

ref_softmax_kernel_fp32Function · 0.70
ref_softmax_kernel_int8Function · 0.70
ref_softmax_kernel_uint8Function · 0.70
ref_softmax_kernel_fp16Function · 0.70
softmax_kernelMethod · 0.50
RunMethod · 0.50
RunMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected