Browse Source

!230 Rectify the api-description of mindarmour/privacy/sup_privacy

From: @jxlang910
Reviewed-by: @pkuliuliu,@liu_luobin,@pkuliuliu
Signed-off-by: @pkuliuliu,@pkuliuliu
tags/v1.3.0
mindspore-ci-bot Gitee 4 years ago
parent
commit
edc0943df6
2 changed files with 14 additions and 14 deletions
  1. +11
    -11
      mindarmour/privacy/sup_privacy/sup_ctrl/conctrl.py
  2. +3
    -3
      mindarmour/privacy/sup_privacy/train/model.py

+ 11
- 11
mindarmour/privacy/sup_privacy/sup_ctrl/conctrl.py View File

@@ -58,10 +58,10 @@ class SuppressPrivacyFactory:

Examples:
>>> networks_l5 = LeNet5()
>>> masklayers = []
>>> masklayers.append(MaskLayerDes("conv1.weight", 0, False, True, 10))
>>> mask_layers = []
>>> mask_layers.append(MaskLayerDes("conv1.weight", 0, False, True, 10))
>>> suppress_ctrl_instance = SuppressPrivacyFactory().create(networks=networks_l5,
>>> mask_layers=masklayers,
>>> mask_layers=mask_layers,
>>> policy="local_train",
>>> end_epoch=10,
>>> batch_num=(int)(10000/cfg.batch_size),
@@ -735,14 +735,14 @@ class MaskLayerDes:
grad layers (print in PYNATIVE_MODE).
is_add_noise (bool): If True, the weight of this layer can add noise.
If False, the weight of this layer can not add noise.
If parameter num is greater than 100000, is_add_noise has not effect.
is_lower_clip (bool): If true, the weights of this layer would be clipped to greater than an lower bound value.
If parameter num is greater than 100000, is_add_noise has no effect.
is_lower_clip (bool): If True, the weights of this layer would be clipped to greater than an lower bound value.
If False, the weights of this layer won't be clipped.
If parameter num is greater than 100000, is_lower_clip has not effect.
If parameter num is greater than 100000, is_lower_clip has no effect.
min_num (int): The number of weights left that not be suppressed.
If min_num is smaller than (parameter num*SupperssCtrl.sparse_end), min_num has not effect.
upper_bound (Union[float, int]): max abs value of weight in this layer, default: 1.20.
If parameter num is greater than 100000, upper_bound has not effect.
If min_num is smaller than (parameter num*SupperssCtrl.sparse_end), min_num has no effect.
upper_bound (Union[float, int]): Max abs value of weight in this layer, default: 1.20.
If parameter num is greater than 100000, upper_bound has no effect.
"""
def __init__(self, layer_name, grad_idx, is_add_noise, is_lower_clip, min_num, upper_bound=1.20):
self.layer_name = check_param_type('layer_name', layer_name, str)
@@ -762,10 +762,10 @@ class GradMaskInCell(Cell):
array (numpy.ndarray): The mask array.
is_add_noise (bool): If True, the weight of this layer can add noise.
If False, the weight of this layer can not add noise.
is_lower_clip (bool): If true, the weights of this layer would be clipped to greater than an lower bound value.
is_lower_clip (bool): If True, the weights of this layer would be clipped to greater than an lower bound value.
If False, the weights of this layer won't be clipped.
min_num (int): The number of weights left that not be suppressed.
If min_num is smaller than (parameter num*SupperssCtrl.sparse_end), min_num has not effect.
If min_num is smaller than (parameter num*SupperssCtrl.sparse_end), min_num has no effect.
upper_bound ([float, int]): max abs value of weight in this layer, default: 1.20.
"""
def __init__(self, array, is_add_noise, is_lower_clip, min_num, upper_bound=1.20):


+ 3
- 3
mindarmour/privacy/sup_privacy/train/model.py View File

@@ -67,10 +67,10 @@ class SuppressModel(Model):

Examples:
>>> networks_l5 = LeNet5()
>>> masklayers = []
>>> masklayers.append(MaskLayerDes("conv1.weight", 0, False, True, 10))
>>> mask_layers = []
>>> mask_layers.append(MaskLayerDes("conv1.weight", 0, False, True, 10))
>>> suppress_ctrl_instance = SuppressPrivacyFactory().create(networks=networks_l5,
>>> mask_layers=masklayers,
>>> mask_layers=mask_layers,
>>> policy="local_train",
>>> end_epoch=10,
>>> batch_num=(int)(10000/cfg.batch_size),


Loading…
Cancel
Save