简体   繁体   中英

Is there a difference between Keras Dense layer and Pytorch's nn.linear layer?

I noticed the definition of Keras Dense layer says: Activation function to use. If you don't specify anything, no activation is applied (ie. "linear" activation: a(x) = x).

So if we have a code like:

model.add(Dense(10, activation = None))

Is it basically the same as:

nn.linear(128, 10)

?

Thank you so much!

Yes if there is no activation it's just a linear layer.

Yes, it is the same. model.add (Dense(10, activation = None)) or nn.linear(128, 10) is the same, because it is not activated in both, therefore if you don't specify anything, no activation is applied. It is so:!! :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM