MCPcopy Create free account
hub / github.com/conflow-dev/ConFlow / ecall_reducemax_zero

Function ecall_reducemax_zero

sgx_tf_ops/Enclave/Enclave.cpp:5236–5264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5234}
5235
5236void ecall_reducemax_zero(float *input,int N,int M,int C,int L,float *output){
5237 float *x = (float*)malloc(sizeof(float)*N);
5238 memset(x, 0, sizeof(float)*N);
5239 for(int j=0;j<N;j++){
5240 x[j] = 0.0f;
5241 float sum = input[insert*N+j];
5242 float c = 0.0f;
5243 for(int i=0;i<Nt;i++){
5244 float y = input[indexs[i]*N+j] - c;
5245 float t = sum + y;
5246 c = (t - sum) - y;
5247 sum = t;
5248 }
5249 x[j] = sum;
5250
5251 }
5252
5253 for (int i = 0; i < C; i++) {
5254 for (int j = 0; j < L; j++) {
5255 float max_val = x[i*L+j];
5256 for (int k = 1; k < M; k++) {
5257 max_val = fmaxf(max_val, x[i*L+j+k*C*L]);
5258 }
5259 output[i*L+j] = max_val;
5260 }
5261 }
5262 free(x);
5263 return;
5264 }
5265
5266void ecall_reducemax_zero_grad(float *input,float *grad,int N,int M,int C,int L,float *output){
5267 float *x = (float*)malloc(sizeof(float)*N);

Callers 1

reducemax_zeroFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected