IMPORTANT: when creating "opt" tensors, always save and load the scratch buffer this is an error prone process, but it is necessary to support inplace operators when using scratch buffers TODO: implement a better way
| 2361 | // operators when using scratch buffers |
| 2362 | // TODO: implement a better way |
| 2363 | static void ggml_scratch_save(struct ggml_context * ctx) { |
| 2364 | // this is needed to allow opt tensors to store their data |
| 2365 | // TODO: again, need to find a better way |
| 2366 | ctx->no_alloc_save = ctx->no_alloc; |
| 2367 | ctx->no_alloc = false; |
| 2368 | |
| 2369 | ctx->scratch_save = ctx->scratch; |
| 2370 | ctx->scratch.data = NULL; |
| 2371 | } |
| 2372 | |
| 2373 | static void ggml_scratch_load(struct ggml_context * ctx) { |
| 2374 | ctx->no_alloc = ctx->no_alloc_save; |
no outgoing calls
no test coverage detected