ggml_cast_numeric: Numeric Type Conversion

View source: R/operations.R

ggml_cast_numericR Documentation

Numeric Type Conversion

Description

Converts values numerically (truncating or rounding) rather than reinterpreting the bits as ggml_cast does. Supports F32<->I32, F32<->I16, F32<->I8, F16<->F32 and BF16<->F32.

Usage

ggml_cast_numeric(ctx, a, type)

Arguments

ctx

GGML context

a

Source tensor

type

Target type constant (e.g. GGML_TYPE_I32)

Value

Tensor of the requested type with a's shape

See Also

ggml_cast

Examples


ctx <- ggml_init(16 * 1024 * 1024)
a <- ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 10)
i <- ggml_cast_numeric(ctx, a, GGML_TYPE_I32)
ggml_free(ctx)


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