Oglądaj prezentacje, sesje produktowe, warsztaty i nie tylko z playlisty Google I / O See


Provides a scope in which Pruned layers and models can be deserialized.

Used in the notebooks

Used in the guide

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.

Object of type CustomObjectScope with pruning objects included.


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)