There is an Activation layer in Keras.
Seems this code:
model.add(Convolution2D(64, 3, 3))
model.add(Activation('relu'))
and this one:
model.add(Convolution2D(64, 3, 3, activation='relu'))
produces the same result.
What is the purpose of this additional Activation layer?
[Upgr: 2017-04-10] Is there a difference in performance with above two scenarios?
keras. activations. elu function to ensure a slope larger than one for positive inputs. The values of alpha and scale are chosen so that the mean and variance of the inputs are preserved between two consecutive layers as long as the weights are initialized correctly (see tf.
Relu activation function in keras and why is it used The Rectified Linear Unit is the most commonly used activation function in deep learning models. The function returns 0 if it receives any negative input, but for any positive value x it returns that value back.
Default: hyperbolic tangent ( tanh ). If you pass None , no activation is applied (ie. "linear" activation: a(x) = x ).
ReLU (Rectified Linear Unit) Activation Function The ReLU is the most used activation function in the world right now. Since, it is used in almost all the convolutional neural networks or deep learning.
As you may see, both approaches are equivalent. I will show you a few scenarios in which having this layer might help:
Activation
it's impossible.softmax
as final activation - but in the end - you want to have so called logits
- inverse softmax
function. Without additional Activation
layer that could be difficult.Activation
it wouldn't be possible.As you may see - lack of Activation
would make output of a layer before activation and final activation strongly coupled. That's why Activation
might be pretty useful - as it breaks this ties.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With