tf.contrib.model_pruning.get_pruning_hparams
Stay organized with collections
Save and categorize content based on your preferences.
Get a tf.HParams object with the default values for the hyperparameters.
tf.contrib.model_pruning.get_pruning_hparams()
name: string
name of the pruning specification. Used for adding summaries and ops under
a common tensorflow name_scope
begin_pruning_step: integer
the global step at which to begin pruning
end_pruning_step: integer
the global step at which to terminate pruning. Defaults to -1 implying
that pruning continues till the training stops
weight_sparsity_map: list of strings
comma separed list of {weight_variable_name:target sparsity} or
{regex:target sparsity} pairs.
For layers/weights not in this list, sparsity as specified by the
target_sparsity hyperparameter is used.
Eg. [conv1:0.9,conv2/kernel:0.8]
block_dims_map: list of strings
comma separated list of {weight variable name:block_height x block_width}
or {regex:block_height x block_width} pairs. For layers/weights not in
this list, block dims are specified by the block_height, block_width
hyperparameters are used Eg. [dense1:4x4,dense2:1x16,dense3:1x1]
threshold_decay: float
the decay factor to use for exponential decay of the thresholds
pruning_frequency: integer
How often should the masks be updated? (in # of global_steps)
nbins: integer
number of bins to use for histogram computation
block_height: integer
number of rows in a block (defaults to 1), can be -1 in which
case it is set to the size of the corresponding weight tensor.
block_width: integer
number of cols in a block (defaults to 1), can be -1 in which
case it is set to the size of the corresponding weight tensor.
block_pooling_function: string
Whether to perform average (AVG) or max (MAX) pooling in the block
(default: AVG)
initial_sparsity: float
initial sparsity value
target_sparsity: float
target sparsity value
sparsity_function_begin_step: integer
the global step at this which the gradual sparsity function begins to
take effect
sparsity_function_end_step: integer
the global step used as the end point for the gradual sparsity function
sparsity_function_exponent: float
exponent = 1 is linearly varying sparsity between initial and final.
exponent > 1 varies more slowly towards the end than the beginning
use_tpu: False
Indicates whether to use TPU
We use the following sparsity function:
num_steps = (sparsity_function_end_step -
sparsity_function_begin_step)/pruning_frequency
sparsity(step) = (initial_sparsity - target_sparsity)*
[1-step/(num_steps -1)]**exponent + target_sparsity
Returns |
tf.HParams object initialized to default values
|
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 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.model_pruning.get_pruning_hparams\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/model_pruning/python/pruning.py#L146-L229) |\n\nGet a tf.HParams object with the default values for the hyperparameters. \n\n tf.contrib.model_pruning.get_pruning_hparams()\n\nname: string\nname of the pruning specification. Used for adding summaries and ops under\na common tensorflow name_scope\nbegin_pruning_step: integer\nthe global step at which to begin pruning\nend_pruning_step: integer\nthe global step at which to terminate pruning. Defaults to -1 implying\nthat pruning continues till the training stops\nweight_sparsity_map: list of strings\ncomma separed list of {weight_variable_name:target sparsity} or\n{regex:target sparsity} pairs.\nFor layers/weights not in this list, sparsity as specified by the\ntarget_sparsity hyperparameter is used.\nEg. \\[conv1:0.9,conv2/kernel:0.8\\]\nblock_dims_map: list of strings\ncomma separated list of {weight variable name:block_height x block_width}\nor {regex:block_height x block_width} pairs. For layers/weights not in\nthis list, block dims are specified by the block_height, block_width\nhyperparameters are used Eg. \\[dense1:4x4,dense2:1x16,dense3:1x1\\]\nthreshold_decay: float\nthe decay factor to use for exponential decay of the thresholds\npruning_frequency: integer\nHow often should the masks be updated? (in # of global_steps)\nnbins: integer\nnumber of bins to use for histogram computation\nblock_height: integer\nnumber of rows in a block (defaults to 1), can be -1 in which\ncase it is set to the size of the corresponding weight tensor.\nblock_width: integer\nnumber of cols in a block (defaults to 1), can be -1 in which\ncase it is set to the size of the corresponding weight tensor.\nblock_pooling_function: string\nWhether to perform average (AVG) or max (MAX) pooling in the block\n(default: AVG)\ninitial_sparsity: float\ninitial sparsity value\ntarget_sparsity: float\ntarget sparsity value\nsparsity_function_begin_step: integer\nthe global step at this which the gradual sparsity function begins to\ntake effect\nsparsity_function_end_step: integer\nthe global step used as the end point for the gradual sparsity function\nsparsity_function_exponent: float\nexponent = 1 is linearly varying sparsity between initial and final.\nexponent \\\u003e 1 varies more slowly towards the end than the beginning\nuse_tpu: False\nIndicates whether to use TPU\n\nWe use the following sparsity function:\n\nnum_steps = (sparsity_function_end_step -\nsparsity_function_begin_step)/pruning_frequency\nsparsity(step) = (initial_sparsity - target_sparsity)\\*\n\\[1-step/(num_steps -1)\\]\\*\\*exponent + target_sparsity\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---|---|\n| None ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| tf.HParams object initialized to default values ||\n\n\u003cbr /\u003e"]]