diff --git a/ggml.c b/ggml.c index bde5f9698..b16cd07a9 100644 --- a/ggml.c +++ b/ggml.c @@ -17457,6 +17457,17 @@ enum ggml_opt_result ggml_opt_resume( *gf = ggml_build_forward (f); *gb = ggml_build_backward(ctx, gf, true); + return ggml_opt_resume_g(ctx, opt, f, gf, gb); +} + +enum ggml_opt_result ggml_opt_resume_g( + struct ggml_context * ctx, + struct ggml_opt_context * opt, + struct ggml_tensor * f, + struct ggml_cgraph * gf, + struct ggml_cgraph * gb) { + + // build forward + backward compute graphs enum ggml_opt_result result = GGML_OPT_OK; switch (opt->params.type) { diff --git a/ggml.h b/ggml.h index a9750d89d..1e85b2fb1 100644 --- a/ggml.h +++ b/ggml.h @@ -1208,6 +1208,14 @@ extern "C" { struct ggml_opt_context * opt, struct ggml_tensor * f); + // continue optimizing the function defined by the tensor f + GGML_API enum ggml_opt_result ggml_opt_resume_g( + struct ggml_context * ctx, + struct ggml_opt_context * opt, + struct ggml_tensor * f, + struct ggml_cgraph * gf, + struct ggml_cgraph * gb); + // // quantization //