Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
eaf7146d
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看板
提交
eaf7146d
编写于
3月 31, 2020
作者:
高东海
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify longtime python ut
上级
d84bf8d3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
15 deletion
+15
-15
mindspore/nn/layer/conv.py
mindspore/nn/layer/conv.py
+1
-1
tests/ut/python/parallel/test_auto_parallel_reshape.py
tests/ut/python/parallel/test_auto_parallel_reshape.py
+3
-3
tests/ut/python/parallel/test_one_hot_net.py
tests/ut/python/parallel/test_one_hot_net.py
+4
-4
tests/ut/python/parallel/test_reshape.py
tests/ut/python/parallel/test_reshape.py
+4
-4
tests/ut/python/train/summary/test_summary_performance.py
tests/ut/python/train/summary/test_summary_performance.py
+3
-3
未找到文件。
mindspore/nn/layer/conv.py
浏览文件 @
eaf7146d
...
...
@@ -159,7 +159,7 @@ class Conv2d(_Conv):
>>> net = nn.Conv2d(120, 240, 4, has_bias=False, weight_init='normal')
>>> input = mindspore.Tensor(np.ones([1, 120, 1024, 640]), mindspore.float32)
>>> net(input).shape()
(1, 240, 1024, 6
37
)
(1, 240, 1024, 6
40
)
"""
@
cell_attr_register
def
__init__
(
self
,
...
...
tests/ut/python/parallel/test_auto_parallel_reshape.py
浏览文件 @
eaf7146d
...
...
@@ -49,16 +49,16 @@ def test_reshape_matmul():
super
().
__init__
()
self
.
reshape
=
P
.
Reshape
()
self
.
matmul
=
P
.
MatMul
()
self
.
matmul_weight
=
Parameter
(
Tensor
(
np
.
ones
([
2
5088
,
256
]),
dtype
=
ms
.
float32
),
name
=
"weight"
)
self
.
matmul_weight
=
Parameter
(
Tensor
(
np
.
ones
([
2
8
,
64
]),
dtype
=
ms
.
float32
),
name
=
"weight"
)
def
construct
(
self
,
x
):
out
=
self
.
reshape
(
x
,
(
256
,
2508
8
))
out
=
self
.
reshape
(
x
,
(
64
,
2
8
))
out
=
self
.
matmul
(
out
,
self
.
matmul_weight
)
return
out
size
=
8
context
.
set_auto_parallel_context
(
device_num
=
size
,
global_rank
=
0
)
x
=
Tensor
(
np
.
ones
([
32
*
size
,
512
,
7
,
7
]),
dtype
=
ms
.
float32
)
x
=
Tensor
(
np
.
ones
([
8
*
size
,
28
,
1
,
1
]),
dtype
=
ms
.
float32
)
net
=
GradWrap
(
NetWithLoss
(
Net
()))
context
.
set_auto_parallel_context
(
parallel_mode
=
"auto_parallel"
)
...
...
tests/ut/python/parallel/test_one_hot_net.py
浏览文件 @
eaf7146d
...
...
@@ -247,15 +247,15 @@ def fc_with_initialize(input_channels, out_channels):
class
BNReshapeDenseBNNet
(
nn
.
Cell
):
def
__init__
(
self
):
super
(
BNReshapeDenseBNNet
,
self
).
__init__
()
self
.
batch_norm
=
bn_with_initialize
(
51
2
)
self
.
batch_norm
=
bn_with_initialize
(
2
)
self
.
reshape
=
P
.
Reshape
()
self
.
batch_norm2
=
nn
.
BatchNorm1d
(
512
,
affine
=
False
)
self
.
fc
=
fc_with_initialize
(
51
2
*
32
*
32
,
512
)
self
.
fc
=
fc_with_initialize
(
2
*
32
*
32
,
512
)
self
.
loss
=
SemiAutoOneHotNet
(
args
=
Args
(),
strategy
=
StrategyBatch
())
def
construct
(
self
,
x
,
label
):
x
=
self
.
batch_norm
(
x
)
x
=
self
.
reshape
(
x
,
(
16
,
51
2
*
32
*
32
))
x
=
self
.
reshape
(
x
,
(
16
,
2
*
32
*
32
))
x
=
self
.
fc
(
x
)
x
=
self
.
batch_norm2
(
x
)
loss
=
self
.
loss
(
x
,
label
)
...
...
@@ -266,7 +266,7 @@ def test_bn_reshape_dense_bn_train_loss():
batch_size
=
16
device_num
=
16
context
.
set_auto_parallel_context
(
device_num
=
device_num
,
global_rank
=
0
)
input
=
Tensor
(
np
.
ones
([
batch_size
,
51
2
,
32
,
32
]).
astype
(
np
.
float32
)
*
0.01
)
input
=
Tensor
(
np
.
ones
([
batch_size
,
2
,
32
,
32
]).
astype
(
np
.
float32
)
*
0.01
)
label
=
Tensor
(
np
.
ones
([
batch_size
]),
dtype
=
ms
.
int32
)
net
=
GradWrap
(
NetWithLoss
(
BNReshapeDenseBNNet
()))
...
...
tests/ut/python/parallel/test_reshape.py
浏览文件 @
eaf7146d
...
...
@@ -490,15 +490,15 @@ def fc_with_initialize(input_channels, out_channels):
class
BNReshapeDenseBNNet
(
nn
.
Cell
):
def
__init__
(
self
):
super
(
BNReshapeDenseBNNet
,
self
).
__init__
()
self
.
batch_norm
=
bn_with_initialize
(
51
2
)
self
.
batch_norm
=
bn_with_initialize
(
2
)
self
.
reshape
=
P
.
Reshape
()
self
.
cast
=
P
.
Cast
()
self
.
batch_norm2
=
nn
.
BatchNorm1d
(
512
,
affine
=
False
)
self
.
fc
=
fc_with_initialize
(
51
2
*
32
*
32
,
512
)
self
.
fc
=
fc_with_initialize
(
2
*
32
*
32
,
512
)
def
construct
(
self
,
x
):
x
=
self
.
batch_norm
(
x
)
x
=
self
.
reshape
(
x
,
(
16
,
51
2
*
32
*
32
))
x
=
self
.
reshape
(
x
,
(
16
,
2
*
32
*
32
))
x
=
self
.
fc
(
x
)
x
=
self
.
batch_norm2
(
x
)
return
x
...
...
@@ -508,7 +508,7 @@ def test_bn_reshape_dense_bn_train():
batch_size
=
16
device_num
=
16
context
.
set_auto_parallel_context
(
device_num
=
device_num
,
global_rank
=
0
)
input
=
Tensor
(
np
.
ones
([
batch_size
,
51
2
,
32
,
32
]).
astype
(
np
.
float32
)
*
0.01
)
input
=
Tensor
(
np
.
ones
([
batch_size
,
2
,
32
,
32
]).
astype
(
np
.
float32
)
*
0.01
)
net
=
GradWrap
(
NetWithLoss
(
BNReshapeDenseBNNet
()))
context
.
set_auto_parallel_context
(
parallel_mode
=
"semi_auto_parallel"
)
...
...
tests/ut/python/train/summary/test_summary_performance.py
浏览文件 @
eaf7146d
...
...
@@ -43,9 +43,9 @@ def get_test_data(step):
tag1
=
"xt1[:Tensor]"
tag2
=
"xt2[:Tensor]"
tag3
=
"xt3[:Tensor]"
np1
=
np
.
random
.
random
((
5
0
,
40
,
30
,
50
))
np2
=
np
.
random
.
random
((
5
0
,
50
,
30
,
50
))
np3
=
np
.
random
.
random
((
4
0
,
55
,
30
,
50
))
np1
=
np
.
random
.
random
((
5
,
4
,
3
,
5
))
np2
=
np
.
random
.
random
((
5
,
5
,
3
,
5
))
np3
=
np
.
random
.
random
((
4
,
5
,
3
,
5
))
dict1
=
{}
dict1
[
"name"
]
=
tag1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录