| 8237 | // ggml_compute_forward_mean |
| 8238 | |
| 8239 | static void ggml_compute_forward_mean_f32( |
| 8240 | const struct ggml_compute_params * params, |
| 8241 | const struct ggml_tensor * src0, |
| 8242 | struct ggml_tensor * dst) { |
| 8243 | assert(params->ith == 0); |
| 8244 | |
| 8245 | if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) { |
| 8246 | return; |
| 8247 | } |
| 8248 | |
| 8249 | assert(src0->nb[0] == sizeof(float)); |
| 8250 | |
| 8251 | GGML_TENSOR_UNARY_OP_LOCALS |
| 8252 | |
| 8253 | assert(ne0 == 1); |
| 8254 | assert(ne1 == ne01); |
| 8255 | assert(ne2 == ne02); |
| 8256 | assert(ne3 == ne03); |
| 8257 | |
| 8258 | UNUSED(ne0); |
| 8259 | UNUSED(ne1); |
| 8260 | UNUSED(ne2); |
| 8261 | UNUSED(ne3); |
| 8262 | |
| 8263 | for (int64_t i03 = 0; i03 < ne03; i03++) { |
| 8264 | for (int64_t i02 = 0; i02 < ne02; i02++) { |
| 8265 | for (int64_t i01 = 0; i01 < ne01; i01++) { |
| 8266 | ggml_vec_sum_f32(ne00, |
| 8267 | (float *) ((char *) dst->data + i01*nb1 + i02*nb2 + i03*nb3), |
| 8268 | (float *) ((char *) src0->data + i01*nb01 + i02*nb02 + i03*nb03)); |
| 8269 | |
| 8270 | *(float *) ((char *) dst->data + i01*nb1 + i02*nb2 + i03*nb3) /= (float) ne00; |
| 8271 | } |
| 8272 | } |
| 8273 | } |
| 8274 | } |
| 8275 | |
| 8276 | static void ggml_compute_forward_mean( |
| 8277 | const struct ggml_compute_params * params, |
no test coverage detected