ag_dtype: Set the default floating-point precision for ag_* GPU...

View source: R/ag_device.R

ag_dtypeR Documentation

Set the default floating-point precision for ag_* GPU operations

Description

Controls the dtype used when uploading tensors to the ggml backend. "bf16" halves memory usage vs "f32" with minimal accuracy loss. Gradients are never computed in f16: the GPU graph backward runs in f32 only, so with "f16" or "bf16" backward() takes the closure path, which computes them in double – correct, but slower (the reason is counted by ggmlR:::ag_backward_fallbacks()). Training in f32 keeps the graph path.

Usage

ag_dtype(dtype)

Arguments

dtype

"f32" (default), "f16", or "bf16"

Value

Invisibly the previous dtype string


ggmlR documentation built on Oct. 23, 2026, 1:07 a.m.