tfmot.sparsity.keras.PrunableLayer
Stay organized with collections
Save and categorize content based on your preferences.
Abstract Base Class for making your own keras layer prunable.
Used in the notebooks
Custom keras layers which want to add pruning should implement this class.
Methods
get_prunable_weights
View source
@abc.abstractmethod
get_prunable_weights()
Returns list of prunable weight tensors.
All the weight tensors which the layer wants to be pruned during
training must be returned by this method.
Returns: List of weight tensors/kernels in the keras layer which must be
pruned during training.
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.
[null,null,["Last updated 2023-05-26 UTC."],[],[],null,["# tfmot.sparsity.keras.PrunableLayer\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/model-optimization/blob/v0.7.5/tensorflow_model_optimization/python/core/sparsity/keras/prunable_layer.py#L21-L39) |\n\nAbstract Base Class for making your own keras layer prunable.\n\n### Used in the notebooks\n\n| Used in the guide |\n|------------------------------------------------------------------------------------------------------------------|\n| - [Pruning comprehensive guide](https://www.tensorflow.org/model_optimization/guide/pruning/comprehensive_guide) |\n\nCustom keras layers which want to add pruning should implement this class.\n\nMethods\n-------\n\n### `get_prunable_weights`\n\n[View source](https://github.com/tensorflow/model-optimization/blob/v0.7.5/tensorflow_model_optimization/python/core/sparsity/keras/prunable_layer.py#L29-L39) \n\n @abc.abstractmethod\n get_prunable_weights()\n\nReturns list of prunable weight tensors.\n\nAll the weight tensors which the layer wants to be pruned during\ntraining must be returned by this method.\n\nReturns: List of weight tensors/kernels in the keras layer which must be\npruned during training."]]