ggml_set_loss: Mark a Tensor as the Loss

View source: R/operations.R

ggml_set_lossR Documentation

Mark a Tensor as the Loss

Description

Marks a tensor as the quantity to differentiate. ggml_build_backward_expand requires the graph to contain one – together with at least one ggml_set_param tensor, these are the two ends of the backward pass.

Usage

ggml_set_loss(tensor)

Arguments

tensor

Tensor pointer, usually a scalar produced by ggml_sum or a loss op

Details

A graph missing either is rejected with an error rather than aborting inside ggml.

Value

The tensor (for chaining)

See Also

ggml_set_param, ggml_build_forward_expand_grads


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