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

loss计算错误 #74

Open
Yzichen opened this issue Dec 12, 2019 · 1 comment
Open

loss计算错误 #74

Yzichen opened this issue Dec 12, 2019 · 1 comment

Comments

@Yzichen
Copy link

Yzichen commented Dec 12, 2019

bug描述
3.7 3.9中计算交叉熵损失函数时使用tf.nn.CrossEntropyLoss()时,已经作了平均。
但是计算每一个epoch的损失时,又除了整个训练集样本的个数n ,这样对吗?

版本信息
pytorch:1.13
torchvision:0.4.2
torchtext:无
...

@ShusenTang
Copy link
Owner

你说得对,应该除以batch数,因为tf.nn.CrossEntropyLoss()时已经沿batch维作了平均。

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

2 participants