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

Function ggml_sum_rows

ggml.c:3617–3638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3615// ggml_sum_rows
3616
3617struct ggml_tensor * ggml_sum_rows(
3618 struct ggml_context * ctx,
3619 struct ggml_tensor * a) {
3620 bool is_node = false;
3621
3622 if (a->grad) {
3623 is_node = true;
3624 }
3625
3626 int64_t ne[4] = {1,1,1,1};
3627 for (int i=1; i<a->n_dims; ++i) {
3628 ne[i] = a->ne[i];
3629 }
3630
3631 struct ggml_tensor * result = ggml_new_tensor(ctx, a->type, a->n_dims, ne);
3632
3633 result->op = GGML_OP_SUM_ROWS;
3634 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
3635 result->src[0] = a;
3636
3637 return result;
3638}
3639
3640// ggml_mean
3641

Callers 2

mainFunction · 0.50
cross_entropy_lossFunction · 0.50

Calls 2

ggml_new_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by 1

mainFunction · 0.40