tfmot.sparsity.keras.prune_scope
Stay organized with collections
Save and categorize content based on your preferences.
Provides a scope in which Pruned layers and models can be deserialized.
tfmot.sparsity.keras.prune_scope()
Used in the notebooks
For TF 2.X: this is not needed for SavedModel or TF checkpoints, which are
the recommended serialization formats.
For TF 1.X: if a tf.keras h5 model or layer has been pruned, it needs to be
within this
scope to be successfully deserialized. This is not needed for loading just
keras weights.
Returns |
Object of type CustomObjectScope with pruning objects included.
|
Example:
pruned_model = prune_low_magnitude(model, **self.params)
keras.models.save_model(pruned_model, keras_file)
with prune_scope():
loaded_model = keras.models.load_model(keras_file)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-05-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-05-26 UTC."],[],[]]