Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c2575ac7
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
提交
c2575ac7
编写于
12月 25, 2018
作者:
S
shippingwang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update API.spec, test=develop
上级
ebeee930
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
101 addition
and
26 deletion
+101
-26
paddle/fluid/API.spec
paddle/fluid/API.spec
+96
-14
paddle/fluid/operators/shuffle_channel_op.cc
paddle/fluid/operators/shuffle_channel_op.cc
+3
-8
paddle/fluid/operators/shuffle_channel_op.cu
paddle/fluid/operators/shuffle_channel_op.cu
+1
-2
paddle/fluid/operators/shuffle_channel_op.h
paddle/fluid/operators/shuffle_channel_op.h
+1
-2
未找到文件。
paddle/fluid/API.spec
浏览文件 @
c2575ac7
此差异已折叠。
点击以展开。
paddle/fluid/operators/shuffle_channel_op.cc
浏览文件 @
c2575ac7
...
...
@@ -27,8 +27,6 @@ class ShuffleChannelOp : public framework::OperatorWithKernel {
auto
input_dims
=
ctx
->
GetInputDim
(
"X"
);
PADDLE_ENFORCE
(
input_dims
.
size
()
==
4
,
"The layout of input is NCHW."
);
// ENFORCE group
ctx
->
SetOutputDim
(
"Out"
,
input_dims
);
}
/*
...
...
@@ -60,11 +58,11 @@ class ShuffleChannelOpMaker : public framework::OpProtoAndCheckerMaker {
AddComment
(
R"DOC(
Shuffle Channel operator
This operator obtains the group convolutional layer with channels shuffled.
First, divide the input channels in each group into several subgroups,
First
ly
, divide the input channels in each group into several subgroups,
then, feed each group in the next layer with different subgroups.
According to the paper, "Suppose a convolution layer with
g
groups
whose output has
g * n channels, first reshape the output channel dimension into(g,n
),
According to the paper, "Suppose a convolution layer with
G
groups
whose output has
(G * N) channels, first reshape the output channel dimension into(G,N
),
transposing and then flattening it back as the input of next layer. "
Shuffle channel operation makes it possible to build more powerful structures
...
...
@@ -89,8 +87,6 @@ class ShuffleChannelGradOp : public framework::OperatorWithKernel {
auto
input_dims
=
ctx
->
GetInputDim
(
"X"
);
PADDLE_ENFORCE
(
input_dims
.
size
()
==
4
,
"The layout of input is NCHW."
);
// ENFORCE group
ctx
->
SetOutputDim
(
framework
::
GradVarName
(
"X"
),
input_dims
);
}
/*
...
...
@@ -112,7 +108,6 @@ namespace ops = paddle::operators;
REGISTER_OPERATOR
(
shuffle_channel
,
ops
::
ShuffleChannelOp
,
ops
::
ShuffleChannelOpMaker
,
paddle
::
framework
::
DefaultGradOpDescMaker
<
true
>
);
// paddle::framework::EmptyGradOpMaker);
REGISTER_OPERATOR
(
shuffle_channel_grad
,
ops
::
ShuffleChannelGradOp
);
...
...
paddle/fluid/operators/shuffle_channel_op.cu
浏览文件 @
c2575ac7
/* Copyright (c) 201
6
PaddlePaddle Authors. All Rights Reserved.
/* Copyright (c) 201
8
PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
...
...
@@ -26,7 +26,6 @@ static inline int NumBlocks(const int N) {
}
template
<
typename
T
>
__global__
void
ShuffleChannel
(
const
int
nthreads
,
const
int
feature_map_size
,
T
*
output
,
const
T
*
input
,
int
group_row
,
int
group_column
,
int
len
)
{
...
...
paddle/fluid/operators/shuffle_channel_op.h
浏览文件 @
c2575ac7
/* Copyright (c) 201
6
PaddlePaddle Authors. All Rights Reserved.
/* Copyright (c) 201
8
PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
...
...
@@ -76,7 +76,6 @@ class ShuffleChannelGradOpKernel : public framework::OpKernel<T> {
ctx
.
Input
<
framework
::
Tensor
>
(
framework
::
GradVarName
(
"Out"
));
auto
*
input_grad
=
ctx
.
Output
<
framework
::
Tensor
>
(
framework
::
GradVarName
(
"X"
));
T
*
input_grad_data
=
input_grad
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
const
T
*
output_grad_data
=
output_grad
->
data
<
T
>
();
for
(
int
n
=
0
;
n
<
num
;
++
n
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录