<p>If you do not specify an activation for a layer you are effectively creating a linear transformation through that layer.  From the documentation:</p>
<blockquote>
<p><strong>activation:</strong> Activation function to use. If you don't specify anything, no activation is applied (see keras.activations).</p>
</blockquote>

CC BY-SA 4.0
2021-01-16T22:12:07.047Z
2021-01-16T22:12:07.047Z
David Hoelzer
<p>What if I don't apply an activation function on some layers in a neural network. How will it affect the model?</p>
<p>Take for instance the following code snippet:</p>
<pre><code>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
</code></pre>

<machine-learning><deep-learning><convolutional-neural-networks><keras><activation-functions>
What happens if there is no activation function in some layers of a neural network?
Akhilesh Sharma
# What happens if there is no activation function in some layers of a neural network?

(Asked by: username_0 on 2021-01-16)

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

**Tags:** machine-learning, deep-learning, convolutional-neural-networks, keras, activation-functions


---

## 1 answers

### Answer by username_1 on 2021-01-16. Score: 2

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).


---

