add ggml_opt_resume_g which accepts forward and backward cgraphs

This commit is contained in:
xaedes 2023-06-01 19:41:28 +02:00
parent 83a34444af
commit 0e269665cd
No known key found for this signature in database
GPG key ID: 30030EDD817EA2B1
2 changed files with 19 additions and 0 deletions

11
ggml.c
View file

@ -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) {

8
ggml.h
View file

@ -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
//