Custom objects set using custom_object_scope() are not added to the
global list of custom objects, and will not appear in the returned
list.
get_custom_objects()set_custom_objects(objects = named_list(), clear = TRUE)
An R named list mapping registered names to registered objects.
set_custom_objects() returns the registry values before updating, invisibly.
A named list of custom objects, as returned by
get_custom_objects() and set_custom_objects().
bool, whether to clear the custom object registry before
populating it with objects.
get_custom_objects()
You can use set_custom_objects() to restore a previous registry state.
# within a function, if you want to temporarily modify the registry,
function() {
orig_objects <- set_custom_objects(clear = TRUE)
on.exit(set_custom_objects(orig_objects)) ## temporarily modify the global registry
# register_keras_serializable(....)
# .... <do work>
# on.exit(), the previous registry state is restored.
}
Other serialization utilities:
deserialize_keras_object()
get_registered_name()
get_registered_object()
register_keras_serializable()
serialize_keras_object()
with_custom_object_scope()