Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
873ee4e3
P
Paddle
项目概览
机器未来
/
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看板
未验证
提交
873ee4e3
编写于
10月 20, 2021
作者:
W
wuhuachaocoding
提交者:
GitHub
10月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adapt to cann5.0.3_alpha3. (#36106)
上级
605e7f08
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
1 deletion
+30
-1
cmake/external/ascend.cmake
cmake/external/ascend.cmake
+3
-1
paddle/fluid/operators/collective/c_embedding_op_npu.cc
paddle/fluid/operators/collective/c_embedding_op_npu.cc
+14
-0
paddle/fluid/operators/fill_constant_op_npu.cc
paddle/fluid/operators/fill_constant_op_npu.cc
+10
-0
paddle/fluid/operators/lookup_table_v2_op_npu.cc
paddle/fluid/operators/lookup_table_v2_op_npu.cc
+3
-0
未找到文件。
cmake/external/ascend.cmake
浏览文件 @
873ee4e3
...
...
@@ -92,6 +92,8 @@ macro(find_ascend_toolkit_version ascend_toolkit_version_info)
file
(
READ
${
ascend_toolkit_version_info
}
ASCEND_TOOLKIT_VERSION_CONTENTS
)
string
(
REGEX MATCH
"version=([0-9]+\.[0-9]+\.[0-9]+\.[a-z]*[0-9]*)"
ASCEND_TOOLKIT_VERSION
"
${
ASCEND_TOOLKIT_VERSION_CONTENTS
}
"
)
string
(
REGEX REPLACE
"version=([0-9]+\.[0-9]+\.[0-9]+\.[a-z]*[0-9]*)"
"
\\
1"
ASCEND_TOOLKIT_VERSION
"
${
ASCEND_TOOLKIT_VERSION
}
"
)
string
(
REGEX REPLACE
"[a-z|\.]"
""
CANN_VERSION
${
ASCEND_TOOLKIT_VERSION
}
)
add_definitions
(
"-DCANN_VERSION_CODE=
${
CANN_VERSION
}
"
)
if
(
NOT ASCEND_TOOLKIT_VERSION
)
set
(
ASCEND_TOOLKIT_VERSION
"???"
)
else
()
...
...
@@ -118,4 +120,4 @@ endif()
find_ascend_toolkit_version
(
${
ASCEND_TOOLKIT_DIR
}
/ascend_toolkit_install.info
)
find_ascend_driver_version
(
${
ASCEND_DIR
}
/driver/version.info
)
endif
()
\ No newline at end of file
endif
()
paddle/fluid/operators/collective/c_embedding_op_npu.cc
浏览文件 @
873ee4e3
...
...
@@ -68,10 +68,21 @@ void shard_index(const Tensor &table_t, const Tensor &ids_t, int64_t start_idx,
ignore_tensor
.
Resize
(
ids_t
.
dims
());
NpuOpRunner
sub_runner
;
#if (CANN_VERSION_CODE >= 503003)
Tensor
factor_tensor
(
ids_t
.
type
());
factor_tensor
.
mutable_data
<
T
>
({
1
},
context
.
GetPlace
());
TensorFromVector
(
std
::
vector
<
T
>
{
static_cast
<
T
>
(
start_idx
)},
context
.
device_context
(),
&
factor_tensor
);
sub_runner
.
SetType
(
"Sub"
)
.
AddInput
(
ids_t
)
.
AddInput
(
factor_tensor
)
.
AddOutput
(
id_t
);
#else
sub_runner
.
SetType
(
"Sub"
)
.
AddInput
(
ids_t
)
.
AddInput
(
std
::
vector
<
T
>
{
static_cast
<
T
>
(
start_idx
)})
.
AddOutput
(
id_t
);
#endif
sub_runner
.
Run
();
NpuOpRunner
lessequal1_runner
;
...
...
@@ -137,6 +148,9 @@ void NPUGetIdsEmbedding(const framework::ExecutionContext &context) {
.
AddInput
(
table_t_pad
)
.
AddInput
(
ids_t_local
)
.
AddInput
(
std
::
vector
<
int32_t
>
{
0
})
#if (CANN_VERSION_CODE >= 503003)
.
AddAttrs
({{
"batch_dims"
,
0
}})
#endif
.
AddOutput
(
*
output_t
);
runner
.
Run
();
}
...
...
paddle/fluid/operators/fill_constant_op_npu.cc
浏览文件 @
873ee4e3
...
...
@@ -66,11 +66,21 @@ class FillConstantNPUKernel : public framework::OpKernel<T> {
out_var
->
mutable_data
<
T
>
(
shape
,
ctx
.
GetPlace
());
NpuOpRunner
runner
;
#if (CANN_VERSION_CODE >= 503003)
runner
.
SetType
(
"FillD"
)
.
AddInput
(
tensor_value
)
.
AddOutput
(
*
out_var
)
.
AddAttrs
(
{{
"dims"
,
framework
::
vectorize
(
shape
)
}})
.
Run
(
stream
);
#else
runner
.
SetType
(
"Fill"
)
.
AddInput
(
framework
::
vectorize
(
shape
))
.
AddInput
(
tensor_value
)
.
AddOutput
(
*
out_var
)
.
Run
(
stream
);
#endif
}
};
}
// namespace operators
...
...
paddle/fluid/operators/lookup_table_v2_op_npu.cc
浏览文件 @
873ee4e3
...
...
@@ -40,6 +40,9 @@ class LookupTableV2NPUKernel : public framework::OpKernel<T> {
.
AddInput
(
*
table_t
)
.
AddInput
(
*
ids_t
)
.
AddInput
(
std
::
vector
<
int32_t
>
{
0
})
#if (CANN_VERSION_CODE >= 503003)
.
AddAttrs
({{
"batch_dims"
,
0
}})
#endif
.
AddOutput
(
*
output_t
);
runner
.
Run
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录