MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / cross_entropy_ref

Function cross_entropy_ref

reference.py:58–60  ·  view source on GitHub ↗

Standard cross entropy loss.

(logits: torch.Tensor, targets: torch.Tensor)

Source from the content-addressed store, hash-verified

56
57# Cross Entropy Loss
58def cross_entropy_ref(logits: torch.Tensor, targets: torch.Tensor) -> torch.Tensor:
59 """Standard cross entropy loss."""
60 return F.cross_entropy(logits.view(-1, logits.size(-1)), targets.view(-1))
61
62# Rotary Position Embedding
63def rotary_embedding_ref(x: torch.Tensor, cos: torch.Tensor, sin: torch.Tensor) -> torch.Tensor:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected