Skip to main content
Behavioral

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)

Top community answer

No community answers yet.

Contribute an answer

Have a better answer?

Share your experience and earn credits toward your next interview session.

Contribute an answer