ggml_input: Declare a Functional API Input Tensor

View source: R/nn_functional.R

ggml_inputR Documentation

Declare a Functional API Input Tensor

Description

Creates a symbolic input node for the Functional API. The node records only the shape of one sample (without batch dimension); actual memory is allocated when ggml_compile() is called.

Usage

ggml_input(shape, name = NULL, dtype = "float32")

Arguments

shape

Integer vector describing the shape of a single sample. For flat feature vectors use a scalar, e.g. shape = 64L. For 2-D inputs (sequences) use c(length, channels). For 3-D inputs (images) use c(H, W, C).

name

Optional character name for the input tensor.

dtype

Data type of the input: "float32" (default) or "int32" (for embedding/token-index inputs).

Value

A ggml_tensor_node object.

Examples


x <- ggml_input(shape = 64L)
x <- ggml_input(shape = c(28L, 28L, 1L), name = "image")
x <- ggml_input(shape = 10L, dtype = "int32")  # token indices


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