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

Function emb_ss_grad

sgx_tf_ops/Enclave/Enclave.cpp:153–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153void emb_ss_grad(float* grad,float* output,int M,int C,int num,int dim){
154 int N = M*num*dim;
155 float *x = (float*)malloc(sizeof(float)*N);
156 memset(x, 0, sizeof(float)*N);
157 for(int j=0;j<N;j++){
158 x[j] = 0.0f;
159 float sum = grad[insert*N+j];
160 float c = 0.0f;
161 for(int i=0;i<Nt;i++){
162 float y = grad[indexs[i]*N+j] - c;
163 float t = sum + y;
164 c = (t - sum) - y;
165 sum = t;
166 }
167 x[j] = sum;
168 }
169 for (int i = 0; i < M; i++) {
170 for (int j = 0; j < num; j++) {
171 output[i*C+j*(dim+1)+dim] = 0.0f;
172 for (int k = 0; k < dim; k++) {
173 output[i*C+j*(dim+1)+k] = x[i*num*dim+j*dim+k];
174 }
175 }
176 }
177 free(x);
178 return;
179}
180
181void ecall_encrypt(float *input, int N, float *output){
182 float mean = 0.0f, std, mean_sqr = 0.0f;

Callers 1

embedding_ss_gradFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected