mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-25 02:44:36 +00:00
ggml : fix bug in ggml_compute_forward_sum_f32 (#1162)
The sum over all rows is now computed instead of just the last row
This commit is contained in:
parent
8a0f8673ba
commit
54bb60e268
7
ggml.c
7
ggml.c
@ -6779,15 +6779,20 @@ static void ggml_compute_forward_sum_f32(
|
||||
const size_t nb02 = src0->nb[2];
|
||||
const size_t nb03 = src0->nb[3];
|
||||
|
||||
ggml_float sum = 0;
|
||||
float row_sum = 0;
|
||||
|
||||
for (int64_t i03 = 0; i03 < ne03; i03++) {
|
||||
for (int64_t i02 = 0; i02 < ne02; i02++) {
|
||||
for (int64_t i01 = 0; i01 < ne01; i01++) {
|
||||
ggml_vec_sum_f32(ne00,
|
||||
(float *) (dst->data),
|
||||
&row_sum,
|
||||
(float *) ((char *) src0->data + i01*nb01 + i02*nb02 + i03*nb03));
|
||||
sum += row_sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
((float *) dst->data)[0] = sum;
|
||||
}
|
||||
|
||||
static void ggml_compute_forward_sum(
|
||||
|
Loading…
Reference in New Issue
Block a user