Q:

serialize keras model

# Save the modelmodel.save('path_to_my_model.h5')# Recreate the exact same model purely from the filenew_model = keras.models.load_model('path_to_my_model.h5')
1
import numpy as np# Check that the state is preservednew_predictions = new_model.predict(x_test)np.testing.assert_allclose(predictions, new_predictions, rtol=1e-6, atol=1e-6)# Note that the optimizer state is preserved as well:# you can resume training where you left off.
-2

New to Communities?

Join the community