Learn R Programming

ggmlR (version 0.8.4)

ggml_cast_numeric: 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)

Value

Tensor of the requested type with a's shape

Arguments

ctx

GGML context

a

Source tensor

type

Target type constant (e.g. GGML_TYPE_I32)

See Also

ggml_cast

Examples

Run this code
# \donttest{
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)
# }

Run the code above in your browser using DataLab