powered by
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)
Result of the expression
Context memory size in bytes
Expression to evaluate with the temporary context
# \donttest{ # 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) }) # }
Run the code above in your browser using DataLab