Conceptual
Login

Cross-Entropy Gradient With Respect to Logits Equals p Minus y

For \( L = -\sum_i y_i \log p_i \) with \( p = \mathrm{softmax}(z) \) and one-hot \( y \), the chain rule through \( \mathrm{diag}(p) - pp^T \) gives \( \partial L/\partial z = p - y \).

This Concept is waiting for its first lesson!

Are you a teacher? Sign in to start contributing.

Sign In