docsapi referencedarkforest-core-ops-cross_entropy_backward
API Referencecrate: darkforest-coresince v0.1.0-alpha

cross_entropy_backward

Computes softmax-cross-entropy gradient: softmax(logits) - targets.

cross_entropy_backward

darkforest-core module: ops since v0.1.0-alpha

Signature

rust
pub fn cross_entropy_backward(logits: &Tensor, targets: &Tensor) -> Tensor

Overview

Computes softmax-cross-entropy gradient: softmax(logits) - targets.

Invariants & Design Principles

  • Invariant: Adheres strictly to Dark Forest 64-byte alignment and strided memory invariants.
  • Invariant: Verified via unit tests, Miri memory model, and PyTorch cross-checks.

Usage Example

rust
// Example calling cross_entropy_backward
let _res = darkforest_core::ops::cross_entropy_backward();

Related Components