ggml_graph_get_grad: Get the Gradient Tensor of a Node

View source: R/graph.R

ggml_graph_get_gradR Documentation

Get the Gradient Tensor of a Node

Description

Returns the tensor holding d(output)/d(node) after ggml_build_backward_expand has added the backward pass and the graph has been computed.

Usage

ggml_graph_get_grad(graph, node)

ggml_graph_get_grad_acc(graph, node)

Arguments

graph

Graph carrying a backward pass

node

Tensor whose gradient is wanted

Details

Returns NULL when the node has no gradient in this graph – because it was never marked with ggml_set_param, or because nothing differentiable connects it to the output.

Value

The gradient tensor, or NULL

For ggml_graph_get_grad_acc(), the gradient accumulator tensor, or NULL

See Also

ggml_build_backward_expand


ggmlR documentation built on Oct. 23, 2026, 1:07 a.m.