Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
a9cc5482
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看板
未验证
提交
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 @@
cast_csr_grad {sparse_csr, sparse_csr -> sparse_csr}
data_type
:
out_grad
-
backward_op
:
conv3d_
coo_
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)
-
backward_op
:
conv3d_grad
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)
output
:
Tensor(x_grad), Tensor(kernel_grad)
infer_meta
:
...
...
paddle/phi/api/yaml/sparse_ops.yaml
浏览文件 @
a9cc5482
...
...
@@ -119,7 +119,7 @@
func
:
conv3d_coo{sparse_coo, dense -> sparse_coo, dense, dense}
layout
:
x
intermediate
:
rulebook, counter
backward
:
conv3d_
coo_
grad
backward
:
conv3d_grad
-
op
:
divide
args
:
(Tensor x, Tensor y)
...
...
@@ -139,8 +139,8 @@
func
:
UnchangedInferMeta
param
:
[
x
]
kernel
:
func
:
divide_
coo_scalar
{sparse_coo -> sparse_coo},
divide_
csr_scala
r{sparse_csr -> sparse_csr}
func
:
divide_
scalar_coo
{sparse_coo -> sparse_coo},
divide_
scalar_cs
r{sparse_csr -> sparse_csr}
backward
:
divide_scalar_grad
-
op
:
expm1
...
...
@@ -393,7 +393,7 @@
infer_meta
:
func
:
UnchangedInferMeta
kernel
:
func
:
coalesce{sparse_coo -> sparse_coo}
func
:
coalesce
_coo
{sparse_coo -> sparse_coo}
layout
:
x
-
op
:
full_like
...
...
@@ -403,8 +403,8 @@
func
:
CreateLikeInferMeta
param
:
[
x
,
dtype
]
kernel
:
func
:
coo_full_like
{sparse_coo -> sparse_coo},
csr_full_like
{sparse_csr -> sparse_csr}
func
:
full_like_coo
{sparse_coo -> sparse_coo},
full_like_csr
{sparse_csr -> sparse_csr}
layout
:
x
data_type
:
dtype
...
...
paddle/phi/kernels/sparse/coalesce_kernel.h
浏览文件 @
a9cc5482
...
...
@@ -22,14 +22,14 @@ namespace phi {
namespace
sparse
{
template
<
typename
T
,
typename
Context
>
void
CoalesceKernel
(
const
Context
&
dev_ctx
,
void
Coalesce
Coo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
);
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
;
CoalesceKernel
<
T
,
Context
>
(
dev_ctx
,
x
,
&
coo
);
Coalesce
Coo
Kernel
<
T
,
Context
>
(
dev_ctx
,
x
,
&
coo
);
return
coo
;
}
...
...
paddle/phi/kernels/sparse/cpu/coalesce_kernel.cc
浏览文件 @
a9cc5482
...
...
@@ -22,7 +22,7 @@ namespace phi {
namespace
sparse
{
template
<
typename
T
,
typename
IntT
>
void
CoalesceCPUKernel
(
const
CPUContext
&
dev_ctx
,
void
CoalesceC
ooC
PUKernel
(
const
CPUContext
&
dev_ctx
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
)
{
const
DenseTensor
&
x_indices
=
x
.
indices
();
...
...
@@ -95,21 +95,22 @@ void CoalesceCPUKernel(const CPUContext& dev_ctx,
}
template
<
typename
T
,
typename
Context
>
void
CoalesceKernel
(
const
Context
&
dev_ctx
,
void
Coalesce
Coo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
)
{
PD_VISIT_BASE_INTEGRAL_TYPES
(
x
.
indices
().
dtype
(),
"CoalesceCPUKernel"
,
([
&
]
{
CoalesceCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
PD_VISIT_BASE_INTEGRAL_TYPES
(
x
.
indices
().
dtype
(),
"CoalesceCooCPUKernel"
,
([
&
]
{
CoalesceCooCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
}));
}
}
// namespace sparse
}
// namespace phi
PD_REGISTER_KERNEL
(
coalesce
,
PD_REGISTER_KERNEL
(
coalesce
_coo
,
CPU
,
ALL_LAYOUT
,
phi
::
sparse
::
CoalesceKernel
,
phi
::
sparse
::
Coalesce
Coo
Kernel
,
float
,
double
,
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) {
}
template
<
typename
T
,
typename
Context
>
void
CooFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
Scalar
&
val
,
DataType
dtype
,
...
...
@@ -51,7 +51,7 @@ void CooFullLikeKernel(const Context& dev_ctx,
}
template
<
typename
T
,
typename
Context
>
void
CsrFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCsr
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
const
Scalar
&
val
,
DataType
dtype
,
...
...
@@ -78,10 +78,10 @@ void CsrFullLikeKernel(const Context& dev_ctx,
}
// namespace phi
PD_REGISTER_KERNEL
(
coo_full_like
,
PD_REGISTER_KERNEL
(
full_like_coo
,
CPU
,
ALL_LAYOUT
,
phi
::
CooFullLike
Kernel
,
phi
::
FullLikeCoo
Kernel
,
float
,
double
,
uint8_t
,
...
...
@@ -96,10 +96,10 @@ PD_REGISTER_KERNEL(coo_full_like,
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
}
PD_REGISTER_KERNEL
(
csr_full_like
,
PD_REGISTER_KERNEL
(
full_like_csr
,
CPU
,
ALL_LAYOUT
,
phi
::
CsrFullLike
Kernel
,
phi
::
FullLikeCsr
Kernel
,
float
,
double
,
uint8_t
,
...
...
paddle/phi/kernels/sparse/cpu/unary_kernel.cc
浏览文件 @
a9cc5482
...
...
@@ -25,7 +25,7 @@ namespace phi {
namespace
sparse
{
template
<
typename
T
,
typename
Context
>
void
Div
CooScalar
Kernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
float
scalar
,
SparseCooTensor
*
out
)
{
...
...
@@ -41,7 +41,7 @@ void DivCooScalarKernel(const Context& dev_ctx,
}
template
<
typename
T
,
typename
Context
>
void
Div
CsrScala
rKernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCs
rKernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
float
scalar
,
SparseCsrTensor
*
out
)
{
...
...
@@ -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
(
leaky_relu
,
LeakyRelu
)
PD_REGISTER_KERNEL
(
divide_
coo_scalar
,
PD_REGISTER_KERNEL
(
divide_
scalar_coo
,
CPU
,
ALL_LAYOUT
,
phi
::
sparse
::
Div
CooScalar
Kernel
,
phi
::
sparse
::
Div
ScalarCoo
Kernel
,
float
,
double
)
{
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
}
PD_REGISTER_KERNEL
(
divide_
csr_scala
r
,
PD_REGISTER_KERNEL
(
divide_
scalar_cs
r
,
CPU
,
ALL_LAYOUT
,
phi
::
sparse
::
Div
CsrScala
rKernel
,
phi
::
sparse
::
Div
ScalarCs
rKernel
,
float
,
double
)
{
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_CSR
);
...
...
paddle/phi/kernels/sparse/full_kernel.h
浏览文件 @
a9cc5482
...
...
@@ -22,14 +22,14 @@
namespace
phi
{
template
<
typename
T
,
typename
Context
>
void
CooFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
Scalar
&
val
,
DataType
dtype
,
SparseCooTensor
*
out
);
template
<
typename
T
,
typename
Context
>
void
CsrFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCsr
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
const
Scalar
&
val
,
DataType
dtype
,
...
...
paddle/phi/kernels/sparse/gpu/coalesce_kernel.cu
浏览文件 @
a9cc5482
...
...
@@ -27,7 +27,7 @@ namespace phi {
namespace
sparse
{
template
<
typename
T
,
typename
IntT
>
void
CoalesceGPUKernel
(
const
GPUContext
&
dev_ctx
,
void
Coalesce
Coo
GPUKernel
(
const
GPUContext
&
dev_ctx
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
)
{
const
DenseTensor
&
x_indices
=
x
.
indices
();
...
...
@@ -172,20 +172,21 @@ void CoalesceGPUKernel(const GPUContext& dev_ctx,
}
template
<
typename
T
,
typename
Context
>
void
CoalesceKernel
(
const
Context
&
dev_ctx
,
void
Coalesce
Coo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
SparseCooTensor
*
out
)
{
PD_VISIT_BASE_INTEGRAL_TYPES
(
x
.
indices
().
dtype
(),
"CoalesceGPUKernel"
,
([
&
]
{
CoalesceGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
PD_VISIT_BASE_INTEGRAL_TYPES
(
x
.
indices
().
dtype
(),
"CoalesceCooGPUKernel"
,
([
&
]
{
CoalesceCooGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
out
);
}));
}
}
// namespace sparse
}
// namespace phi
PD_REGISTER_KERNEL
(
coalesce
,
PD_REGISTER_KERNEL
(
coalesce
_coo
,
GPU
,
ALL_LAYOUT
,
phi
::
sparse
::
CoalesceKernel
,
phi
::
sparse
::
Coalesce
Coo
Kernel
,
float
,
double
,
phi
::
dtype
::
float16
,
...
...
paddle/phi/kernels/sparse/gpu/full_kernel.cu
浏览文件 @
a9cc5482
...
...
@@ -37,7 +37,7 @@ struct FullFunctor {
};
template
<
typename
T
,
typename
Context
>
void
CooFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
const
Scalar
&
val
,
DataType
dtype
,
...
...
@@ -60,7 +60,7 @@ void CooFullLikeKernel(const Context& dev_ctx,
}
template
<
typename
T
,
typename
Context
>
void
CsrFullLike
Kernel
(
const
Context
&
dev_ctx
,
void
FullLikeCsr
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
const
Scalar
&
val
,
DataType
dtype
,
...
...
@@ -87,10 +87,10 @@ void CsrFullLikeKernel(const Context& dev_ctx,
}
// namespace phi
PD_REGISTER_KERNEL
(
coo_full_like
,
PD_REGISTER_KERNEL
(
full_like_coo
,
GPU
,
ALL_LAYOUT
,
phi
::
CooFullLike
Kernel
,
phi
::
FullLikeCoo
Kernel
,
float
,
double
,
uint8_t
,
...
...
@@ -105,10 +105,10 @@ PD_REGISTER_KERNEL(coo_full_like,
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
}
PD_REGISTER_KERNEL
(
csr_full_like
,
PD_REGISTER_KERNEL
(
full_like_csr
,
GPU
,
ALL_LAYOUT
,
phi
::
CsrFullLike
Kernel
,
phi
::
FullLikeCsr
Kernel
,
float
,
double
,
uint8_t
,
...
...
paddle/phi/kernels/sparse/gpu/unary_kernel.cu
浏览文件 @
a9cc5482
...
...
@@ -34,7 +34,7 @@ struct DivScalarFunctor {
};
template
<
typename
T
,
typename
Context
>
void
Div
CooScalar
Kernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
float
scalar
,
SparseCooTensor
*
out
)
{
...
...
@@ -47,7 +47,7 @@ void DivCooScalarKernel(const Context& dev_ctx,
}
template
<
typename
T
,
typename
Context
>
void
Div
CsrScala
rKernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCs
rKernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
float
scalar
,
SparseCsrTensor
*
out
)
{
...
...
@@ -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
(
leaky_relu
,
LeakyRelu
)
PD_REGISTER_KERNEL
(
divide_
coo_scalar
,
PD_REGISTER_KERNEL
(
divide_
scalar_coo
,
GPU
,
ALL_LAYOUT
,
phi
::
sparse
::
Div
CooScalar
Kernel
,
phi
::
sparse
::
Div
ScalarCoo
Kernel
,
float
,
double
)
{
kernel
->
InputAt
(
0
).
SetDataLayout
(
phi
::
DataLayout
::
SPARSE_COO
);
}
PD_REGISTER_KERNEL
(
divide_
csr_scala
r
,
PD_REGISTER_KERNEL
(
divide_
scalar_cs
r
,
GPU
,
ALL_LAYOUT
,
phi
::
sparse
::
Div
CsrScala
rKernel
,
phi
::
sparse
::
Div
ScalarCs
rKernel
,
float
,
double
)
{
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,
SparseCsrTensor
*
out
);
template
<
typename
T
,
typename
Context
>
void
Div
CooScalar
Kernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCoo
Kernel
(
const
Context
&
dev_ctx
,
const
SparseCooTensor
&
x
,
float
scalar
,
SparseCooTensor
*
out
);
template
<
typename
T
,
typename
Context
>
void
Div
CsrScala
rKernel
(
const
Context
&
dev_ctx
,
void
Div
ScalarCs
rKernel
(
const
Context
&
dev_ctx
,
const
SparseCsrTensor
&
x
,
float
scalar
,
SparseCsrTensor
*
out
);
...
...
paddle/phi/tests/kernels/test_sparse_conv3d_dev_api.cc
浏览文件 @
a9cc5482
...
...
@@ -212,7 +212,7 @@ void TestConv3dBase(const std::vector<IntT>& indices,
"Conv3d"
,
&
d_rulebook
,
&
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
((
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,
&
d_rulebook
,
&
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
((
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):
Parameters:
in_channels(int): The number of input channels in the input image.
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
contain three integers, (stride_D, stride_H, stride_W). Otherwise, the
stride_D = stride_H = stride_W = stride. The default value is 1.
...
...
@@ -277,7 +277,7 @@ class SubmConv3D(_Conv3D):
Parameters:
in_channels(int): The number of input channels in the input image.
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
contain three integers, (stride_D, stride_H, stride_W). Otherwise, the
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录