Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrastive_training.py代码疑惑 #28

Open
HapuHXY opened this issue Aug 6, 2023 · 2 comments
Open

contrastive_training.py代码疑惑 #28

HapuHXY opened this issue Aug 6, 2023 · 2 comments

Comments

@HapuHXY
Copy link

HapuHXY commented Aug 6, 2023

作者您好,我对contrastive_training.py代码中info_nce_logits中存疑,本人是刚刚入门的菜鸟,如有冒犯还请见谅!
在函数info_nce_logits中,最后对labels的赋值为什么全部为0了呢?【labels = torch.zeros(logits.shape[0], dtype=torch.long).to(device)】
我理解是正样本对的标签为1,负样本对的标签为0,但是函数最后返回的labels全为0,这里是不是应该改一下呀,还是说我理解错了,这里的设计有别的含义?
请您多多指教~

@yifudangguan9
Copy link

您好,我看到了您之前问的关于info_nce_logits中labels的赋值全部为0的问题,我也没有搞清楚,不知道您现在是否有新的见解?盼望您的答复! # @HapuHXY

@FisherCats
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants