Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
d7e1ab14
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看板
提交
d7e1ab14
编写于
5月 30, 2020
作者:
Y
Yi Huaijie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean pylint warnings
上级
5aa55302
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
14 deletion
+10
-14
tests/st/auto_parallel/resnet50_expand_loss.py
tests/st/auto_parallel/resnet50_expand_loss.py
+1
-3
tests/ut/python/parallel/test_auto_parallel_flag.py
tests/ut/python/parallel/test_auto_parallel_flag.py
+9
-9
tests/ut/python/parallel/test_embeddinglookup.py
tests/ut/python/parallel/test_embeddinglookup.py
+0
-2
未找到文件。
tests/st/auto_parallel/resnet50_expand_loss.py
浏览文件 @
d7e1ab14
...
...
@@ -15,7 +15,6 @@
import
os
import
numpy
as
np
import
pytest
import
mindspore.common.dtype
as
mstype
import
mindspore.context
as
context
...
...
@@ -113,8 +112,7 @@ class ResidualBlock(nn.Cell):
def
__init__
(
self
,
in_channels
,
out_channels
,
stride
=
1
,
momentum
=
0.9
):
stride
=
1
):
super
(
ResidualBlock
,
self
).
__init__
()
out_chls
=
out_channels
//
self
.
expansion
...
...
tests/ut/python/parallel/test_auto_parallel_flag.py
浏览文件 @
d7e1ab14
...
...
@@ -39,10 +39,10 @@ class MindDataSet(MindData):
if
self
.
_size
<
self
.
_iter_num
:
raise
StopIteration
self
.
_iter_num
+=
1
next
=
[]
for
shape
,
type
in
zip
(
self
.
_output_shapes
,
self
.
_np_types
):
next
.
append
(
Tensor
(
np
.
ones
(
shape
).
astype
(
type
)))
return
tuple
(
next
)
next
_
=
[]
for
shape
,
type
_
in
zip
(
self
.
_output_shapes
,
self
.
_np_types
):
next
_
.
append
(
Tensor
(
np
.
ones
(
shape
).
astype
(
type_
)))
return
tuple
(
next
_
)
class
Net
(
nn
.
Cell
):
...
...
@@ -53,8 +53,8 @@ class Net(nn.Cell):
self
.
matmul
=
P
.
MatMul
()
self
.
add
=
P
.
TensorAdd
()
def
construct
(
self
,
input
):
output
=
self
.
add
(
self
.
matmul
(
input
,
self
.
weight
),
self
.
bias
)
def
construct
(
self
,
input
_
):
output
=
self
.
add
(
self
.
matmul
(
input
_
,
self
.
weight
),
self
.
bias
)
return
output
...
...
@@ -67,9 +67,9 @@ class NetFP16(nn.Cell):
self
.
add
=
P
.
TensorAdd
()
self
.
cast
=
P
.
Cast
()
def
construct
(
self
,
input
):
def
construct
(
self
,
input
_
):
output
=
self
.
cast
(
self
.
add
(
self
.
matmul
(
self
.
cast
(
input
,
mstype
.
float16
),
self
.
cast
(
self
.
weight
,
mstype
.
float16
)),
self
.
add
(
self
.
matmul
(
self
.
cast
(
input
_
,
mstype
.
float16
),
self
.
cast
(
self
.
weight
,
mstype
.
float16
)),
self
.
cast
(
self
.
bias
,
mstype
.
float16
)),
mstype
.
float32
)
return
output
...
...
@@ -107,5 +107,5 @@ def test_auto_parallel_flag():
optimizer
=
Momentum
(
net
.
trainable_params
(),
learning_rate
=
0.1
,
momentum
=
0.9
)
model
=
Model
(
net
,
loss_fn
=
loss
,
optimizer
=
optimizer
,
metrics
=
None
,
loss_scale_manager
=
scale_manager
)
model
.
train
(
2
,
dataset
)
assert
(
model
.
_train_network
.
get_flags
()[
"auto_parallel"
]
==
True
)
assert
model
.
_train_network
.
get_flags
()[
"auto_parallel"
]
context
.
reset_auto_parallel_context
()
tests/ut/python/parallel/test_embeddinglookup.py
浏览文件 @
d7e1ab14
...
...
@@ -17,9 +17,7 @@ import numpy as np
import
mindspore
as
ms
import
mindspore.nn
as
nn
from
mindspore
import
Tensor
from
mindspore
import
context
from
mindspore.common.api
import
_executor
from
mindspore.ops
import
composite
as
C
from
mindspore.ops
import
operations
as
P
from
tests.ut.python.ops.test_math_ops
import
VirtualLoss
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录