Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
59c4fdac
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
59c4fdac
编写于
3月 30, 2022
作者:
Z
zhaoyingli
提交者:
GitHub
3月 30, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[AutoParallel] fix converter when sliced_shape is 1 (#41103)
* fix converter when sliced_shape is 1 * update unittest
上级
a0e961c0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
4 deletion
+26
-4
python/paddle/distributed/auto_parallel/converter.py
python/paddle/distributed/auto_parallel/converter.py
+2
-2
python/paddle/distributed/auto_parallel/utils.py
python/paddle/distributed/auto_parallel/utils.py
+2
-2
python/paddle/fluid/tests/unittests/auto_parallel/converter.py
...n/paddle/fluid/tests/unittests/auto_parallel/converter.py
+22
-0
未找到文件。
python/paddle/distributed/auto_parallel/converter.py
浏览文件 @
59c4fdac
...
...
@@ -447,8 +447,8 @@ class Converter(object):
slice_shape
=
shape
else
:
slice_shape
=
shape
//
process_shape
[
dims_mapping
[
i
]]
if
shape
==
1
:
index
=
0
if
s
lice_s
hape
==
1
:
index
=
partition_index
[
i
][
0
]
else
:
index
=
(
partition_index
[
i
][
0
]
+
1
)
//
slice_shape
sliced_index
=
sliced_index
*
(
shape
//
slice_shape
)
+
index
...
...
python/paddle/distributed/auto_parallel/utils.py
浏览文件 @
59c4fdac
...
...
@@ -943,8 +943,8 @@ def _get_sliced_param_index(rank, complete_shape, dims_mapping, process_shape,
slice_shape
=
shape
else
:
slice_shape
=
shape
//
process_shape
[
dims_mapping
[
i
]]
if
shape
==
1
:
index
=
0
if
s
lice_s
hape
==
1
:
index
=
partition_index
[
i
][
0
]
else
:
index
=
(
partition_index
[
i
][
0
]
+
1
)
//
slice_shape
sliced_param_index
=
sliced_param_index
*
(
shape
//
slice_shape
)
+
index
...
...
python/paddle/fluid/tests/unittests/auto_parallel/converter.py
浏览文件 @
59c4fdac
...
...
@@ -78,6 +78,28 @@ def test_convert():
convert_tensor_dict
=
converter
.
convert
(
strict
=
False
)
assert
np
.
equal
(
convert_tensor_dict
[
new_name
],
tensor_row
[
rank_id
]).
all
()
# test sliced_shape is 1
complete_tensor
=
np
.
arange
(
4
).
reshape
([
2
,
2
])
tensor_row
=
np
.
split
(
complete_tensor
,
2
,
axis
=
0
)
complet_strategy
=
{
"tensor_2"
:
{
"process_shape"
:
[
2
],
"process_group"
:
[
0
,
1
],
"dims_mapping"
:
[
-
1
,
-
1
]
}
}
row_strategy
=
{
"tensor_2"
:
{
"process_shape"
:
[
2
],
"process_group"
:
[
0
,
1
],
"dims_mapping"
:
[
0
,
-
1
]
}
}
tensor_dict
=
{
"tensor_2"
:
[
complete_tensor
]}
converter
=
Converter
(
tensor_dict
,
complet_strategy
,
row_strategy
)
convert_tensor_dict
=
converter
.
convert
()
assert
np
.
equal
(
convert_tensor_dict
[
"tensor_2"
],
tensor_row
[
rank_id
]).
all
()
if
__name__
==
"__main__"
:
test_convert
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录