ggml_cross_entropy_loss: Cross-Entropy Loss (Graph)

View source: R/operations.R

ggml_cross_entropy_lossR Documentation

Cross-Entropy Loss (Graph)

Description

Creates a graph node computing the cross-entropy loss between logits a and labels b. The op applies its own softmax, so a must be logits, not probabilities.

Usage

ggml_cross_entropy_loss(ctx, a, b)

Arguments

ctx

GGML context

a

Logits

b

Labels, same shape as a

Details

Differentiable: the backward pass is wired into the graph, so this can be used as a training loss in a hand-built graph.

Value

A scalar tensor holding the loss

See Also

ggml_cross_entropy_loss_back


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