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

Function ggml_opt_acc_grad

ggml.c:18233–18242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18231}
18232
18233static void ggml_opt_acc_grad(int np, struct ggml_tensor * const ps[], float * g, float scale) {
18234 int64_t i = 0;
18235 for (int p = 0; p < np; ++p) {
18236 const int64_t ne = ggml_nelements(ps[p]) ;
18237 // TODO: add function to get all elements at once
18238 for (int64_t j = 0; j < ne; ++j) {
18239 g[i++] += ggml_get_f32_1d(ps[p]->grad, j) * scale;
18240 }
18241 }
18242}
18243
18244//
18245// ADAM

Callers 3

ggml_opt_adamFunction · 0.85
linesearch_backtrackingFunction · 0.85
ggml_opt_lbfgsFunction · 0.85

Calls 2

ggml_nelementsFunction · 0.70
ggml_get_f32_1dFunction · 0.70

Tested by

no test coverage detected