Search code examples
machine-learningneural-networkkeraskeras-layerkeras-2

What does util.generic_utils.deserialize_keras_object() function in keras do


In Keras library, activattion.get() calls activattion.deserialize() function which in turn calls util.generic_utils.deserialize_keras_object() function. Can someone explain what happens in deserialize_keras_object() function


Solution

  • As one may read here deserialize_keras_object is responsible for creation of a keras object from:

    • configuration dictionary - if one is available,
    • name identifier if a provided one was available.

    To understand second point image the following definition:

    model.add(Activation("sigmoid"))
    

    What you provide to Activation constructor is a string, not a keras object. In order to make this work - deserialize_keras_object looks up defined names and check if an object called sigmoid is defined and instantiates it.