PandA-2024.02
06_softmax_a.cc
Go to the documentation of this file.
1 #include "tvm/runtime/c_runtime_api.h"
2 #include "tvm/runtime/c_backend_api.h"
3 extern void* __tvm_module_ctx = NULL;
4 #ifdef __cplusplus
5 extern "C"
6 #endif
7 TVM_DLL int32_t fused_nn_softmax( void* args, void* arg_type_ids, int32_t num_args) {
8 
9  void* arg0 = (((TVMValue*)args)[0].v_handle);
10  float* placeholder = (float*)(((TVMArray*)arg0)[0].data);
11 
12  void* arg1 = (((TVMValue*)args)[1].v_handle);
13  float* tensor = (float*)(((TVMArray*)arg1)[0].data);
14 
15  float tensor1[1];
16  float tensor2[8];
17  float tensor3[1];
18  tensor1[0] = -3.402823e+38f;
19 
20  for (int32_t k1 = 0; k1 < 8; ++k1) {
21  float _1 = tensor1[0];
22  float _2 = placeholder[k1];
23  tensor1[0] = ((_1) > (_2) ? (_1) : (_2));
24  }
25 
26  for (int32_t ax1 = 0; ax1 < 8; ++ax1) {
27  tensor2[ax1] = expf((placeholder[ax1] - tensor1[0]));
28  }
29 
30  tensor3[0] = 0.000000e+00f;
31  for (int32_t k2 = 0; k2 < 8; ++k2) {
32  tensor3[0] = (tensor3[0] + tensor2[k2]);
33  }
34 
35  for (int32_t ax11 = 0; ax11 < 8; ++ax11) {
36  tensor[ax11] = (tensor2[ax11] / tensor3[0]);
37  }
38  return 0;
39 }
40 
#define NULL
void * __tvm_module_ctx
Union type of values being passed through API and function calls.
TVM_DLL int32_t fused_nn_softmax(void *args, void *arg_type_ids, int32_t num_args)
Definition: 06_softmax_a.cc:7
#define TVM_DLL
Definition: c_runtime_api.h:59
Plain C Tensor object, does not manage memory.
Definition: dlpack.h:111

Generated on Mon Feb 12 2024 13:02:50 for PandA-2024.02 by doxygen 1.8.13