Learn R Programming

ggmlR (version 0.6.1)

ggml_new_tensor: Create Tensor with Arbitrary Dimensions

Description

Generic tensor constructor for creating tensors with 1-4 dimensions. This is more flexible than the ggml_new_tensor_Nd functions.

Usage

ggml_new_tensor(ctx, type = GGML_TYPE_F32, n_dims, ne)

Value

Tensor pointer

Arguments

ctx

GGML context

type

Data type (GGML_TYPE_F32, etc.)

n_dims

Number of dimensions (1-4)

ne

Numeric vector of dimension sizes

Examples

Run this code
# \donttest{
ctx <- ggml_init(1024 * 1024)
t <- ggml_new_tensor(ctx, GGML_TYPE_F32, 3, c(10, 20, 30))
ggml_nelements(t)
ggml_free(ctx)
# }

Run the code above in your browser using DataLab