ggml_new_tensor: Create Tensor with Arbitrary Dimensions

View source: R/tensors.R

ggml_new_tensorR Documentation

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)

Arguments

ctx

GGML context

type

Data type (GGML_TYPE_F32, etc.)

n_dims

Number of dimensions (1-4)

ne

Numeric vector of dimension sizes

Value

Tensor pointer

Examples


ctx <- ggml_init(1024 * 1024)
t <- ggml_new_tensor(ctx, GGML_TYPE_F32, 3, c(10, 20, 30))
ggml_nelements(t)
ggml_free(ctx)


ggmlR documentation built on July 14, 2026, 1:08 a.m.