the derivation collapses to a memorizable final form
pi−yi: the two-case signs cancel and the
logpj in CE exactly cancels the softmax denominator, turning an
O(C2) Jacobian computation into an
O(C) vector subtraction — exactly how PyTorch/TensorFlow implement the Softmax+CE gradient layer.