| ggml_cast | R Documentation |
Returns a tensor with the same shape as a but of the given type.
Unlike ggml_cpy there is no need to allocate the destination
tensor first. Some ggml operations require a specific type – for example
ggml_conv_1d builds its im2col in F16 and so needs an F16
kernel – and this is the direct way to supply one.
ggml_cast(ctx, a, type)
ctx |
GGML context |
a |
Source tensor |
type |
Target type constant (e.g. |
Tensor of the requested type with a's shape
ggml_cast_numeric, ggml_cpy
ctx <- ggml_init(16 * 1024 * 1024)
a <- ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 100)
a16 <- ggml_cast(ctx, a, GGML_TYPE_F16)
ggml_free(ctx)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.