Loss function kernels (cross-entropy, etc.) More...
Go to the source code of this file.
Functions | |
| void | softmax_cross_entropy_loss (const float *logits, const int32_t *targets, int tokens, int vocab_size, float *d_logits, float *loss_out) |
Loss function kernels (cross-entropy, etc.)
After changes: make test && make llamacpp-parity-full
Cross-entropy: L = -log(softmax(logits)[target])
Definition in file loss_kernels.c.
| void softmax_cross_entropy_loss | ( | const float * | logits, |
| const int32_t * | targets, | ||
| int | tokens, | ||
| int | vocab_size, | ||
| float * | d_logits, | ||
| float * | loss_out | ||
| ) |
Definition at line 21 of file loss_kernels.c.
References vocab_size.
Referenced by softmax_cross_entropy_loss_bf16().