| 8127 | } |
| 8128 | |
| 8129 | static void ggml_compute_forward_sum_i32( |
| 8130 | const struct ggml_compute_params * params, |
| 8131 | const struct ggml_tensor * src0, |
| 8132 | struct ggml_tensor * dst) { |
| 8133 | assert(params->ith == 0); |
| 8134 | assert(ggml_is_scalar(dst)); |
| 8135 | |
| 8136 | if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) { |
| 8137 | return; |
| 8138 | } |
| 8139 | |
| 8140 | assert(src0->nb[0] == sizeof(int32_t)); |
| 8141 | |
| 8142 | GGML_TENSOR_LOCALS(int64_t, ne0, src0, ne) |
| 8143 | GGML_TENSOR_LOCALS(size_t, nb0, src0, nb) |
| 8144 | |
| 8145 | int64_t sum = 0; |
| 8146 | int64_t row_sum = 0; |
| 8147 | |
| 8148 | for (int64_t i03 = 0; i03 < ne03; i03++) { |
| 8149 | for (int64_t i02 = 0; i02 < ne02; i02++) { |
| 8150 | for (int64_t i01 = 0; i01 < ne01; i01++) { |
| 8151 | ggml_vec_sum_i32_ggf(ne00, |
| 8152 | &row_sum, |
| 8153 | (int32_t *) ((char *) src0->data + i01 * nb01 + i02 * nb02 + i03 * nb03)); |
| 8154 | sum += row_sum; |
| 8155 | } |
| 8156 | } |
| 8157 | } |
| 8158 | ((int32_t *) dst->data)[0] = sum; |
| 8159 | } |
| 8160 | |
| 8161 | |
| 8162 | static void ggml_compute_forward_sum( |
no test coverage detected