TikTok interview question

Write self-attention and cross-entropy pseudocode