-1

What is the difference between activation layer and activation kwarg?

for instance :

activation kwarg :

model.add(tf.keras.layers.Dense(10,activation="relu"))

Activation layer :

model=Sequential([
    tf.keras.layers.Dense(10),
    tf.keras.layers.Activation("relu")
])
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Abhimanyu Sharma
  • 858
  • 1
  • 9
  • 17

1 Answers1

2

From the docs:

Activations can either be used through an Activation layer, or through the activation argument supported by all forward layers

This quote is then followed by a specific example, which states that the following are equivalent:

model.add(layers.Dense(64, activation=activations.relu)) # or 'relu'

and

model.add(layers.Dense(64))
model.add(layers.Activation(activations.relu))

as you would expect.

Kraigolas
  • 5,121
  • 3
  • 12
  • 37