TensorFlow tf.keras.activations.serialize

serialize method of TensorFlow tf.keras.activations module returns the string identifier of an activation function.

Syntax

  
tf.keras.activations.serialize(
  activation
)
     

Parameters

activation: (Required) Function object.

Returns

tf.keras.activations.serialize() returns String denoting the name attribute of the input function.

Errors

ValueError: raises ValueError if provided function object is not valid activation function.

Examples

Getting string identifier of sigmoid function using serialize method
   
import tensorflow as tf

sigmoid_identifier = tf.keras.activations.serialize(tf.keras.activations.sigmoid)

print(sigmoid_identifier)
      
     
Output
   
sigmoid

     
Getting string identifier of linear function using serialize method
   
import tensorflow as tf

linear_identifier = tf.keras.activations.serialize(tf.keras.activations.linear)

print(linear_identifier)
      
     
Output
   
linear

     


Category: TensorFlow