Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
57252dee
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
57252dee
编写于
7月 20, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
7月 20, 2020
浏览文件
操作
浏览文件
下载
差异文件
!3191 Fix doc error of optim API
Merge pull request !3191 from Simson/doc-fix
上级
fa7fa8a1
a1f78964
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
22 addition
and
24 deletion
+22
-24
mindspore/nn/optim/adam.py
mindspore/nn/optim/adam.py
+5
-5
mindspore/nn/optim/ftrl.py
mindspore/nn/optim/ftrl.py
+1
-1
mindspore/nn/optim/lamb.py
mindspore/nn/optim/lamb.py
+3
-3
mindspore/nn/optim/lazyadam.py
mindspore/nn/optim/lazyadam.py
+1
-1
mindspore/nn/optim/momentum.py
mindspore/nn/optim/momentum.py
+2
-2
mindspore/nn/optim/optimizer.py
mindspore/nn/optim/optimizer.py
+4
-5
mindspore/nn/optim/proximal_ada_grad.py
mindspore/nn/optim/proximal_ada_grad.py
+2
-2
mindspore/nn/optim/rmsprop.py
mindspore/nn/optim/rmsprop.py
+2
-2
mindspore/nn/optim/sgd.py
mindspore/nn/optim/sgd.py
+2
-3
未找到文件。
mindspore/nn/optim/adam.py
浏览文件 @
57252dee
...
@@ -41,7 +41,7 @@ def _update_run_op(beta1, beta2, eps, lr, weight_decay_tensor, param, m, v, grad
...
@@ -41,7 +41,7 @@ def _update_run_op(beta1, beta2, eps, lr, weight_decay_tensor, param, m, v, grad
beta2 (Tensor): The exponential decay rate for the 2nd moment estimates. Should be in range (0.0, 1.0).
beta2 (Tensor): The exponential decay rate for the 2nd moment estimates. Should be in range (0.0, 1.0).
eps (Tensor): Term added to the denominator to improve numerical stability. Should be greater than 0.
eps (Tensor): Term added to the denominator to improve numerical stability. Should be greater than 0.
lr (Tensor): Learning rate.
lr (Tensor): Learning rate.
weight_decay_tensor (Tensor): Weight decay. Should be
equal to or greater than 0
.
weight_decay_tensor (Tensor): Weight decay. Should be
in range [0.0, 1.0]
.
param (Tensor): Parameters.
param (Tensor): Parameters.
m (Tensor): m value of parameters.
m (Tensor): m value of parameters.
v (Tensor): v value of parameters.
v (Tensor): v value of parameters.
...
@@ -252,8 +252,8 @@ class Adam(Optimizer):
...
@@ -252,8 +252,8 @@ class Adam(Optimizer):
use_nesterov (bool): Whether to use Nesterov Accelerated Gradient (NAG) algorithm to update the gradients.
use_nesterov (bool): Whether to use Nesterov Accelerated Gradient (NAG) algorithm to update the gradients.
If True, updates the gradients using NAG.
If True, updates the gradients using NAG.
If False, updates the gradients without using NAG. Default: False.
If False, updates the gradients without using NAG. Default: False.
weight_decay (float): Weight decay (L2 penalty). It should be
equal to or greater than 0
. Default: 0.0.
weight_decay (float): Weight decay (L2 penalty). It should be
in range [0.0, 1.0]
. Default: 0.0.
loss_scale (float): A floating point value for the loss scale. Should be
greater than
0. Default: 1.0.
loss_scale (float): A floating point value for the loss scale. Should be
not less than 1.
0. Default: 1.0.
Inputs:
Inputs:
- **gradients** (tuple[Tensor]) - The gradients of `params`, the shape is the same as `params`.
- **gradients** (tuple[Tensor]) - The gradients of `params`, the shape is the same as `params`.
...
@@ -392,7 +392,7 @@ class AdamWeightDecay(Optimizer):
...
@@ -392,7 +392,7 @@ class AdamWeightDecay(Optimizer):
Should be in range (0.0, 1.0).
Should be in range (0.0, 1.0).
eps (float): Term added to the denominator to improve numerical stability. Default: 1e-6.
eps (float): Term added to the denominator to improve numerical stability. Default: 1e-6.
Should be greater than 0.
Should be greater than 0.
weight_decay (float): Weight decay (L2 penalty). It should be
equal to or greater than 0
. Default: 0.0.
weight_decay (float): Weight decay (L2 penalty). It should be
in range [0.0, 1.0]
. Default: 0.0.
decay_filter (Function): A function to determine whether to apply weight decay on parameters. Default:
decay_filter (Function): A function to determine whether to apply weight decay on parameters. Default:
lambda x: 'LayerNorm' not in x.name and 'bias' not in x.name.
lambda x: 'LayerNorm' not in x.name and 'bias' not in x.name.
...
@@ -457,7 +457,7 @@ class AdamWeightDecayDynamicLR(Optimizer):
...
@@ -457,7 +457,7 @@ class AdamWeightDecayDynamicLR(Optimizer):
Should be in range (0.0, 1.0).
Should be in range (0.0, 1.0).
eps (float): Term added to the denominator to improve numerical stability. Default: 1e-6.
eps (float): Term added to the denominator to improve numerical stability. Default: 1e-6.
Should be greater than 0.
Should be greater than 0.
weight_decay (float): Weight decay (L2 penalty). It should be
equal to or greater than 0
. Default: 0.0.
weight_decay (float): Weight decay (L2 penalty). It should be
in range [0.0, 1.0]
. Default: 0.0.
decay_filter (Function): A function to determine whether to apply weight decay on parameters. Default:
decay_filter (Function): A function to determine whether to apply weight decay on parameters. Default:
lambda x: 'LayerNorm' not in x.name and 'bias' not in x.name.
lambda x: 'LayerNorm' not in x.name and 'bias' not in x.name.
...
...
mindspore/nn/optim/ftrl.py
浏览文件 @
57252dee
...
@@ -128,7 +128,7 @@ class FTRL(Optimizer):
...
@@ -128,7 +128,7 @@ class FTRL(Optimizer):
l2 (float): l2 regularization strength, must be greater than or equal to zero. Default: 0.0.
l2 (float): l2 regularization strength, must be greater than or equal to zero. Default: 0.0.
use_locking (bool): If True use locks for update operation. Default: False.
use_locking (bool): If True use locks for update operation. Default: False.
loss_scale (float): Value for the loss scale. It should be equal to or greater than 1.0. Default: 1.0.
loss_scale (float): Value for the loss scale. It should be equal to or greater than 1.0. Default: 1.0.
wegith_decay (float): Weight decay value to multiply weight,
must be zero or positive value
. Default: 0.0.
wegith_decay (float): Weight decay value to multiply weight,
should be in range [0.0, 1.0]
. Default: 0.0.
Inputs:
Inputs:
- **grads** (tuple[Tensor]) - The gradients of `params` in optimizer, the shape is as same as the `params`
- **grads** (tuple[Tensor]) - The gradients of `params` in optimizer, the shape is as same as the `params`
...
...
mindspore/nn/optim/lamb.py
浏览文件 @
57252dee
...
@@ -44,7 +44,7 @@ def _update_run_op(beta1, beta2, eps, lr, weight_decay_tensor, global_step, para
...
@@ -44,7 +44,7 @@ def _update_run_op(beta1, beta2, eps, lr, weight_decay_tensor, global_step, para
beta2 (Tensor): The exponential decay rate for the 2nd moment estimates. Should be in range (0.0, 1.0).
beta2 (Tensor): The exponential decay rate for the 2nd moment estimates. Should be in range (0.0, 1.0).
eps (Tensor): Term added to the denominator to improve numerical stability. Should be greater than 0.
eps (Tensor): Term added to the denominator to improve numerical stability. Should be greater than 0.
lr (Tensor): Learning rate.
lr (Tensor): Learning rate.
weight_decay_tensor (Tensor): Weight decay. Should be
equal to or greater than 0
.
weight_decay_tensor (Tensor): Weight decay. Should be
in range [0.0, 1.0]
.
global_step (Tensor): Global step.
global_step (Tensor): Global step.
param (Tensor): Parameters.
param (Tensor): Parameters.
m (Tensor): m value of parameters.
m (Tensor): m value of parameters.
...
@@ -128,7 +128,7 @@ def _update_run_op_graph_kernel(beta1, beta2, eps, lr, weight_decay_tensor,
...
@@ -128,7 +128,7 @@ def _update_run_op_graph_kernel(beta1, beta2, eps, lr, weight_decay_tensor,
beta2 (Tensor): The exponential decay rate for the 2nd moment estimates. Should be in range (0.0, 1.0).
beta2 (Tensor): The exponential decay rate for the 2nd moment estimates. Should be in range (0.0, 1.0).
eps (Tensor): Term added to the denominator to improve numerical stability. Should be greater than 0.
eps (Tensor): Term added to the denominator to improve numerical stability. Should be greater than 0.
lr (Tensor): Learning rate.
lr (Tensor): Learning rate.
weight_decay_tensor (Tensor): Weight decay. Should be
equal to or greater than 0
.
weight_decay_tensor (Tensor): Weight decay. Should be
in range [0.0, 1.0]
.
global_step (Tensor): Global step.
global_step (Tensor): Global step.
param (Tensor): Parameters.
param (Tensor): Parameters.
m (Tensor): m value of parameters.
m (Tensor): m value of parameters.
...
@@ -229,7 +229,7 @@ class Lamb(Optimizer):
...
@@ -229,7 +229,7 @@ class Lamb(Optimizer):
Should be in range (0.0, 1.0).
Should be in range (0.0, 1.0).
eps (float): Term added to the denominator to improve numerical stability. Default: 1e-6.
eps (float): Term added to the denominator to improve numerical stability. Default: 1e-6.
Should be greater than 0.
Should be greater than 0.
weight_decay (float): Weight decay (L2 penalty). Default: 0.0. Should be
equal to or greater than 0
.
weight_decay (float): Weight decay (L2 penalty). Default: 0.0. Should be
in range [0.0, 1.0]
.
decay_filter (Function): A function to determine whether to apply weight decay on parameters. Default:
decay_filter (Function): A function to determine whether to apply weight decay on parameters. Default:
lambda x: 'LayerNorm' not in x.name and 'bias' not in x.name.
lambda x: 'LayerNorm' not in x.name and 'bias' not in x.name.
...
...
mindspore/nn/optim/lazyadam.py
浏览文件 @
57252dee
...
@@ -133,7 +133,7 @@ class LazyAdam(Optimizer):
...
@@ -133,7 +133,7 @@ class LazyAdam(Optimizer):
If True, updates the gradients using NAG.
If True, updates the gradients using NAG.
If False, updates the gradients without using NAG. Default: False.
If False, updates the gradients without using NAG. Default: False.
weight_decay (float): Weight decay (L2 penalty). Default: 0.0.
weight_decay (float): Weight decay (L2 penalty). Default: 0.0.
loss_scale (float): A floating point value for the loss scale.
Should be equal to or greater than 1
. Default:
loss_scale (float): A floating point value for the loss scale.
It should be not less than 1.0
. Default:
1.0.
1.0.
Inputs:
Inputs:
...
...
mindspore/nn/optim/momentum.py
浏览文件 @
57252dee
...
@@ -83,8 +83,8 @@ class Momentum(Optimizer):
...
@@ -83,8 +83,8 @@ class Momentum(Optimizer):
or greater than 0.0.
or greater than 0.0.
momentum (float): Hyperparameter of type float, means momentum for the moving average.
momentum (float): Hyperparameter of type float, means momentum for the moving average.
It should be at least 0.0.
It should be at least 0.0.
weight_decay (int, float): Weight decay (L2 penalty). It should be
equal to or greater than 0.0
. Default: 0.0.
weight_decay (int, float): Weight decay (L2 penalty). It should be
in range [0.0, 1.0]
. Default: 0.0.
loss_scale (int, float): A floating point value for the loss scale.
It should be greater than 0
.0. Default: 1.0.
loss_scale (int, float): A floating point value for the loss scale.
Should be not less than 1
.0. Default: 1.0.
use_nesterov (bool): Enable Nesterov momentum. Default: False.
use_nesterov (bool): Enable Nesterov momentum. Default: False.
Inputs:
Inputs:
...
...
mindspore/nn/optim/optimizer.py
浏览文件 @
57252dee
...
@@ -79,10 +79,9 @@ class Optimizer(Cell):
...
@@ -79,10 +79,9 @@ class Optimizer(Cell):
the order will be followed in optimizer. There are no other keys in the `dict` and the parameters which
the order will be followed in optimizer. There are no other keys in the `dict` and the parameters which
in the value of 'order_params' should be in one of group parameters.
in the value of 'order_params' should be in one of group parameters.
weight_decay (float): A floating point value for the weight decay. It should be not less than 0 and not
weight_decay (float): A floating point value for the weight decay. It should be in range [0.0, 1.0].
greater than 1.
If the type of `weight_decay` input is int, it will be converted to float. Default: 0.0.
If the type of `weight_decay` input is int, it will be converted to float. Default: 0.0.
loss_scale (float): A floating point value for the loss scale. It should be not less than 1. If the
loss_scale (float): A floating point value for the loss scale. It should be not less than 1.
0.
If the
type of `loss_scale` input is int, it will be converted to float. Default: 1.0.
type of `loss_scale` input is int, it will be converted to float. Default: 1.0.
Raises:
Raises:
...
@@ -333,8 +332,8 @@ class Optimizer(Cell):
...
@@ -333,8 +332,8 @@ class Optimizer(Cell):
if
'weight_decay'
in
group_param
.
keys
():
if
'weight_decay'
in
group_param
.
keys
():
validator
.
check_float_legal_value
(
'weight_decay'
,
group_param
[
'weight_decay'
],
None
)
validator
.
check_float_legal_value
(
'weight_decay'
,
group_param
[
'weight_decay'
],
None
)
validator
.
check_number_range
(
'weight_decay'
,
group_param
[
'weight_decay'
],
0.0
,
float
(
"inf"
)
,
validator
.
check_number_range
(
'weight_decay'
,
group_param
[
'weight_decay'
],
0.0
,
1.0
,
Rel
.
INC_
LEFT
,
self
.
cls_name
)
Rel
.
INC_
BOTH
,
self
.
cls_name
)
weight_decay_
=
group_param
[
'weight_decay'
]
*
self
.
loss_scale
weight_decay_
=
group_param
[
'weight_decay'
]
*
self
.
loss_scale
else
:
else
:
weight_decay_
=
weight_decay
*
self
.
loss_scale
weight_decay_
=
weight_decay
*
self
.
loss_scale
...
...
mindspore/nn/optim/proximal_ada_grad.py
浏览文件 @
57252dee
...
@@ -71,8 +71,8 @@ class ProximalAdagrad(Optimizer):
...
@@ -71,8 +71,8 @@ class ProximalAdagrad(Optimizer):
l1 (float): l1 regularization strength, must be greater than or equal to zero. Default: 0.0.
l1 (float): l1 regularization strength, must be greater than or equal to zero. Default: 0.0.
l2 (float): l2 regularization strength, must be greater than or equal to zero. Default: 0.0.
l2 (float): l2 regularization strength, must be greater than or equal to zero. Default: 0.0.
use_locking (bool): If True use locks for update operation. Default: False.
use_locking (bool): If True use locks for update operation. Default: False.
loss_scale (float): Value for the loss scale. It should be
greater than 0
.0. Default: 1.0.
loss_scale (float): Value for the loss scale. It should be
not less than 1
.0. Default: 1.0.
wegith_decay (float): Weight decay value to multiply weight,
must be zero or positive value
. Default: 0.0.
wegith_decay (float): Weight decay value to multiply weight,
should be in range [0.0, 1.0]
. Default: 0.0.
Inputs:
Inputs:
- **grads** (tuple[Tensor]) - The gradients of `params` in optimizer, the shape is as same as the `params`
- **grads** (tuple[Tensor]) - The gradients of `params` in optimizer, the shape is as same as the `params`
...
...
mindspore/nn/optim/rmsprop.py
浏览文件 @
57252dee
...
@@ -123,8 +123,8 @@ class RMSProp(Optimizer):
...
@@ -123,8 +123,8 @@ class RMSProp(Optimizer):
0. Default: 1e-10.
0. Default: 1e-10.
use_locking (bool): Enable a lock to protect the update of variable and accumlation tensors. Default: False.
use_locking (bool): Enable a lock to protect the update of variable and accumlation tensors. Default: False.
centered (bool): If True, gradients are normalized by the estimated variance of the gradient. Default: False.
centered (bool): If True, gradients are normalized by the estimated variance of the gradient. Default: False.
loss_scale (float): A floating point value for the loss scale. Should be
greater than
0. Default: 1.0.
loss_scale (float): A floating point value for the loss scale. Should be
not less than 1.
0. Default: 1.0.
weight_decay (float): Weight decay (L2 penalty). Should be
equal to or greater than 0
. Default: 0.0.
weight_decay (float): Weight decay (L2 penalty). Should be
in range [0.0, 1.0]
. Default: 0.0.
Inputs:
Inputs:
- **gradients** (tuple[Tensor]) - The gradients of `params`, the shape is the same as `params`.
- **gradients** (tuple[Tensor]) - The gradients of `params`, the shape is the same as `params`.
...
...
mindspore/nn/optim/sgd.py
浏览文件 @
57252dee
...
@@ -76,10 +76,9 @@ class SGD(Optimizer):
...
@@ -76,10 +76,9 @@ class SGD(Optimizer):
greater than 0. Default: 0.1.
greater than 0. Default: 0.1.
momentum (float): A floating point value the momentum. should be at least 0.0. Default: 0.0.
momentum (float): A floating point value the momentum. should be at least 0.0. Default: 0.0.
dampening (float): A floating point value of dampening for momentum. should be at least 0.0. Default: 0.0.
dampening (float): A floating point value of dampening for momentum. should be at least 0.0. Default: 0.0.
weight_decay (float): Weight decay (L2 penalty). It should be
equal to or greater than 0
. Default: 0.0.
weight_decay (float): Weight decay (L2 penalty). It should be
in range [0.0, 1.0]
. Default: 0.0.
nesterov (bool): Enables the Nesterov momentum. Default: False.
nesterov (bool): Enables the Nesterov momentum. Default: False.
loss_scale (float): A floating point value for the loss scale, which should be larger
loss_scale (float): A floating point value for the loss scale. Should be not less than 1.0. Default: 1.0.
than 0.0. Default: 1.0.
Inputs:
Inputs:
- **gradients** (tuple[Tensor]) - The gradients of `params`, the shape is the same as `params`.
- **gradients** (tuple[Tensor]) - The gradients of `params`, the shape is the same as `params`.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录