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

cross_entropy_loss

Cross-entropy loss calculation.

cross_entropy_loss

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

Signature

rust
pub fn cross_entropy_loss(logits: &Tensor, targets: &Tensor) -> Result<Tensor, OpError>

Overview

Cross-entropy loss calculation.

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_loss
let _res = darkforest_core::ops::cross_entropy_loss();

Related Components