tf.keras.activations.get

TensorFlow 1 version View source on GitHub

Returns function.

tf.keras.activations.get(identifier)

Arguments:

  • identifier: Function or string

Returns:

Activation function denoted by input:

  • Linear activation function if input is None.
  • Function corresponding to the input string or input function.

For example:

tf.keras.activations.get('softmax') 
 <function softmax at 0x1222a3d90> 
tf.keras.activations.get(tf.keras.activations.softmax) 
 <function softmax at 0x1222a3d90> 
tf.keras.activations.get(None) 
 <function linear at 0x1239596a8> 
tf.keras.activations.get(abs) 
 <built-in function abs> 
tf.keras.activations.get('abcd') 
Traceback (most recent call last): 
 
ValueError: Unknown activation function:abcd 

Raises:

  • ValueError: Input is an unknown function or string, i.e., the input does not denote any defined function.

Compat aliases