Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
198bc1f5
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
198bc1f5
编写于
5月 18, 2023
作者:
Y
Yichen Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
define unified data class for inferencing dist_attr
上级
227995a4
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
109 addition
and
0 deletion
+109
-0
paddle/fluid/distributed/auto_parallel/spmd_rules/dist_tensor_spec.cc
.../distributed/auto_parallel/spmd_rules/dist_tensor_spec.cc
+54
-0
paddle/fluid/distributed/auto_parallel/spmd_rules/dist_tensor_spec.h
...d/distributed/auto_parallel/spmd_rules/dist_tensor_spec.h
+55
-0
未找到文件。
paddle/fluid/distributed/auto_parallel/spmd_rules/dist_tensor_spec.cc
0 → 100644
浏览文件 @
198bc1f5
/* Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include "paddle/fluid/distributed/auto_parallel/spmd_rules/dist_tensor_spec.h"
namespace
paddle
{
namespace
distributed
{
namespace
auto_parallel
{
DistTensorSpec
::
DistTensorSpec
(
const
std
::
vector
<
int64_t
>&
shape
,
const
TensorDistAttr
&
dist_attr
)
{
shape_
.
assign
(
shape
.
begin
(),
shape
.
end
());
// we should merge the new distributed attributes with the original one
// after inferencing, thus we get a copy of the original one
dist_attr_
.
copy_from
(
dist_attr
);
}
DistTensorSpec
::~
DistTensorSpec
()
{}
const
std
::
vector
<
int64_t
>&
DistTensorSpec
::
get_dims_mapping
()
{
return
dist_attr_
.
dims_mapping
();
}
void
DistTensorSpec
::
set_dims_mapping
(
const
std
::
vector
<
int64_t
>&
dims_mapping
)
{
dist_attr_
.
set_dims_mapping
(
dims_mapping
);
}
const
ProcessMesh
&
DistTensorSpec
::
get_process_mesh
()
{
return
dist_attr_
.
process_mesh
();
}
void
DistTensorSpec
::
set_process_mesh
(
const
ProcessMesh
&
process_mesh
)
{
dist_attr_
.
set_process_mesh
(
process_mesh
);
}
const
std
::
vector
<
int64_t
>&
DistTensorSpec
::
get_shape
()
{
return
shape_
;
}
}
// namespace auto_parallel
}
// namespace distributed
}
// namespace paddle
paddle/fluid/distributed/auto_parallel/spmd_rules/dist_tensor_spec.h
0 → 100644
浏览文件 @
198bc1f5
/* Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include "paddle/fluid/distributed/auto_parallel/dist_attr.h"
namespace
paddle
{
namespace
distributed
{
namespace
auto_parallel
{
/**
* A unified data class for inferring distributed attributes
* in both dygraph mode and static mode
*/
class
DistTensorSpec
{
public:
DistTensorSpec
(
const
std
::
vector
<
int64_t
>&
shape
,
const
TensorDistAttr
&
dist_attr
);
~
DistTensorSpec
();
// get dims_mapping from dist_attr_
const
std
::
vector
<
int64_t
>&
get_dims_mapping
();
// set dims_mapping in dist_attr_
void
set_dims_mapping
(
const
std
::
vector
<
int64_t
>&
dims_mapping
);
// get process_mesh from dist_attr_
const
ProcessMesh
&
get_process_mesh
();
// set process_mesh in dist_attr_
void
set_process_mesh
(
const
ProcessMesh
&
process_mesh
);
const
std
::
vector
<
int64_t
>&
get_shape
();
private:
std
::
vector
<
int64_t
>
shape_
;
// distributed attributes of the corresponding tensor
TensorDistAttr
dist_attr_
;
};
}
// namespace auto_parallel
}
// namespace distributed
}
// namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录