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

Function ggml_mean

ggml.c:3642–3660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3640// ggml_mean
3641
3642struct ggml_tensor * ggml_mean(
3643 struct ggml_context * ctx,
3644 struct ggml_tensor * a) {
3645 bool is_node = false;
3646
3647 if (a->grad) {
3648 GGML_ASSERT(false); // TODO: implement
3649 is_node = true;
3650 }
3651
3652 int64_t ne[GGML_MAX_DIMS] = { 1, a->ne[1], a->ne[2], a->ne[3] };
3653 struct ggml_tensor * result = ggml_new_tensor(ctx, GGML_TYPE_F32, a->n_dims, ne);
3654
3655 result->op = GGML_OP_MEAN;
3656 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
3657 result->src[0] = a;
3658
3659 return result;
3660}
3661
3662// ggml_argmax
3663

Callers 2

ggml_compute_backwardFunction · 0.70
mainFunction · 0.50

Calls 2

ggml_new_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by 1

mainFunction · 0.40