Learn R Programming

ggmlR (version 0.6.1)

ggml_input: 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")

Value

A ggml_tensor_node object.

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).

Examples

Run this code
# \donttest{
x <- ggml_input(shape = 64L)
x <- ggml_input(shape = c(28L, 28L, 1L), name = "image")
x <- ggml_input(shape = 10L, dtype = "int32")  # token indices
# }

Run the code above in your browser using DataLab