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

请问为什么要代码中加入了sigmoid? #45

Open
lovan114514 opened this issue Jun 30, 2023 · 1 comment
Open

请问为什么要代码中加入了sigmoid? #45

lovan114514 opened this issue Jun 30, 2023 · 1 comment

Comments

@lovan114514
Copy link

在net.py和resnet.py中,请问forward函数的最后为什么要加入x = torch.sigmoid(x) ?,这里之后return x应该和标签值求损失函数然后反向传播,sigmoid之后相当于归一化,明显与标签值不匹配吧

@xiazhi1
Copy link

xiazhi1 commented Mar 5, 2024

在net.py和resnet.py中,请问forward函数的最后为什么要加入x = torch.sigmoid(x) ?,这里之后return x应该和标签值求损失函数然后反向传播,sigmoid之后相当于归一化,明显与标签值不匹配吧

这是为了将网络的输出约束到0-1范围内 softmax函数才是归一化

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