程序代写代做代考 python Keras ## Usage of activations

## 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))
model.add(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`.