get_custom_objects {keras3} | R Documentation |
Get/set the currently registered custom objects.
Description
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.
Usage
get_custom_objects()
set_custom_objects(objects = named_list(), clear = TRUE)
Arguments
objects |
A named list of custom objects, as returned by
|
clear |
bool, whether to clear the custom object registry before
populating it with |
Value
An R named list mapping registered names to registered objects.
set_custom_objects()
returns the registry values before updating, invisibly.
Examples
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. }
Note
register_keras_serializable()
is preferred over set_custom_objects()
for
registering new objects.
See Also
Other serialization utilities:
deserialize_keras_object()
get_registered_name()
get_registered_object()
register_keras_serializable()
serialize_keras_object()
with_custom_object_scope()