I'm interested in how to implement InfoNCE in your code using torch.nn.CrossEntropyLoss() function, but I don't seem to have found good learning material, can you explain to me why InfoNCE can be implemented in this way in the provided code?
In addition, I would like to ask, how should this part of the code be understood?
# head + relation -> tail
loss = self. Criterion(logits, labels)
# tail -> head + relation
loss += self. Criterion(logits[:, :batch_size].t(), labels)
How to understand "tail -> head + relation"?
I would appreciate your help! Looking forward to your reply!
I'm interested in how to implement InfoNCE in your code using torch.nn.CrossEntropyLoss() function, but I don't seem to have found good learning material, can you explain to me why InfoNCE can be implemented in this way in the provided code?
In addition, I would like to ask, how should this part of the code be understood?
How to understand "tail -> head + relation"?
I would appreciate your help! Looking forward to your reply!