Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
6f86c96b
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
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看板
未验证
提交
6f86c96b
编写于
3月 15, 2023
作者:
Z
zhangyuqin1998
提交者:
GitHub
3月 15, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete randperm raw op (#51631)
* Delete randperm raw op * fix
上级
3734e89a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
16 addition
and
73 deletion
+16
-73
paddle/phi/backends/xpu/xpu2_op_list.cc
paddle/phi/backends/xpu/xpu2_op_list.cc
+0
-5
paddle/phi/kernels/cpu/randperm_kernel.cc
paddle/phi/kernels/cpu/randperm_kernel.cc
+5
-19
paddle/phi/kernels/gpu/randperm_kernel.cu
paddle/phi/kernels/gpu/randperm_kernel.cu
+5
-19
paddle/phi/kernels/randperm_kernel.h
paddle/phi/kernels/randperm_kernel.h
+0
-4
paddle/phi/kernels/xpu/randperm_kernel.cc
paddle/phi/kernels/xpu/randperm_kernel.cc
+5
-20
paddle/phi/ops/compat/randperm_sig.cc
paddle/phi/ops/compat/randperm_sig.cc
+1
-6
未找到文件。
paddle/phi/backends/xpu/xpu2_op_list.cc
浏览文件 @
6f86c96b
...
...
@@ -514,11 +514,6 @@ XPUOpMap& get_kl2_ops() {
XPUKernelSet
({
phi
::
DataType
::
FLOAT32
,
phi
::
DataType
::
FLOAT16
})},
{
"prod_raw"
,
XPUKernelSet
({
phi
::
DataType
::
FLOAT32
})},
{
"range"
,
XPUKernelSet
({
phi
::
DataType
::
FLOAT32
,
phi
::
DataType
::
INT64
})},
{
"randperm_raw"
,
XPUKernelSet
({
phi
::
DataType
::
INT32
,
phi
::
DataType
::
INT64
,
phi
::
DataType
::
FLOAT32
,
phi
::
DataType
::
FLOAT64
})},
{
"randperm"
,
XPUKernelSet
({
phi
::
DataType
::
INT32
,
phi
::
DataType
::
INT64
,
...
...
paddle/phi/kernels/cpu/randperm_kernel.cc
浏览文件 @
6f86c96b
...
...
@@ -19,9 +19,12 @@
namespace
phi
{
template
<
typename
T
,
typename
Context
>
void
RandpermRawKernel
(
const
Context
&
dev_ctx
,
int
n
,
DataType
dtype
,
int
seed
,
DenseTensor
*
out
)
{
void
RandpermKernel
(
const
Context
&
dev_ctx
,
int
n
,
DataType
dtype
,
DenseTensor
*
out
)
{
T
*
out_data
=
dev_ctx
.
template
Alloc
<
T
>(
out
);
int
seed
=
0
;
std
::
shared_ptr
<
std
::
mt19937_64
>
engine
;
if
(
seed
)
{
...
...
@@ -37,25 +40,8 @@ void RandpermRawKernel(
std
::
shuffle
(
out_data
,
out_data
+
n
,
*
engine
);
}
template
<
typename
T
,
typename
Context
>
void
RandpermKernel
(
const
Context
&
dev_ctx
,
int
n
,
DataType
dtype
,
DenseTensor
*
out
)
{
RandpermRawKernel
<
T
>
(
dev_ctx
,
n
,
dtype
,
0
,
out
);
}
}
// namespace phi
PD_REGISTER_KERNEL
(
randperm_raw
,
CPU
,
ALL_LAYOUT
,
phi
::
RandpermRawKernel
,
float
,
double
,
int
,
int64_t
)
{}
PD_REGISTER_KERNEL
(
randperm
,
CPU
,
ALL_LAYOUT
,
...
...
paddle/phi/kernels/gpu/randperm_kernel.cu
浏览文件 @
6f86c96b
...
...
@@ -85,9 +85,12 @@ __global__ void SwapRepeatKernel(keyT* key_out_data,
}
template
<
typename
T
,
typename
Context
>
void
RandpermRawKernel
(
const
Context
&
dev_ctx
,
int
n
,
DataType
dtype
,
int
seed
,
DenseTensor
*
out
)
{
void
RandpermKernel
(
const
Context
&
dev_ctx
,
int
n
,
DataType
dtype
,
DenseTensor
*
out
)
{
DenseTensor
key
;
int
seed
=
0
;
RandintKernel
<
int
,
Context
>
(
dev_ctx
,
std
::
numeric_limits
<
int
>::
min
(),
std
::
numeric_limits
<
int
>::
max
(),
...
...
@@ -151,25 +154,8 @@ void RandpermRawKernel(
key_out
.
data
<
int
>
(),
out_data
,
n
,
seed_offset
.
first
,
seed_offset
.
second
);
}
template
<
typename
T
,
typename
Context
>
void
RandpermKernel
(
const
Context
&
dev_ctx
,
int
n
,
DataType
dtype
,
DenseTensor
*
out
)
{
RandpermRawKernel
<
T
>
(
dev_ctx
,
n
,
dtype
,
0
,
out
);
}
}
// namespace phi
PD_REGISTER_KERNEL
(
randperm_raw
,
GPU
,
ALL_LAYOUT
,
phi
::
RandpermRawKernel
,
float
,
double
,
int
,
int64_t
)
{}
PD_REGISTER_KERNEL
(
randperm
,
GPU
,
ALL_LAYOUT
,
...
...
paddle/phi/kernels/randperm_kernel.h
浏览文件 @
6f86c96b
...
...
@@ -19,10 +19,6 @@
namespace
phi
{
template
<
typename
T
,
typename
Context
>
void
RandpermRawKernel
(
const
Context
&
dev_ctx
,
int
n
,
DataType
dtype
,
int
seed
,
DenseTensor
*
out
);
template
<
typename
T
,
typename
Context
>
void
RandpermKernel
(
const
Context
&
dev_ctx
,
int
n
,
...
...
paddle/phi/kernels/xpu/randperm_kernel.cc
浏览文件 @
6f86c96b
...
...
@@ -21,10 +21,12 @@
namespace
phi
{
template
<
typename
T
,
typename
Context
>
void
RandpermRawKernel
(
const
Context
&
dev_ctx
,
int
n
,
DataType
dtype
,
int
seed
,
DenseTensor
*
out
)
{
void
RandpermKernel
(
const
Context
&
dev_ctx
,
int
n
,
DataType
dtype
,
DenseTensor
*
out
)
{
std
::
shared_ptr
<
std
::
mt19937_64
>
engine
;
int
seed
=
0
;
if
(
seed
)
{
engine
=
std
::
make_shared
<
std
::
mt19937_64
>
();
engine
->
seed
(
seed
);
...
...
@@ -51,25 +53,8 @@ void RandpermRawKernel(
}
}
template
<
typename
T
,
typename
Context
>
void
RandpermKernel
(
const
Context
&
dev_ctx
,
int
n
,
DataType
dtype
,
DenseTensor
*
out
)
{
RandpermRawKernel
<
T
,
Context
>
(
dev_ctx
,
n
,
dtype
,
0
,
out
);
}
}
// namespace phi
PD_REGISTER_KERNEL
(
randperm_raw
,
XPU
,
ALL_LAYOUT
,
phi
::
RandpermRawKernel
,
int
,
int64_t
,
float
,
double
)
{}
PD_REGISTER_KERNEL
(
randperm
,
XPU
,
ALL_LAYOUT
,
...
...
paddle/phi/ops/compat/randperm_sig.cc
浏览文件 @
6f86c96b
...
...
@@ -17,12 +17,7 @@
namespace
phi
{
KernelSignature
RandpermOpArgumentMapping
(
const
ArgumentMappingContext
&
ctx
)
{
int
seed
=
paddle
::
any_cast
<
int
>
(
ctx
.
Attr
(
"seed"
));
if
(
seed
)
{
return
KernelSignature
(
"randperm"
,
{},
{
"n"
,
"dtype"
,
"seed"
},
{
"Out"
});
}
else
{
return
KernelSignature
(
"randperm"
,
{},
{
"n"
,
"dtype"
},
{
"Out"
});
}
return
KernelSignature
(
"randperm"
,
{},
{
"n"
,
"dtype"
},
{
"Out"
});
}
}
// namespace phi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录