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

Used in the notebooks

Used in the guide

If a keras model or layer has been clustered, it needs to be within this scope to be successfully deserialized.

Object of type CustomObjectScope with clustering objects included.


clustered_model = cluster_weights(model, **self.params)
tf.keras.models.save_model(clustered_model, keras_file)

with cluster_scope():
  loaded_model = tf.keras.models.load_model(keras_file)