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

3.9节的net中是否要加入softmax #182

Open
Riqzz opened this issue Dec 11, 2021 · 1 comment
Open

3.9节的net中是否要加入softmax #182

Riqzz opened this issue Dec 11, 2021 · 1 comment

Comments

@Riqzz
Copy link

Riqzz commented Dec 11, 2021

这里在return时不需要softmax吗?

def net(X):
    X = X.view((-1, num_inputs))
    H = relu(torch.matmul(X, W1) + b1)
    return torch.matmul(H, W2) + b2
@qizihaoliuliuliu
Copy link

哈哈,兄弟你稍微往下看一点,在3.9.5中介绍了,在pytorch损失函数自带的torch.nn.CrossEntropyLoss()交叉熵损失函数中已经带了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