Created
May 19, 2019 12:22
-
-
Save Tony607/a1c4936ce3de60f13a153c083ee378db to your computer and use it in GitHub Desktop.
How to compress your Keras model x5 smaller with TensorFlow model optimization | DLology
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tensorflow.keras.models import load_model | |
model = load_model(final_model) | |
import numpy as np | |
for i, w in enumerate(model.get_weights()): | |
print( | |
"{} -- Total:{}, Zeros: {:.2f}%".format( | |
model.weights[i].name, w.size, np.sum(w == 0) / w.size * 100 | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment