Implement next-token cross-entropy for a batch of logits/targets in numpy with padding mas

Pretraining Objectives and Scaling Laws1 / 4

Chapter 051 / 4

Pretraining Objectives and Scaling Laws

Implement next-token cross-entropy for a batch of logits/targets in numpy with padding mas

Easy

Implement next-token cross-entropy for a batch of logits/targets in numpy with padding masking.

Target interface
next_token_ce(logits, targets, mask=None)

Complete the starter code in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.