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 #211

Open
learnxy opened this issue Jun 18, 2020 · 1 comment
Open

第四章 多层感知机代码sigmoid #211

learnxy opened this issue Jun 18, 2020 · 1 comment

Comments

@learnxy
Copy link

learnxy commented Jun 18, 2020

这一块代码不是应该先layer2后sigmoid然后结果作为返回,为什么是先sigmoid后layer2层是返回结果,是误写么?

@timmmGZ
Copy link

timmmGZ commented Mar 2, 2021

这一块代码不是应该先layer2后sigmoid然后结果作为返回,为什么是先sigmoid后layer2层是返回结果,是误写么?

确实写错了,可能作者笔误,问题不大,但是你的也不是正确的,正确写法是:

    def forward(self,x):
        x = self.layer1(x)
        x = t.sigmoid(x)
        x=self.layer2(x)
        return t.激活函数(x)

鉴于作者代码里out_features是1维,那激活函数就肯定不是softmax了,随便选个sigmoid relu...都随你

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