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

Function ggml_opt

ggml.c:19018–19050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19016}
19017
19018enum ggml_opt_result ggml_opt(
19019 struct ggml_context * ctx,
19020 struct ggml_opt_params params,
19021 struct ggml_tensor * f) {
19022 bool free_ctx = false;
19023 if (ctx == NULL) {
19024 struct ggml_init_params params_ctx = {
19025 .mem_size = 16*1024*1024,
19026 .mem_buffer = NULL,
19027 .no_alloc = false,
19028 };
19029
19030 ctx = ggml_init(params_ctx);
19031 if (ctx == NULL) {
19032 return GGML_OPT_NO_CONTEXT;
19033 }
19034
19035 free_ctx = true;
19036 }
19037
19038 enum ggml_opt_result result = GGML_OPT_OK;
19039
19040 struct ggml_opt_context * opt = (struct ggml_opt_context *) alloca(sizeof(struct ggml_opt_context));
19041
19042 ggml_opt_init(ctx, opt, params, 0);
19043 result = ggml_opt_resume(ctx, opt, f);
19044
19045 if (free_ctx) {
19046 ggml_free(ctx);
19047 }
19048
19049 return result;
19050}
19051
19052enum ggml_opt_result ggml_opt_resume(
19053 struct ggml_context * ctx,

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 4

ggml_opt_resumeFunction · 0.85
ggml_initFunction · 0.70
ggml_opt_initFunction · 0.70
ggml_freeFunction · 0.70

Tested by 1

mainFunction · 0.68