Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
a9cc5482
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看板
未验证
提交
a9cc5482
编写于
10月 12, 2022
作者:
Z
zhangkaihuo
提交者:
GitHub
10月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Sparse] Rename and fix doc (#46853)
上级
fe716a0b
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
69 addition
and
67 deletion
+69
-67
paddle/phi/api/yaml/sparse_backward.yaml
paddle/phi/api/yaml/sparse_backward.yaml
+2
-2
paddle/phi/api/yaml/sparse_ops.yaml
paddle/phi/api/yaml/sparse_ops.yaml
+6
-6
paddle/phi/kernels/sparse/coalesce_kernel.h
paddle/phi/kernels/sparse/coalesce_kernel.h
+5
-5
paddle/phi/kernels/sparse/cpu/coalesce_kernel.cc
paddle/phi/kernels/sparse/cpu/coalesce_kernel.cc
+12
-11
paddle/phi/kernels/sparse/cpu/full_kernel.cc
paddle/phi/kernels/sparse/cpu/full_kernel.cc
+6
-6
paddle/phi/kernels/sparse/cpu/unary_kernel.cc
paddle/phi/kernels/sparse/cpu/unary_kernel.cc
+6
-6
paddle/phi/kernels/sparse/full_kernel.h
paddle/phi/kernels/sparse/full_kernel.h
+2
-2
paddle/phi/kernels/sparse/gpu/coalesce_kernel.cu
paddle/phi/kernels/sparse/gpu/coalesce_kernel.cu
+12
-11
paddle/phi/kernels/sparse/gpu/full_kernel.cu
paddle/phi/kernels/sparse/gpu/full_kernel.cu
+6
-6
paddle/phi/kernels/sparse/gpu/unary_kernel.cu
paddle/phi/kernels/sparse/gpu/unary_kernel.cu
+6
-6
paddle/phi/kernels/sparse/unary_kernel.h
paddle/phi/kernels/sparse/unary_kernel.h
+2
-2
paddle/phi/tests/kernels/test_sparse_conv3d_dev_api.cc
paddle/phi/tests/kernels/test_sparse_conv3d_dev_api.cc
+1
-1
paddle/phi/tests/kernels/test_sparse_pool_dev_api.cc
paddle/phi/tests/kernels/test_sparse_pool_dev_api.cc
+1
-1
python/paddle/incubate/sparse/nn/layer/conv.py
python/paddle/incubate/sparse/nn/layer/conv.py
+2
-2
未找到文件。
paddle/phi/api/yaml/sparse_backward.yaml
浏览文件 @
a9cc5482
...
@@ -124,8 +124,8 @@
...
@@ -124,8 +124,8 @@
cast_csr_grad {sparse_csr, sparse_csr -> sparse_csr}
cast_csr_grad {sparse_csr, sparse_csr -> sparse_csr}
data_type
:
out_grad
data_type
:
out_grad
-
backward_op
:
conv3d_
coo_
grad
-
backward_op
:
conv3d_grad
forward
:
conv3d
_coo
(Tensor x, Tensor kernel, int[] paddings, int[] dilations, int[] strides, int groups, bool subm, str key) -> Tensor(out), Tensor(rulebook), Tensor(counter)
forward
:
conv3d (Tensor x, Tensor kernel, int[] paddings, int[] dilations, int[] strides, int groups, bool subm, str key) -> Tensor(out), Tensor(rulebook), Tensor(counter)
args
:
(Tensor x, Tensor kernel, Tensor out, Tensor rulebook, Tensor counter, Tensor out_grad, int[] paddings, int[] dilations, int[] strides, int groups, bool subm, str key)
args
:
(Tensor x, Tensor kernel, Tensor out, Tensor rulebook, Tensor counter, Tensor out_grad, int[] paddings, int[] dilations, int[] strides, int groups, bool subm, str key)
output
:
Tensor(x_grad), Tensor(kernel_grad)
output
:
Tensor(x_grad), Tensor(kernel_grad)
infer_meta
:
infer_meta
:
...
...
paddle/phi/api/yaml/sparse_ops.yaml
浏览文件 @
a9cc5482
...
@@ -119,7 +119,7 @@
...
@@ -119,7 +119,7 @@
func
:
conv3d_coo{sparse_coo, dense -> sparse_coo, dense, dense}
func
:
conv3d_coo{sparse_coo, dense -> sparse_coo, dense, dense}
layout
:
x
layout
:
x
intermediate
:
rulebook, counter
intermediate
:
rulebook, counter
backward
:
conv3d_
coo_
grad
backward
:
conv3d_grad
-
op
:
divide
-
op
:
divide
args
:
(Tensor x, Tensor y)
args
:
(Tensor x, Tensor y)
...
@@ -139,8 +139,8 @@
...
@@ -139,8 +139,8 @@
func
:
UnchangedInferMeta
func
:
UnchangedInferMeta
param
:
[
x
]
param
:
[
x
]
kernel
:
kernel
:
func
:
divide_
coo_scalar
{sparse_coo -> sparse_coo},
func
:
divide_
scalar_coo
{sparse_coo -> sparse_coo},
divide_
csr_scala
r{sparse_csr -> sparse_csr}
divide_
scalar_cs
r{sparse_csr -> sparse_csr}
backward
:
divide_scalar_grad
backward
:
divide_scalar_grad
-
op
:
expm1
-
op
:
expm1
...
@@ -393,7 +393,7 @@
...
@@ -393,7 +393,7 @@
infer_meta
:
infer_meta
:
func
:
UnchangedInferMeta
func
:
UnchangedInferMeta
kernel
:
kernel
:
func
:
coalesce{sparse_coo -> sparse_coo}
func
:
coalesce
_coo
{sparse_coo -> sparse_coo}
layout
:
x
layout
:
x
-
op
:
full_like
-
op
:
full_like
...
@@ -403,8 +403,8 @@
...
@@ -403,8 +403,8 @@
func
:
CreateLikeInferMeta
func
:
CreateLikeInferMeta
param
:
[
x
,
dtype
]
param
:
[
x
,
dtype
]
kernel
:
kernel
:
func
:
coo_full_like
{sparse_coo -> sparse_coo},
func
:
full_like_coo
{sparse_coo -> sparse_coo},
csr_full_like
{sparse_csr -> sparse_csr}
full_like_csr
{sparse_csr -> sparse_csr}
layout
:
x
layout
:
x
data_type
:
dtype
data_type
:
dtype
...
...
paddle/phi/kernels/sparse/coalesce_kernel.h
浏览文件 @
a9cc5482
...
@@ -22,14 +22,14 @@ namespace phi {
...
@@ -22,14 +22,14 @@ namespace phi {
namespace
sparse
{
namespace
sparse
{
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
CoalesceKernel
(
const
Context
&
dev_ctx
,
void
Coalesce
Coo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
);
SparseCooTensor
*
out
);
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
SparseCooTensor
Coalesce
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
)
{
SparseCooTensor
Coalesce
Coo
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
)
{
SparseCooTensor
coo
;
SparseCooTensor
coo
;
CoalesceKernel
<
T
,
Context
>
(
dev_ctx
,
x
,
&
coo
);
Coalesce
Coo
Kernel
<
T
,
Context
>
(
dev_ctx
,
x
,
&
coo
);
return
coo
;
return
coo
;
}
}
...
...
paddle/phi/kernels/sparse/cpu/coalesce_kernel.cc
浏览文件 @
a9cc5482
...
@@ -22,9 +22,9 @@ namespace phi {
...
@@ -22,9 +22,9 @@ namespace phi {
namespace
sparse
{
namespace
sparse
{
template
<
typename
T
,
typename
IntT
>
template
<
typename
T
,
typename
IntT
>
void
CoalesceCPUKernel
(
const
CPUContext
&
dev_ctx
,
void
CoalesceC
ooC
PUKernel
(
const
CPUContext
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
)
{
SparseCooTensor
*
out
)
{
const
DenseTensor
&
x_indices
=
x
.
indices
();
const
DenseTensor
&
x_indices
=
x
.
indices
();
const
DenseTensor
&
x_values
=
x
.
values
();
const
DenseTensor
&
x_values
=
x
.
values
();
DenseTensor
out_indices
=
phi
::
EmptyLike
<
IntT
>
(
dev_ctx
,
x_indices
);
DenseTensor
out_indices
=
phi
::
EmptyLike
<
IntT
>
(
dev_ctx
,
x_indices
);
...
@@ -95,21 +95,22 @@ void CoalesceCPUKernel(const CPUContext& dev_ctx,
...
@@ -95,21 +95,22 @@ void CoalesceCPUKernel(const CPUContext& dev_ctx,
}
}
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
CoalesceKernel
(
const
Context
&
dev_ctx
,
void
CoalesceCooKernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
)
{
SparseCooTensor
*
out
)
{
PD_VISIT_BASE_INTEGRAL_TYPES
(
x
.
indices
().
dtype
(),
"CoalesceCPUKernel"
,
([
&
]
{
PD_VISIT_BASE_INTEGRAL_TYPES
(
CoalesceCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
x
.
indices
().
dtype
(),
"CoalesceCooCPUKernel"
,
([
&
]
{
}));
CoalesceCooCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
}));
}
}
}
// namespace sparse
}
// namespace sparse
}
// namespace phi
}
// namespace phi
PD_REGISTER_KERNEL
(
coalesce
,
PD_REGISTER_KERNEL
(
coalesce
_coo
,
CPU
,
CPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
sparse
::
CoalesceKernel
,
phi
::
sparse
::
Coalesce
Coo
Kernel
,
float
,
float
,
double
,
double
,
phi
::
dtype
::
float16
,
phi
::
dtype
::
float16
,
...
...
paddle/phi/kernels/sparse/cpu/full_kernel.cc
浏览文件 @
a9cc5482
...
@@ -31,7 +31,7 @@ void FullValue(const Context& dev_ctx, DenseTensor* tensor, T val) {
...
@@ -31,7 +31,7 @@ void FullValue(const Context& dev_ctx, DenseTensor* tensor, T val) {
}
}
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
CooFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
const
Scalar
&
val
,
const
Scalar
&
val
,
DataType
dtype
,
DataType
dtype
,
...
@@ -51,7 +51,7 @@ void CooFullLikeKernel(const Context& dev_ctx,
...
@@ -51,7 +51,7 @@ void CooFullLikeKernel(const Context& dev_ctx,
}
}
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
CsrFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCsr
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
const
SparseCsrTensor
&
x
,
const
Scalar
&
val
,
const
Scalar
&
val
,
DataType
dtype
,
DataType
dtype
,
...
@@ -78,10 +78,10 @@ void CsrFullLikeKernel(const Context& dev_ctx,
...
@@ -78,10 +78,10 @@ void CsrFullLikeKernel(const Context& dev_ctx,
}
// namespace phi
}
// namespace phi
PD_REGISTER_KERNEL
(
coo_full_like
,
PD_REGISTER_KERNEL
(
full_like_coo
,
CPU
,
CPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
CooFullLike
Kernel
,
phi
::
FullLikeCoo
Kernel
,
float
,
float
,
double
,
double
,
uint8_t
,
uint8_t
,
...
@@ -96,10 +96,10 @@ PD_REGISTER_KERNEL(coo_full_like,
...
@@ -96,10 +96,10 @@ PD_REGISTER_KERNEL(coo_full_like,
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
}
}
PD_REGISTER_KERNEL
(
csr_full_like
,
PD_REGISTER_KERNEL
(
full_like_csr
,
CPU
,
CPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
CsrFullLike
Kernel
,
phi
::
FullLikeCsr
Kernel
,
float
,
float
,
double
,
double
,
uint8_t
,
uint8_t
,
...
...
paddle/phi/kernels/sparse/cpu/unary_kernel.cc
浏览文件 @
a9cc5482
...
@@ -25,7 +25,7 @@ namespace phi {
...
@@ -25,7 +25,7 @@ namespace phi {
namespace
sparse
{
namespace
sparse
{
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
Div
CooScalar
Kernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
float
scalar
,
float
scalar
,
SparseCooTensor
*
out
)
{
SparseCooTensor
*
out
)
{
...
@@ -41,7 +41,7 @@ void DivCooScalarKernel(const Context& dev_ctx,
...
@@ -41,7 +41,7 @@ void DivCooScalarKernel(const Context& dev_ctx,
}
}
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
Div
CsrScala
rKernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCs
rKernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
const
SparseCsrTensor
&
x
,
float
scalar
,
float
scalar
,
SparseCsrTensor
*
out
)
{
SparseCsrTensor
*
out
)
{
...
@@ -97,19 +97,19 @@ PD_REGISTER_SPARSE_UNARY_CPU_KERNEL(expm1, Expm1)
...
@@ -97,19 +97,19 @@ PD_REGISTER_SPARSE_UNARY_CPU_KERNEL(expm1, Expm1)
PD_REGISTER_SPARSE_UNARY_CPU_KERNEL
(
relu6
,
Relu6
)
PD_REGISTER_SPARSE_UNARY_CPU_KERNEL
(
relu6
,
Relu6
)
PD_REGISTER_SPARSE_UNARY_CPU_KERNEL
(
leaky_relu
,
LeakyRelu
)
PD_REGISTER_SPARSE_UNARY_CPU_KERNEL
(
leaky_relu
,
LeakyRelu
)
PD_REGISTER_KERNEL
(
divide_
coo_scalar
,
PD_REGISTER_KERNEL
(
divide_
scalar_coo
,
CPU
,
CPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
sparse
::
Div
CooScalar
Kernel
,
phi
::
sparse
::
Div
ScalarCoo
Kernel
,
float
,
float
,
double
)
{
double
)
{
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
}
}
PD_REGISTER_KERNEL
(
divide_
csr_scala
r
,
PD_REGISTER_KERNEL
(
divide_
scalar_cs
r
,
CPU
,
CPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
sparse
::
Div
CsrScala
rKernel
,
phi
::
sparse
::
Div
ScalarCs
rKernel
,
float
,
float
,
double
)
{
double
)
{
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_CSR
);
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_CSR
);
...
...
paddle/phi/kernels/sparse/full_kernel.h
浏览文件 @
a9cc5482
...
@@ -22,14 +22,14 @@
...
@@ -22,14 +22,14 @@
namespace
phi
{
namespace
phi
{
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
CooFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
const
Scalar
&
val
,
const
Scalar
&
val
,
DataType
dtype
,
DataType
dtype
,
SparseCooTensor
*
out
);
SparseCooTensor
*
out
);
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
CsrFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCsr
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
const
SparseCsrTensor
&
x
,
const
Scalar
&
val
,
const
Scalar
&
val
,
DataType
dtype
,
DataType
dtype
,
...
...
paddle/phi/kernels/sparse/gpu/coalesce_kernel.cu
浏览文件 @
a9cc5482
...
@@ -27,9 +27,9 @@ namespace phi {
...
@@ -27,9 +27,9 @@ namespace phi {
namespace
sparse
{
namespace
sparse
{
template
<
typename
T
,
typename
IntT
>
template
<
typename
T
,
typename
IntT
>
void
CoalesceGPUKernel
(
const
GPUContext
&
dev_ctx
,
void
Coalesce
Coo
GPUKernel
(
const
GPUContext
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
)
{
SparseCooTensor
*
out
)
{
const
DenseTensor
&
x_indices
=
x
.
indices
();
const
DenseTensor
&
x_indices
=
x
.
indices
();
const
DenseTensor
&
x_values
=
x
.
values
();
const
DenseTensor
&
x_values
=
x
.
values
();
DenseTensor
out_indices
=
phi
::
EmptyLike
<
IntT
>
(
dev_ctx
,
x_indices
);
DenseTensor
out_indices
=
phi
::
EmptyLike
<
IntT
>
(
dev_ctx
,
x_indices
);
...
@@ -172,20 +172,21 @@ void CoalesceGPUKernel(const GPUContext& dev_ctx,
...
@@ -172,20 +172,21 @@ void CoalesceGPUKernel(const GPUContext& dev_ctx,
}
}
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
CoalesceKernel
(
const
Context
&
dev_ctx
,
void
CoalesceCooKernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
)
{
SparseCooTensor
*
out
)
{
PD_VISIT_BASE_INTEGRAL_TYPES
(
x
.
indices
().
dtype
(),
"CoalesceGPUKernel"
,
([
&
]
{
PD_VISIT_BASE_INTEGRAL_TYPES
(
CoalesceGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
x
.
indices
().
dtype
(),
"CoalesceCooGPUKernel"
,
([
&
]
{
}));
CoalesceCooGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
}));
}
}
}
// namespace sparse
}
// namespace sparse
}
// namespace phi
}
// namespace phi
PD_REGISTER_KERNEL
(
coalesce
,
PD_REGISTER_KERNEL
(
coalesce
_coo
,
GPU
,
GPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
sparse
::
CoalesceKernel
,
phi
::
sparse
::
Coalesce
Coo
Kernel
,
float
,
float
,
double
,
double
,
phi
::
dtype
::
float16
,
phi
::
dtype
::
float16
,
...
...
paddle/phi/kernels/sparse/gpu/full_kernel.cu
浏览文件 @
a9cc5482
...
@@ -37,7 +37,7 @@ struct FullFunctor {
...
@@ -37,7 +37,7 @@ struct FullFunctor {
};
};
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
CooFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
const
Scalar
&
val
,
const
Scalar
&
val
,
DataType
dtype
,
DataType
dtype
,
...
@@ -60,7 +60,7 @@ void CooFullLikeKernel(const Context& dev_ctx,
...
@@ -60,7 +60,7 @@ void CooFullLikeKernel(const Context& dev_ctx,
}
}
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
CsrFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCsr
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
const
SparseCsrTensor
&
x
,
const
Scalar
&
val
,
const
Scalar
&
val
,
DataType
dtype
,
DataType
dtype
,
...
@@ -87,10 +87,10 @@ void CsrFullLikeKernel(const Context& dev_ctx,
...
@@ -87,10 +87,10 @@ void CsrFullLikeKernel(const Context& dev_ctx,
}
// namespace phi
}
// namespace phi
PD_REGISTER_KERNEL
(
coo_full_like
,
PD_REGISTER_KERNEL
(
full_like_coo
,
GPU
,
GPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
CooFullLike
Kernel
,
phi
::
FullLikeCoo
Kernel
,
float
,
float
,
double
,
double
,
uint8_t
,
uint8_t
,
...
@@ -105,10 +105,10 @@ PD_REGISTER_KERNEL(coo_full_like,
...
@@ -105,10 +105,10 @@ PD_REGISTER_KERNEL(coo_full_like,
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
}
}
PD_REGISTER_KERNEL
(
csr_full_like
,
PD_REGISTER_KERNEL
(
full_like_csr
,
GPU
,
GPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
CsrFullLike
Kernel
,
phi
::
FullLikeCsr
Kernel
,
float
,
float
,
double
,
double
,
uint8_t
,
uint8_t
,
...
...
paddle/phi/kernels/sparse/gpu/unary_kernel.cu
浏览文件 @
a9cc5482
...
@@ -34,7 +34,7 @@ struct DivScalarFunctor {
...
@@ -34,7 +34,7 @@ struct DivScalarFunctor {
};
};
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
Div
CooScalar
Kernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
float
scalar
,
float
scalar
,
SparseCooTensor
*
out
)
{
SparseCooTensor
*
out
)
{
...
@@ -47,7 +47,7 @@ void DivCooScalarKernel(const Context& dev_ctx,
...
@@ -47,7 +47,7 @@ void DivCooScalarKernel(const Context& dev_ctx,
}
}
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
Div
CsrScala
rKernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCs
rKernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
const
SparseCsrTensor
&
x
,
float
scalar
,
float
scalar
,
SparseCsrTensor
*
out
)
{
SparseCsrTensor
*
out
)
{
...
@@ -102,19 +102,19 @@ PD_REGISTER_SPARSE_UNARY_GPU_KERNEL(expm1, Expm1)
...
@@ -102,19 +102,19 @@ PD_REGISTER_SPARSE_UNARY_GPU_KERNEL(expm1, Expm1)
PD_REGISTER_SPARSE_UNARY_GPU_KERNEL
(
relu6
,
Relu6
)
PD_REGISTER_SPARSE_UNARY_GPU_KERNEL
(
relu6
,
Relu6
)
PD_REGISTER_SPARSE_UNARY_GPU_KERNEL
(
leaky_relu
,
LeakyRelu
)
PD_REGISTER_SPARSE_UNARY_GPU_KERNEL
(
leaky_relu
,
LeakyRelu
)
PD_REGISTER_KERNEL
(
divide_
coo_scalar
,
PD_REGISTER_KERNEL
(
divide_
scalar_coo
,
GPU
,
GPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
sparse
::
Div
CooScalar
Kernel
,
phi
::
sparse
::
Div
ScalarCoo
Kernel
,
float
,
float
,
double
)
{
double
)
{
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
}
}
PD_REGISTER_KERNEL
(
divide_
csr_scala
r
,
PD_REGISTER_KERNEL
(
divide_
scalar_cs
r
,
GPU
,
GPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
sparse
::
Div
CsrScala
rKernel
,
phi
::
sparse
::
Div
ScalarCs
rKernel
,
float
,
float
,
double
)
{
double
)
{
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_CSR
);
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_CSR
);
...
...
paddle/phi/kernels/sparse/unary_kernel.h
浏览文件 @
a9cc5482
...
@@ -74,13 +74,13 @@ void ScaleCsrKernel(const Context& dev_ctx,
...
@@ -74,13 +74,13 @@ void ScaleCsrKernel(const Context& dev_ctx,
SparseCsrTensor
*
out
);
SparseCsrTensor
*
out
);
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
Div
CooScalar
Kernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
SparseCooTensor
&
x
,
float
scalar
,
float
scalar
,
SparseCooTensor
*
out
);
SparseCooTensor
*
out
);
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
void
Div
CsrScala
rKernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCs
rKernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
const
SparseCsrTensor
&
x
,
float
scalar
,
float
scalar
,
SparseCsrTensor
*
out
);
SparseCsrTensor
*
out
);
...
...
paddle/phi/tests/kernels/test_sparse_conv3d_dev_api.cc
浏览文件 @
a9cc5482
...
@@ -212,7 +212,7 @@ void TestConv3dBase(const std::vector<IntT>& indices,
...
@@ -212,7 +212,7 @@ void TestConv3dBase(const std::vector<IntT>& indices,
"Conv3d"
,
"Conv3d"
,
&
d_rulebook
,
&
d_rulebook
,
&
d_counter
);
&
d_counter
);
SparseCooTensor
tmp_d_out
=
sparse
::
Coalesce
<
T
>
(
dev_ctx_gpu
,
d_out
);
SparseCooTensor
tmp_d_out
=
sparse
::
Coalesce
Coo
<
T
>
(
dev_ctx_gpu
,
d_out
);
ASSERT_EQ
(
correct_out_dims
.
size
(),
d_out
.
dims
().
size
());
ASSERT_EQ
(
correct_out_dims
.
size
(),
d_out
.
dims
().
size
());
ASSERT_EQ
((
int64_t
)
correct_out_features
.
size
()
/
out_channels
,
d_out
.
nnz
());
ASSERT_EQ
((
int64_t
)
correct_out_features
.
size
()
/
out_channels
,
d_out
.
nnz
());
...
...
paddle/phi/tests/kernels/test_sparse_pool_dev_api.cc
浏览文件 @
a9cc5482
...
@@ -161,7 +161,7 @@ void TestMaxPoolBase(const std::vector<IntT>& indices,
...
@@ -161,7 +161,7 @@ void TestMaxPoolBase(const std::vector<IntT>& indices,
&
d_rulebook
,
&
d_rulebook
,
&
d_counter
);
&
d_counter
);
SparseCooTensor
tmp_d_out
=
sparse
::
Coalesce
<
T
>
(
dev_ctx_gpu
,
d_out
);
SparseCooTensor
tmp_d_out
=
sparse
::
Coalesce
Coo
<
T
>
(
dev_ctx_gpu
,
d_out
);
ASSERT_EQ
(
correct_out_dims
.
size
(),
d_out
.
dims
().
size
());
ASSERT_EQ
(
correct_out_dims
.
size
(),
d_out
.
dims
().
size
());
ASSERT_EQ
((
int64_t
)
correct_out_features
.
size
()
/
out_channels
,
d_out
.
nnz
());
ASSERT_EQ
((
int64_t
)
correct_out_features
.
size
()
/
out_channels
,
d_out
.
nnz
());
...
...
python/paddle/incubate/sparse/nn/layer/conv.py
浏览文件 @
a9cc5482
...
@@ -144,7 +144,7 @@ class Conv3D(_Conv3D):
...
@@ -144,7 +144,7 @@ class Conv3D(_Conv3D):
Parameters:
Parameters:
in_channels(int): The number of input channels in the input image.
in_channels(int): The number of input channels in the input image.
out_channels(int): The number of output channels produced by the convolution.
out_channels(int): The number of output channels produced by the convolution.
kernel_size(int|list|tuple
, optional
): The size of the convolving kernel.
kernel_size(int|list|tuple): The size of the convolving kernel.
stride(int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
stride(int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
contain three integers, (stride_D, stride_H, stride_W). Otherwise, the
contain three integers, (stride_D, stride_H, stride_W). Otherwise, the
stride_D = stride_H = stride_W = stride. The default value is 1.
stride_D = stride_H = stride_W = stride. The default value is 1.
...
@@ -277,7 +277,7 @@ class SubmConv3D(_Conv3D):
...
@@ -277,7 +277,7 @@ class SubmConv3D(_Conv3D):
Parameters:
Parameters:
in_channels(int): The number of input channels in the input image.
in_channels(int): The number of input channels in the input image.
out_channels(int): The number of output channels produced by the convolution.
out_channels(int): The number of output channels produced by the convolution.
kernel_size(int|list|tuple
, optional
): The size of the convolving kernel.
kernel_size(int|list|tuple): The size of the convolving kernel.
stride(int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
stride(int|list|tuple, optional): The stride size. If stride is a list/tuple, it must
contain three integers, (stride_D, stride_H, stride_W). Otherwise, the
contain three integers, (stride_D, stride_H, stride_W). Otherwise, the
stride_D = stride_H = stride_W = stride. The default value is 1.
stride_D = stride_H = stride_W = stride. The default value is 1.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录