Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
243cd332
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看板
提交
243cd332
编写于
4月 26, 2020
作者:
Z
zhaozhenlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adapt SparseApplyAdagradD adding output accum
上级
e70b162f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
9 addition
and
6 deletion
+9
-6
graphengine
graphengine
+1
-1
mindspore/ccsrc/transform/op_declare.cc
mindspore/ccsrc/transform/op_declare.cc
+1
-1
mindspore/ops/operations/nn_ops.py
mindspore/ops/operations/nn_ops.py
+6
-3
tests/ut/python/ops/test_ops.py
tests/ut/python/ops/test_ops.py
+1
-1
未找到文件。
graphengine
@
d345a800
Subproject commit
43a715bc461fd70b7837051a2f47f0a1b19c5859
Subproject commit
d345a800a4f7c32eb768ea48667d1ce00b841748
mindspore/ccsrc/transform/op_declare.cc
浏览文件 @
243cd332
...
...
@@ -1133,7 +1133,7 @@ INPUT_MAP(SparseApplyAdagradD) = {
{
1
,
INPUT_DESC
(
var
)},
{
2
,
INPUT_DESC
(
accum
)},
{
3
,
INPUT_DESC
(
grad
)},
{
4
,
INPUT_DESC
(
indices
)}};
ATTR_MAP
(
SparseApplyAdagradD
)
=
{{
"lr"
,
ATTR_DESC
(
lr
,
AnyTraits
<
float
>
())},
{
"use_locking"
,
ATTR_DESC
(
use_locking
,
AnyTraits
<
bool
>
())}};
OUTPUT_MAP
(
SparseApplyAdagradD
)
=
{{
0
,
OUTPUT_DESC
(
var
)}};
OUTPUT_MAP
(
SparseApplyAdagradD
)
=
{{
0
,
OUTPUT_DESC
(
var
)}
,
{
1
,
OUTPUT_DESC
(
accum
)}
};
// SparseApplyFtrlD
INPUT_MAP
(
SparseApplyFtrlD
)
=
{{
1
,
INPUT_DESC
(
var
)},
...
...
mindspore/ops/operations/nn_ops.py
浏览文件 @
243cd332
...
...
@@ -2433,7 +2433,10 @@ class SparseApplyAdagrad(PrimitiveWithInfer):
The shape of `indices` must be the same as `grad` in first dimension, the type must be int32.
Outputs:
Tensor, has the same shape and type as `var`.
Tuple of 2 Tensor, the updated parameters.
- **var** (Tensor) - The same shape and data type as `var`.
- **accum** (Tensor) - The same shape and data type as `accum`.
"""
@
prim_attr_register
...
...
@@ -2448,13 +2451,13 @@ class SparseApplyAdagrad(PrimitiveWithInfer):
validator
.
check
(
'var_shape[1:]'
,
var_shape
[
1
:],
'grad_shape[1:]'
,
grad_shape
[
1
:],
Rel
.
EQ
,
self
.
name
)
validator
.
check_integer
(
"indices rank"
,
len
(
indices_shape
),
1
,
Rel
.
EQ
,
self
.
name
)
validator
.
check
(
'grad_shape[0]'
,
grad_shape
[
0
],
'indices_shape[0]'
,
indices_shape
[
0
],
Rel
.
EQ
,
self
.
name
)
return
var_shape
return
var_shape
,
accum_shape
def
infer_dtype
(
self
,
var_type
,
accum_type
,
grad_type
,
indices_type
):
args
=
{
'var'
:
var_type
,
'accum'
:
accum_type
,
'grad'
:
grad_type
}
validator
.
check_tensor_type_same
(
args
,
(
mstype
.
float32
,),
self
.
name
)
validator
.
check_tensor_type_same
({
'indices'
:
indices_type
},
[
mstype
.
int32
],
self
.
name
)
return
var_type
return
var_type
,
accum_type
class
LARSUpdate
(
PrimitiveWithInfer
):
...
...
tests/ut/python/ops/test_ops.py
浏览文件 @
243cd332
...
...
@@ -814,7 +814,7 @@ test_case_nn_ops = [
(
'SparseApplyAdagrad'
,
{
'block'
:
P
.
SparseApplyAdagrad
(
0.5
),
'desc_inputs'
:
[[
3
,
3
],
[
3
,
3
],
[
3
,
3
],
Tensor
(
np
.
ones
((
3
,),
np
.
int32
))],
'desc_bprop'
:
[
3
,
3
],
'desc_bprop'
:
[
[
3
,
3
],
[
3
,
3
]
],
'skip'
:
[
'backward'
]}),
(
'Flatten_1'
,
{
'block'
:
NetForFlatten
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录