get_config: Layer/Model configuration

View source: R/layer-methods.R

get_configR Documentation

Layer/Model configuration


A layer config is an object returned from get_config() that contains the configuration of a layer or model. The same layer or model can be reinstantiated later (without its trained weights) from this configuration using from_config(). The config does not include connectivity information, nor the class name (those are handled externally).



from_config(config, custom_objects = NULL)



Layer or model object


Object with layer or model configuration


list of custom objects needed to instantiate the layer, e.g., custom layers defined by new_layer_class() or similar.


get_config() returns an object with the configuration, from_config() returns a re-instantiation of the object.


Objects returned from get_config() are not serializable. Therefore, if you want to save and restore a model across sessions, you can use the model_to_json() function (for model configuration only, not weights) or the save_model_tf() function to save the model configuration and weights to the filesystem.

See Also

Other model functions:,, evaluate_generator(),, fit_generator(), get_layer(), keras_model(), keras_model_sequential(), multi_gpu_model(), pop_layer(),, predict_generator(), predict_on_batch(), predict_proba(),, train_on_batch()

Other layer methods: count_params(), get_input_at(), get_weights(), reset_states()

keras documentation built on May 29, 2024, 3:20 a.m.