1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
## Usage of activations
Activations can either be used through an `Activation` layer, or through the `activation` argument supported by all forward layers:
```python
from keras.layers import Activation, Dense
model.add(Dense(64))
model.add(Activation('tanh'))
```
This is equivalent to:
```python
model.add(Dense(64, activation='tanh'))
```
You can also pass an element-wise TensorFlow/Theano/CNTK function as an activation:
```python
from keras import backend as K
model.add(Dense(64, activation=K.tanh))
```
## Available activations
{{autogenerated}}
## On "Advanced Activations"
Activations that are more complex than a simple TensorFlow/Theano/CNTK function (eg. learnable activations, which maintain a state) are available as [Advanced Activation layers](layers/advanced-activations.md), and can be found in the module `keras.layers.advanced_activations`. These include `PReLU` and `LeakyReLU`.
|