MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / ggml_compute_forward_sum_rows_f32

Function ggml_compute_forward_sum_rows_f32

ggml.c:8188–8219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8186// ggml_compute_forward_sum_rows
8187
8188static void ggml_compute_forward_sum_rows_f32(
8189 const struct ggml_compute_params * params,
8190 const struct ggml_tensor * src0,
8191 struct ggml_tensor * dst) {
8192 GGML_ASSERT(params->ith == 0);
8193
8194 if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
8195 return;
8196 }
8197
8198 GGML_ASSERT(src0->nb[0] == sizeof(float));
8199 GGML_ASSERT(dst->nb[0] == sizeof(float));
8200
8201 GGML_TENSOR_UNARY_OP_LOCALS
8202
8203 GGML_ASSERT(ne0 == 1);
8204 GGML_ASSERT(ne1 == ne01);
8205 GGML_ASSERT(ne2 == ne02);
8206 GGML_ASSERT(ne3 == ne03);
8207
8208 for (int64_t i3 = 0; i3 < ne03; i3++) {
8209 for (int64_t i2 = 0; i2 < ne02; i2++) {
8210 for (int64_t i1 = 0; i1 < ne01; i1++) {
8211 float * src_row = (float *) ((char *) src0->data + i1*nb01 + i2*nb02 + i3*nb03);
8212 float * dst_row = (float *) ((char *) dst->data + i1*nb1 + i2*nb2 + i3*nb3);
8213 float row_sum = 0;
8214 ggml_vec_sum_f32(ne00, &row_sum, src_row);
8215 dst_row[0] = row_sum;
8216 }
8217 }
8218 }
8219}
8220
8221static void ggml_compute_forward_sum_rows(
8222 const struct ggml_compute_params * params,

Callers 1

Calls 1

ggml_vec_sum_f32Function · 0.70

Tested by

no test coverage detected