1
$\begingroup$

What if I don't apply an activation function on some layers in a neural network. How will it affect the model?

Take for instance the following code snippet:

def model(x):
    a = Conv2D(64, (3, 3))(x)                         
    x = Conv2D(64, (3, 3), activation = 'relu')(x)
    b = Conv2D(128, (3, 3))(x)
    x = Conv2D(128, (3, 3), activation = 'relu')(b)
    return x, a, b
$\endgroup$
1
$\begingroup$

If you do not specify an activation for a layer you are effectively creating a linear transformation through that layer. From the documentation:

activation: Activation function to use. If you don't specify anything, no activation is applied (see keras.activations).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.