| ggml_with_temp_ctx | R Documentation |
Creates a temporary context, executes code, and frees it automatically. Useful when you need to create large temporary tensors.
ggml_with_temp_ctx(mem_size, expr)
mem_size |
Context memory size in bytes |
expr |
Expression to evaluate with the temporary context |
Result of the expression
# Create tensors in temporary context
result <- ggml_with_temp_ctx(1024 * 1024, {
a <- ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 10)
ggml_set_f32(a, 1:10)
ggml_get_f32(a)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.