Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
ab583173
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
ab583173
编写于
8月 16, 2022
作者:
Z
zhangkaihuo
提交者:
GitHub
8月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use base visit in cpu kernel (#45062)
上级
0b4268a6
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
62 addition
and
63 deletion
+62
-63
paddle/phi/kernels/sparse/cpu/coalesce_kernel.cc
paddle/phi/kernels/sparse/cpu/coalesce_kernel.cc
+1
-1
paddle/phi/kernels/sparse/cpu/conv_grad_kernel.cc
paddle/phi/kernels/sparse/cpu/conv_grad_kernel.cc
+1
-1
paddle/phi/kernels/sparse/cpu/conv_kernel.cc
paddle/phi/kernels/sparse/cpu/conv_kernel.cc
+1
-1
paddle/phi/kernels/sparse/cpu/elementwise_grad_kernel.cc
paddle/phi/kernels/sparse/cpu/elementwise_grad_kernel.cc
+32
-30
paddle/phi/kernels/sparse/cpu/elementwise_kernel.cc
paddle/phi/kernels/sparse/cpu/elementwise_kernel.cc
+18
-21
paddle/phi/kernels/sparse/cpu/mask_kernel.cc
paddle/phi/kernels/sparse/cpu/mask_kernel.cc
+2
-2
paddle/phi/kernels/sparse/cpu/pool_grad_kernel.cc
paddle/phi/kernels/sparse/cpu/pool_grad_kernel.cc
+1
-1
paddle/phi/kernels/sparse/cpu/pool_kernel.cc
paddle/phi/kernels/sparse/cpu/pool_kernel.cc
+1
-1
paddle/phi/kernels/sparse/cpu/softmax_grad_kernel.cc
paddle/phi/kernels/sparse/cpu/softmax_grad_kernel.cc
+1
-1
paddle/phi/kernels/sparse/cpu/softmax_kernel.cc
paddle/phi/kernels/sparse/cpu/softmax_kernel.cc
+1
-1
paddle/phi/kernels/sparse/cpu/sparse_utils_kernel.cc
paddle/phi/kernels/sparse/cpu/sparse_utils_kernel.cc
+3
-3
未找到文件。
paddle/phi/kernels/sparse/cpu/coalesce_kernel.cc
浏览文件 @
ab583173
...
@@ -98,7 +98,7 @@ template <typename T, typename Context>
...
@@ -98,7 +98,7 @@ template <typename T, typename Context>
void
CoalesceKernel
(
const
Context
&
dev_ctx
,
void
CoalesceKernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
)
{
SparseCooTensor
*
out
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"CoalesceCPUKernel"
,
([
&
]
{
x
.
non_zero_indices
().
dtype
(),
"CoalesceCPUKernel"
,
([
&
]
{
CoalesceCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
CoalesceCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
}));
}));
...
...
paddle/phi/kernels/sparse/cpu/conv_grad_kernel.cc
浏览文件 @
ab583173
...
@@ -196,7 +196,7 @@ void Conv3dCooGradKernel(const Context& dev_ctx,
...
@@ -196,7 +196,7 @@ void Conv3dCooGradKernel(const Context& dev_ctx,
const
std
::
string
&
key
,
const
std
::
string
&
key
,
SparseCooTensor
*
x_grad
,
SparseCooTensor
*
x_grad
,
DenseTensor
*
kernel_grad
)
{
DenseTensor
*
kernel_grad
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"Conv3dCooGradCPUKernel"
,
([
&
]
{
x
.
non_zero_indices
().
dtype
(),
"Conv3dCooGradCPUKernel"
,
([
&
]
{
Conv3dCooGradCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
Conv3dCooGradCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
x
,
...
...
paddle/phi/kernels/sparse/cpu/conv_kernel.cc
浏览文件 @
ab583173
...
@@ -186,7 +186,7 @@ void Conv3dCooKernel(const Context& dev_ctx,
...
@@ -186,7 +186,7 @@ void Conv3dCooKernel(const Context& dev_ctx,
SparseCooTensor
*
out
,
SparseCooTensor
*
out
,
DenseTensor
*
rulebook
,
DenseTensor
*
rulebook
,
DenseTensor
*
counter
)
{
DenseTensor
*
counter
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"Conv3dCooCPUKernel"
,
([
&
]
{
x
.
non_zero_indices
().
dtype
(),
"Conv3dCooCPUKernel"
,
([
&
]
{
Conv3dCooCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
Conv3dCooCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
x
,
...
...
paddle/phi/kernels/sparse/cpu/elementwise_grad_kernel.cc
浏览文件 @
ab583173
...
@@ -236,7 +236,7 @@ void ElementWiseDivideCsrGradKernel(const Context& dev_ctx,
...
@@ -236,7 +236,7 @@ void ElementWiseDivideCsrGradKernel(const Context& dev_ctx,
const
SparseCsrTensor
&
dout
,
const
SparseCsrTensor
&
dout
,
SparseCsrTensor
*
dx
,
SparseCsrTensor
*
dx
,
SparseCsrTensor
*
dy
)
{
SparseCsrTensor
*
dy
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_crows
().
dtype
(),
"ElementWiseDivideCsrGradCPUKernel"
,
([
&
]
{
x
.
non_zero_crows
().
dtype
(),
"ElementWiseDivideCsrGradCPUKernel"
,
([
&
]
{
ElementWiseDivideCsrGradCPUKernel
<
T
,
data_t
>
(
ElementWiseDivideCsrGradCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
y
,
out
,
dout
,
dx
,
dy
);
dev_ctx
,
x
,
y
,
out
,
dout
,
dx
,
dy
);
...
@@ -250,7 +250,7 @@ void ElementWiseDivideCooGradKernel(const Context& dev_ctx,
...
@@ -250,7 +250,7 @@ void ElementWiseDivideCooGradKernel(const Context& dev_ctx,
const
SparseCooTensor
&
dout
,
const
SparseCooTensor
&
dout
,
SparseCooTensor
*
dx
,
SparseCooTensor
*
dx
,
SparseCooTensor
*
dy
)
{
SparseCooTensor
*
dy
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"ElementWiseDivideCooGradCPUKernel"
,
([
&
]
{
x
.
non_zero_indices
().
dtype
(),
"ElementWiseDivideCooGradCPUKernel"
,
([
&
]
{
ElementWiseDivideCooGradCPUKernel
<
T
,
data_t
>
(
ElementWiseDivideCooGradCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
y
,
out
,
dout
,
dx
,
dy
);
dev_ctx
,
x
,
y
,
out
,
dout
,
dx
,
dy
);
...
@@ -270,7 +270,8 @@ void ElementWiseDivideCooGradKernel(const Context& dev_ctx,
...
@@ -270,7 +270,8 @@ void ElementWiseDivideCooGradKernel(const Context& dev_ctx,
const SparseCsrTensor& dout, \
const SparseCsrTensor& dout, \
SparseCsrTensor* dx, \
SparseCsrTensor* dx, \
SparseCsrTensor* dy) { \
SparseCsrTensor* dy) { \
PD_VISIT_INTEGRAL_TYPES(x.non_zero_crows().dtype(), \
PD_VISIT_BASE_INTEGRAL_TYPES( \
x.non_zero_crows().dtype(), \
"ElementWise##name##CsrGradCPUKernel", \
"ElementWise##name##CsrGradCPUKernel", \
([&] { \
([&] { \
ElementWise##name##CsrGradCPUKernel<T, data_t>( \
ElementWise##name##CsrGradCPUKernel<T, data_t>( \
...
@@ -286,7 +287,8 @@ void ElementWiseDivideCooGradKernel(const Context& dev_ctx,
...
@@ -286,7 +287,8 @@ void ElementWiseDivideCooGradKernel(const Context& dev_ctx,
const SparseCooTensor& dout, \
const SparseCooTensor& dout, \
SparseCooTensor* dx, \
SparseCooTensor* dx, \
SparseCooTensor* dy) { \
SparseCooTensor* dy) { \
PD_VISIT_INTEGRAL_TYPES(x.non_zero_indices().dtype(), \
PD_VISIT_BASE_INTEGRAL_TYPES( \
x.non_zero_indices().dtype(), \
"ElementWise##name##CooGradCPUKernel", \
"ElementWise##name##CooGradCPUKernel", \
([&] { \
([&] { \
ElementWise##name##CooGradCPUKernel<T, data_t>( \
ElementWise##name##CooGradCPUKernel<T, data_t>( \
...
...
paddle/phi/kernels/sparse/cpu/elementwise_kernel.cc
浏览文件 @
ab583173
...
@@ -57,11 +57,12 @@ void Merge(const IntT el_len,
...
@@ -57,11 +57,12 @@ void Merge(const IntT el_len,
const
IntT
len_b_max
,
const
IntT
len_b_max
,
IntT
*
c_index
,
IntT
*
c_index
,
T
*
c_values
,
T
*
c_values
,
IntT
&
nnz
,
IntT
*
out_
nnz
,
const
Functor
&
functor_org
,
const
Functor
&
functor_org
,
const
bool
is_divide
)
{
const
bool
is_divide
)
{
IntT
a
=
0
;
IntT
a
=
0
;
IntT
b
=
0
;
IntT
b
=
0
;
IntT
&
nnz
=
(
*
out_nnz
);
nnz
=
0
;
nnz
=
0
;
const
IntT
*
b_index
=
nullptr
;
const
IntT
*
b_index
=
nullptr
;
std
::
vector
<
IntT
>
b_full_index
;
std
::
vector
<
IntT
>
b_full_index
;
...
@@ -94,9 +95,7 @@ void Merge(const IntT el_len,
...
@@ -94,9 +95,7 @@ void Merge(const IntT el_len,
}
}
++
a
;
++
a
;
++
b
;
++
b
;
}
}
else
if
(
a_index
[
a
]
<
b_index
[
b
])
{
// coordinate x[a] < coordinate y[b]
// coordinate x[a] < coordinate y[b]
else
if
(
a_index
[
a
]
<
b_index
[
b
])
{
if
(
!
functor
(
a_values
+
a
*
el_len
,
if
(
!
functor
(
a_values
+
a
*
el_len
,
zero
.
data
(),
zero
.
data
(),
c_values
+
nnz
*
el_len
,
c_values
+
nnz
*
el_len
,
...
@@ -105,9 +104,7 @@ void Merge(const IntT el_len,
...
@@ -105,9 +104,7 @@ void Merge(const IntT el_len,
++
nnz
;
++
nnz
;
}
}
++
a
;
++
a
;
}
}
else
if
(
a_index
[
a
]
>
b_index
[
b
])
{
// coordinate x[a] > coordinate y[b]
// coordinate x[a] > coordinate y[b]
else
if
(
a_index
[
a
]
>
b_index
[
b
])
{
if
(
!
functor
(
zero
.
data
(),
if
(
!
functor
(
zero
.
data
(),
b_values
[
b_index
[
b
]],
b_values
[
b_index
[
b
]],
c_values
+
nnz
*
el_len
,
c_values
+
nnz
*
el_len
,
...
@@ -215,7 +212,7 @@ void ElementWiseCooKernelImpl(const Context& dev_ctx,
...
@@ -215,7 +212,7 @@ void ElementWiseCooKernelImpl(const Context& dev_ctx,
max_len
,
max_len
,
out_indexs
.
data
(),
out_indexs
.
data
(),
out_values_vec
.
data
(),
out_values_vec
.
data
(),
nnz
,
&
nnz
,
functor
,
functor
,
is_divide
);
is_divide
);
...
@@ -292,7 +289,7 @@ void ElementWiseCooKernelImpl(const Context& dev_ctx,
...
@@ -292,7 +289,7 @@ void ElementWiseCooKernelImpl(const Context& dev_ctx,
const SparseCsrTensor& x, \
const SparseCsrTensor& x, \
const SparseCsrTensor& y, \
const SparseCsrTensor& y, \
SparseCsrTensor* out) { \
SparseCsrTensor* out) { \
PD_VISIT_
INTEGRAL_TYPES(
\
PD_VISIT_
BASE_INTEGRAL_TYPES(
\
x.non_zero_crows().dtype(), "ElementWise##name##CsrCPUKernel", ([&] { \
x.non_zero_crows().dtype(), "ElementWise##name##CsrCPUKernel", ([&] { \
ElementWise##name##CsrCPUKernel<T, data_t>(dev_ctx, x, y, out); \
ElementWise##name##CsrCPUKernel<T, data_t>(dev_ctx, x, y, out); \
})); \
})); \
...
@@ -315,7 +312,7 @@ void ElementWiseCooKernelImpl(const Context& dev_ctx,
...
@@ -315,7 +312,7 @@ void ElementWiseCooKernelImpl(const Context& dev_ctx,
const SparseCooTensor& x, \
const SparseCooTensor& x, \
const SparseCooTensor& y, \
const SparseCooTensor& y, \
SparseCooTensor* out) { \
SparseCooTensor* out) { \
PD_VISIT_INTEGRAL_TYPES(x.non_zero_indices().dtype(), \
PD_VISIT_
BASE_
INTEGRAL_TYPES(x.non_zero_indices().dtype(), \
"ElementWise##name##CooCPUKernel", \
"ElementWise##name##CooCPUKernel", \
([&] { \
([&] { \
ElementWise##name##CooCPUKernel<T, data_t>( \
ElementWise##name##CooCPUKernel<T, data_t>( \
...
...
paddle/phi/kernels/sparse/cpu/mask_kernel.cc
浏览文件 @
ab583173
...
@@ -79,7 +79,7 @@ void SparseMaskKernel(const Context& dev_ctx,
...
@@ -79,7 +79,7 @@ void SparseMaskKernel(const Context& dev_ctx,
const
DenseTensor
&
x
,
const
DenseTensor
&
x
,
const
SparseCooTensor
&
mask
,
const
SparseCooTensor
&
mask
,
SparseCooTensor
*
out
)
{
SparseCooTensor
*
out
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
mask
.
non_zero_indices
().
dtype
(),
"SparseMaskCPUKernel"
,
([
&
]
{
mask
.
non_zero_indices
().
dtype
(),
"SparseMaskCPUKernel"
,
([
&
]
{
SparseMaskCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
mask
,
out
);
SparseMaskCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
mask
,
out
);
}));
}));
...
@@ -146,7 +146,7 @@ void SparseMaskHelperKernel(const Context& dev_ctx,
...
@@ -146,7 +146,7 @@ void SparseMaskHelperKernel(const Context& dev_ctx,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
const
DenseTensor
&
mask_indices
,
const
DenseTensor
&
mask_indices
,
DenseTensor
*
out
)
{
DenseTensor
*
out
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"SparseMaskHelperCPUKernel"
,
([
&
]
{
x
.
non_zero_indices
().
dtype
(),
"SparseMaskHelperCPUKernel"
,
([
&
]
{
SparseMaskHelperCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
mask_indices
,
out
);
SparseMaskHelperCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
mask_indices
,
out
);
}));
}));
...
...
paddle/phi/kernels/sparse/cpu/pool_grad_kernel.cc
浏览文件 @
ab583173
...
@@ -83,7 +83,7 @@ void MaxPoolCooGradKernel(const Context& dev_ctx,
...
@@ -83,7 +83,7 @@ void MaxPoolCooGradKernel(const Context& dev_ctx,
const
SparseCooTensor
&
out_grad
,
const
SparseCooTensor
&
out_grad
,
const
std
::
vector
<
int
>&
kernel_sizes
,
const
std
::
vector
<
int
>&
kernel_sizes
,
SparseCooTensor
*
x_grad
)
{
SparseCooTensor
*
x_grad
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"MaxPoolCooGradCPUKernel"
,
([
&
]
{
x
.
non_zero_indices
().
dtype
(),
"MaxPoolCooGradCPUKernel"
,
([
&
]
{
MaxPoolCooGradCPUKernel
<
T
,
data_t
>
(
MaxPoolCooGradCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
rulebook
,
counter
,
out
,
out_grad
,
kernel_sizes
,
x_grad
);
dev_ctx
,
x
,
rulebook
,
counter
,
out
,
out_grad
,
kernel_sizes
,
x_grad
);
...
...
paddle/phi/kernels/sparse/cpu/pool_kernel.cc
浏览文件 @
ab583173
...
@@ -109,7 +109,7 @@ void MaxPoolCooKernel(const Context& dev_ctx,
...
@@ -109,7 +109,7 @@ void MaxPoolCooKernel(const Context& dev_ctx,
SparseCooTensor
*
out
,
SparseCooTensor
*
out
,
DenseTensor
*
rulebook
,
DenseTensor
*
rulebook
,
DenseTensor
*
counter
)
{
DenseTensor
*
counter
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"MaxPoolCooCPUKernel"
,
([
&
]
{
x
.
non_zero_indices
().
dtype
(),
"MaxPoolCooCPUKernel"
,
([
&
]
{
MaxPoolCooCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
MaxPoolCooCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
x
,
...
...
paddle/phi/kernels/sparse/cpu/softmax_grad_kernel.cc
浏览文件 @
ab583173
...
@@ -62,7 +62,7 @@ void SoftmaxCsrGradKernel(const Context& dev_ctx,
...
@@ -62,7 +62,7 @@ void SoftmaxCsrGradKernel(const Context& dev_ctx,
T
*
dx_data
=
dx_values
->
data
<
T
>
();
T
*
dx_data
=
dx_values
->
data
<
T
>
();
// dx = (dout - sum(dout * out)) * out
// dx = (dout - sum(dout * out)) * out
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
out
.
non_zero_crows
().
dtype
(),
"SoftmaxCsrGradKernel"
,
([
&
]
{
out
.
non_zero_crows
().
dtype
(),
"SoftmaxCsrGradKernel"
,
([
&
]
{
const
data_t
*
out_crows_data
=
out_crows
.
data
<
data_t
>
();
const
data_t
*
out_crows_data
=
out_crows
.
data
<
data_t
>
();
for
(
int
i
=
0
;
i
<
batch_size
;
++
i
)
{
for
(
int
i
=
0
;
i
<
batch_size
;
++
i
)
{
...
...
paddle/phi/kernels/sparse/cpu/softmax_kernel.cc
浏览文件 @
ab583173
...
@@ -60,7 +60,7 @@ void SoftmaxCsrKernel(const Context& dev_ctx,
...
@@ -60,7 +60,7 @@ void SoftmaxCsrKernel(const Context& dev_ctx,
T
*
out_data
=
out_values
->
data
<
T
>
();
T
*
out_data
=
out_values
->
data
<
T
>
();
// out = exp(x-x_max) / sum( exp(x-x_max ))
// out = exp(x-x_max) / sum( exp(x-x_max ))
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_crows
().
dtype
(),
"CsrSoftmaxKernel"
,
([
&
]
{
x
.
non_zero_crows
().
dtype
(),
"CsrSoftmaxKernel"
,
([
&
]
{
const
data_t
*
x_crows_data
=
x_crows
.
data
<
data_t
>
();
const
data_t
*
x_crows_data
=
x_crows
.
data
<
data_t
>
();
for
(
int
i
=
0
;
i
<
batch_size
;
++
i
)
{
for
(
int
i
=
0
;
i
<
batch_size
;
++
i
)
{
...
...
paddle/phi/kernels/sparse/cpu/sparse_utils_kernel.cc
浏览文件 @
ab583173
...
@@ -160,7 +160,7 @@ template <typename T, typename Context>
...
@@ -160,7 +160,7 @@ template <typename T, typename Context>
void
SparseCsrToCooKernel
(
const
Context
&
dev_ctx
,
void
SparseCsrToCooKernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
const
SparseCsrTensor
&
x
,
SparseCooTensor
*
out
)
{
SparseCooTensor
*
out
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_crows
().
dtype
(),
"SparseCsrToCooCPUKernel"
,
([
&
]
{
x
.
non_zero_crows
().
dtype
(),
"SparseCsrToCooCPUKernel"
,
([
&
]
{
SparseCsrToCooCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
SparseCsrToCooCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
}));
}));
...
@@ -250,7 +250,7 @@ template <typename T, typename Context>
...
@@ -250,7 +250,7 @@ template <typename T, typename Context>
void
SparseCooToCsrKernel
(
const
Context
&
dev_ctx
,
void
SparseCooToCsrKernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
SparseCsrTensor
*
out
)
{
SparseCsrTensor
*
out
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"SparseCooToCsrCPUKernel"
,
([
&
]
{
x
.
non_zero_indices
().
dtype
(),
"SparseCooToCsrCPUKernel"
,
([
&
]
{
SparseCooToCsrCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
SparseCooToCsrCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
}));
}));
...
@@ -304,7 +304,7 @@ template <typename T, typename Context>
...
@@ -304,7 +304,7 @@ template <typename T, typename Context>
void
SparseCooToDenseKernel
(
const
Context
&
dev_ctx
,
void
SparseCooToDenseKernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
DenseTensor
*
out
)
{
DenseTensor
*
out
)
{
PD_VISIT_INTEGRAL_TYPES
(
PD_VISIT_
BASE_
INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"SparseCooToDenseCPUKernel"
,
([
&
]
{
x
.
non_zero_indices
().
dtype
(),
"SparseCooToDenseCPUKernel"
,
([
&
]
{
SparseCooToDenseCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
SparseCooToDenseCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
}));
}));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录