| 19065 | } |
| 19066 | |
| 19067 | enum ggml_opt_result ggml_opt_resume_g( |
| 19068 | struct ggml_context * ctx, |
| 19069 | struct ggml_opt_context * opt, |
| 19070 | struct ggml_tensor * f, |
| 19071 | struct ggml_cgraph * gf, |
| 19072 | struct ggml_cgraph * gb, |
| 19073 | ggml_opt_callback callback, |
| 19074 | void * callback_data) { |
| 19075 | |
| 19076 | // build forward + backward compute graphs |
| 19077 | enum ggml_opt_result result = GGML_OPT_OK; |
| 19078 | |
| 19079 | switch (opt->params.type) { |
| 19080 | case GGML_OPT_ADAM: |
| 19081 | { |
| 19082 | result = ggml_opt_adam(ctx, opt, opt->params, f, gf, gb, callback, callback_data); |
| 19083 | } break; |
| 19084 | case GGML_OPT_LBFGS: |
| 19085 | { |
| 19086 | result = ggml_opt_lbfgs(ctx, opt, opt->params, f, gf, gb, callback, callback_data); |
| 19087 | } break; |
| 19088 | } |
| 19089 | |
| 19090 | if (opt->params.print_forward_graph) { |
| 19091 | ggml_graph_print (gf); |
| 19092 | ggml_graph_dump_dot(gf, NULL, "opt-forward.dot"); |
| 19093 | } |
| 19094 | |
| 19095 | if (opt->params.print_backward_graph) { |
| 19096 | ggml_graph_print (gb); |
| 19097 | ggml_graph_dump_dot(gb, gf, "opt-backward.dot"); |
| 19098 | } |
| 19099 | |
| 19100 | return result; |
| 19101 | } |
| 19102 | |
| 19103 | //////////////////////////////////////////////////////////////////////////////// |
| 19104 |
no test coverage detected