Skip to content

Why setting label to 0 for all data in gen_data_set_youtube()? #1

Answered by bbruceyuan
Wp-Zhang asked this question in Q&A
Discussion options

You must be logged in to vote

hi, it is a good question and I think about this question a long time too.

English Version:
As we all know, there is no sampled_softmax_loss like tf. Then I use CrossEntropyLoss instead of sampled_softmax_loss through constructing sample label [1, 0, 0, 0, 0], and set postivate sample displayed in first position, all 0 is sampled negative sample.

Additionally, in CrossEntropyLoss, Target shape is (N), so label should be 0 (the index of this positive sample).

my code can see: PLBaseModel.py _step function. https://github.com/bbruceyuan/DeepMatch-Torch/blob/322589cbe7f6d4efb1c4094bd6fb62f599f62c29/deepmatch_torch/models/PLBaseModel.py

If you have a better pytorch version sampled_softmax_loss

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bbruceyuan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants