| ggml_backend_sched_reserve | R Documentation |
Pre-allocates memory based on a measurement graph. This should be called before using the scheduler to compute graphs.
ggml_backend_sched_reserve(sched, graph)
sched |
Scheduler pointer |
graph |
Graph pointer to measure memory requirements |
Logical indicating success
cpu <- ggml_backend_cpu_init()
sched <- ggml_backend_sched_new(list(cpu))
ctx <- ggml_init(16 * 1024 * 1024)
a <- ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 1000)
b <- ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 1000)
c <- ggml_add(ctx, a, b)
graph <- ggml_build_forward_expand(ctx, c)
ggml_backend_sched_reserve(sched, graph)
ggml_backend_sched_free(sched)
ggml_backend_free(cpu)
ggml_free(ctx)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.