0

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
  • 52,940
  • 19
  • 125
  • 157
0xN1nja
  • 775
  • 4
  • 12

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
  • 3,728
  • 3
  • 8
  • 27