tfmot.sparsity.keras.ConstantSparsity
Stay organized with collections
Save and categorize content based on your preferences.
Pruning schedule with constant sparsity(%) throughout training.
Inherits From: PruningSchedule
tfmot.sparsity.keras.ConstantSparsity(
target_sparsity, begin_step, end_step=-1, frequency=100
)
Used in the notebooks
Args |
target_sparsity
|
A scalar float representing the target sparsity value.
|
begin_step
|
Step at which to begin pruning.
|
end_step
|
Step at which to end pruning. -1 by default. -1 implies
continuing to prune till the end of training.
|
frequency
|
Only apply pruning every frequency steps.
|
Methods
from_config
View source
@classmethod
from_config(
config
)
Instantiates a PruningSchedule
from its config.
Args |
config
|
Output of get_config() .
|
Returns |
A PruningSchedule instance.
|
get_config
View source
get_config()
__call__
View source
__call__(
step
)
Returns the sparsity(%) to be applied.
If the returned sparsity(%) is 0, pruning is ignored for the step.
Args |
step
|
Current step in graph execution.
|
Returns |
Sparsity (%) that should be applied to the weights for the step.
|
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.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "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."],[],[]]