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

Time:12-23

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!

CodePudding user response:

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

CodePudding user response:

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!!! :)

  • Related