From c15833c8d6fc6ad3a7239dc2febafca551e61f8a Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Fri, 7 Jul 2023 19:13:26 +0300 Subject: [PATCH] ggml : remove comments from source file and match order in header --- ggml.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/ggml.c b/ggml.c index 69b38dc70..828368e67 100644 --- a/ggml.c +++ b/ggml.c @@ -16070,7 +16070,6 @@ static thread_ret_t ggml_graph_compute_thread(void * data) { return 0; } -// Prepare for graph computing. struct ggml_cplan ggml_graph_plan(struct ggml_cgraph * cgraph, int n_threads) { if (n_threads <= 0) { n_threads = GGML_DEFAULT_N_THREADS; @@ -16488,8 +16487,16 @@ void ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cplan * cplan) } } -// same as ggml_graph_compute() but the work data is allocated as a part of the context -// note: the drawback of this API is that you must have ensured that the context has enough memory for the work data +void ggml_graph_reset(struct ggml_cgraph * cgraph) { + for (int i = 0; i < cgraph->n_nodes; i++) { + struct ggml_tensor * grad = cgraph->grads[i]; + + if (grad) { + ggml_set_zero(grad); + } + } +} + void ggml_graph_compute_with_ctx(struct ggml_context * ctx, struct ggml_cgraph * cgraph, int n_threads) { struct ggml_cplan cplan = ggml_graph_plan(cgraph, n_threads); @@ -16501,16 +16508,6 @@ void ggml_graph_compute_with_ctx(struct ggml_context * ctx, struct ggml_cgraph * ggml_graph_compute(cgraph, &cplan); } -void ggml_graph_reset(struct ggml_cgraph * cgraph) { - for (int i = 0; i < cgraph->n_nodes; i++) { - struct ggml_tensor * grad = cgraph->grads[i]; - - if (grad) { - ggml_set_zero(grad); - } - } -} - struct ggml_tensor * ggml_graph_get_tensor(struct ggml_cgraph * cgraph, const char * name) { for (int i = 0; i < cgraph->n_leafs; i++) { struct ggml_tensor * leaf = cgraph->leafs[i];