Keras objects cannot be saved like other R objects.
The auxiliary functions to_savable() and
to_callable() address this issue.
to_savable(gnn)
to_callable(gnn)GNN object.
to_savable():The GNN object with keras components replaced by savable ones.
to_callable():The GNN object with certain components replaced by keras objects.
For GMMNs, to_savable() calls serialize_model()
and to_callable() calls unserialize_model().
For VAEs, to_savable() is (indirectly) based on
save_model_weights_hdf5() and to_callable()
on load_model_weights_hdf5(); one cannot work
with serialize_model() or
unserialize_model() in this case because of the
involved layer_lambda().
See the source code for more details.