Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
c046874b
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看板
提交
c046874b
编写于
4月 27, 2020
作者:
Z
zhouyuanshen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug in infer_dtype function of hcom operations
上级
e213f2a4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
10 deletion
+14
-10
mindspore/ops/operations/comm_ops.py
mindspore/ops/operations/comm_ops.py
+10
-7
tests/ut/python/communication/test_comm.py
tests/ut/python/communication/test_comm.py
+1
-1
tests/ut/python/parallel/test_bool_grad.py
tests/ut/python/parallel/test_bool_grad.py
+3
-2
未找到文件。
mindspore/ops/operations/comm_ops.py
浏览文件 @
c046874b
...
...
@@ -45,7 +45,6 @@ class AllReduce(PrimitiveWithInfer):
Note:
The operation of AllReduce does not support "prod" currently.
The input of AllReduce does not support dtype "Bool".
Tensor must have same shape and format in all processes participating in the collective.
Args:
...
...
@@ -103,7 +102,7 @@ class AllReduce(PrimitiveWithInfer):
return
x_shape
def
infer_dtype
(
self
,
x_dtype
):
if
x_dtype
==
mstype
.
bool_
:
if
x_dtype
.
element_type
()
==
mstype
.
bool_
:
raise
TypeError
(
"AllReduce does not support 'Bool' as the dtype of input!"
)
return
x_dtype
...
...
@@ -161,7 +160,7 @@ class AllGather(PrimitiveWithInfer):
return
x_shape
def
infer_dtype
(
self
,
x_dtype
):
if
x_dtype
==
mstype
.
bool_
:
if
x_dtype
.
element_type
()
==
mstype
.
bool_
:
raise
TypeError
(
f
"
{
self
.
name
}
does not support 'Bool' as the dtype of input!"
)
return
x_dtype
...
...
@@ -176,6 +175,7 @@ class ReduceScatter(PrimitiveWithInfer):
Note:
The back propagation of the op is not surported yet. Stay tuned for more.
Tensor must have the same shape and format in all processes participating in the collective.
Args:
op (str): Specifies an operation used for element-wise reductions,
like sum, max, avg. Default: ReduceOp.SUM.
...
...
@@ -218,7 +218,7 @@ class ReduceScatter(PrimitiveWithInfer):
return
x_shape
def
infer_dtype
(
self
,
x_dtype
):
if
x_dtype
==
mstype
.
bool_
:
if
x_dtype
.
element_type
()
==
mstype
.
bool_
:
raise
TypeError
(
f
"
{
self
.
name
}
does not support 'Bool' as the dtype of input!"
)
return
x_dtype
...
...
@@ -275,8 +275,11 @@ class Broadcast(PrimitiveWithInfer):
return
x_shape
def
infer_dtype
(
self
,
x_dtype
):
if
x_dtype
==
mstype
.
bool_
:
raise
TypeError
(
f
"
{
self
.
name
}
does not support 'Bool' as the dtype of input!"
)
if
not
isinstance
(
x_dtype
,
tuple
):
raise
TypeError
(
f
"
{
self
.
name
}
's input should be a tuple!"
)
for
_ele
in
x_dtype
:
if
_ele
.
element_type
()
==
mstype
.
bool_
:
raise
TypeError
(
f
"
{
self
.
name
}
does not support 'Bool' as the dtype of input!"
)
return
x_dtype
...
...
@@ -318,7 +321,7 @@ class _AlltoAll(PrimitiveWithInfer):
return
x_shape
def
infer_dtype
(
self
,
x_dtype
):
if
x_dtype
==
mstype
.
bool_
:
if
x_dtype
.
element_type
()
==
mstype
.
bool_
:
raise
TypeError
(
f
"
{
self
.
name
}
does not support 'Bool' as the dtype of input!"
)
return
x_dtype
...
...
tests/ut/python/communication/test_comm.py
浏览文件 @
c046874b
...
...
@@ -55,7 +55,7 @@ class BroadCastNet(nn.Cell):
self
.
broadcast
=
Broadcast
(
0
)
def
construct
(
self
,
x
):
x
=
self
.
broadcast
((
x
))
x
,
=
self
.
broadcast
((
x
,
))
x
=
self
.
dense
(
x
)
return
x
...
...
tests/ut/python/parallel/test_bool_grad.py
浏览文件 @
c046874b
...
...
@@ -52,7 +52,7 @@ class CommonNet(nn.Cell):
def
__init__
(
self
):
super
(
CommonNet
,
self
).
__init__
()
self
.
weight
=
Parameter
(
Tensor
(
np
.
ones
([
256
,
64
]),
dtype
=
ms
.
float32
),
name
=
"mul_weight"
)
self
.
logicalnot
=
P
.
LogicalNot
().
set_strategy
(((
4
,
1
),))
self
.
logicalnot
=
P
.
LogicalNot
().
set_strategy
(((
4
,
2
),))
self
.
equal
=
P
.
Equal
().
set_strategy
(((
4
,
2
),(
4
,
2
)))
def
construct
(
self
,
x
,
label
):
...
...
@@ -78,4 +78,5 @@ def common_net():
def
test_bool_grad
():
common_net
()
\ No newline at end of file
common_net
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录