Learn R Programming

ggmlR (version 0.6.1)

ggml_graph_node: Get Graph Node

Description

Gets a specific node (tensor) from the computation graph by index

Usage

ggml_graph_node(graph, i)

Value

Tensor pointer

Arguments

graph

Graph object

i

Node index (0-based, negative indices count from end)

Examples

Run this code
# \donttest{
ctx <- ggml_init(16 * 1024 * 1024)
a <- ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 10)
b <- ggml_add(ctx, a, a)
graph <- ggml_build_forward_expand(ctx, b)
# Get the last node (output)
output <- ggml_graph_node(graph, -1)
ggml_free(ctx)
# }

Run the code above in your browser using DataLab