← All questions
MediumProduct
Modify this PyTorch pseudo-code to perform negative sampling if the pos_ids are known: label #shape=[batch_s, pos_ids] hidden #shape=[batch_s, ch] logits #shape=[ch, C] out=np.dot(logits, hidden(X)) #shape=[batch_s, C] loss=cross_entropy(out, label)
Asked at
SAP
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
Reference answer
Free to read · better with Enzo
Practice this out loud with Enzo
Enzo runs it as a mock interview, pushes back with follow-ups, and grades you on the rubric.
Next question