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

Function ggml_sum

ggml.c:3597–3613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3595// ggml_sum
3596
3597struct ggml_tensor * ggml_sum(
3598 struct ggml_context * ctx,
3599 struct ggml_tensor * a) {
3600 bool is_node = false;
3601
3602 if (a->grad) {
3603 is_node = true;
3604 }
3605
3606 struct ggml_tensor * result = ggml_new_tensor_1d(ctx, a->type, 1);
3607
3608 result->op = GGML_OP_SUM;
3609 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
3610 result->src[0] = a;
3611
3612 return result;
3613}
3614
3615// ggml_sum_rows
3616

Callers 6

ggml_compute_backwardFunction · 0.70
sum_gpu_indexFunction · 0.70
mainFunction · 0.50
mainFunction · 0.50
square_error_lossFunction · 0.50
cross_entropy_lossFunction · 0.50

Calls 2

ggml_new_tensor_1dFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by 2

mainFunction · 0.40
mainFunction · 0.40