Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
e033569d
P
Paddle
项目概览
Crayon鑫
/
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看板
提交
e033569d
编写于
9月 07, 2017
作者:
W
wanghaoshuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix format
上级
eb3c774b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
30 deletion
+37
-30
paddle/function/SwitchOpGpu.cu
paddle/function/SwitchOpGpu.cu
+32
-24
proto/ModelConfig.proto
proto/ModelConfig.proto
+5
-6
未找到文件。
paddle/function/SwitchOpGpu.cu
浏览文件 @
e033569d
...
...
@@ -12,14 +12,18 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "hl_base.h"
#include "SwitchOp.h"
#include "hl_base.h"
namespace
paddle
{
__global__
void
KeNCHW2NHWC
(
real
*
outputs
,
const
real
*
inputs
,
int
inC
,
int
inH
,
int
inW
,
int
nthreads
,
int
argType
)
{
__global__
void
KeNCHW2NHWC
(
real
*
outputs
,
const
real
*
inputs
,
int
inC
,
int
inH
,
int
inW
,
int
nthreads
,
int
argType
)
{
const
int
idx
=
threadIdx
.
x
+
blockIdx
.
x
*
blockDim
.
x
;
if
(
idx
<
nthreads
)
{
const
int
w
=
idx
%
inW
;
...
...
@@ -27,7 +31,7 @@ __global__ void KeNCHW2NHWC(real* outputs, const real* inputs,
const
int
c
=
(
idx
/
inW
/
inH
)
%
inC
;
const
int
n
=
idx
/
inW
/
inH
/
inC
;
const
int
off
=
((
n
*
inH
+
h
)
*
inW
+
w
)
*
inC
+
c
;
const
int
off
=
((
n
*
inH
+
h
)
*
inW
+
w
)
*
inC
+
c
;
if
(
argType
==
ADD_TO
)
{
outputs
[
off
]
+=
inputs
[
idx
];
}
else
{
...
...
@@ -38,23 +42,27 @@ __global__ void KeNCHW2NHWC(real* outputs, const real* inputs,
template
<
>
void
NCHW2NHWC
<
DEVICE_TYPE_GPU
>
(
real
*
outputs
,
const
real
*
inputs
,
const
int
num
,
const
int
inC
,
const
int
inH
,
const
int
inW
,
const
int
argType
)
{
const
real
*
inputs
,
const
int
num
,
const
int
inC
,
const
int
inH
,
const
int
inW
,
const
int
argType
)
{
size_t
nth
=
num
*
inC
*
inH
*
inW
;
int
blockSize
=
1024
;
int
gridSize
=
(
nth
+
1024
-
1
)
/
1024
;
KeNCHW2NHWC
<<<
gridSize
,
blockSize
,
0
,
STREAM_DEFAULT
>>>
(
outputs
,
inputs
,
inC
,
inH
,
inW
,
nth
,
argType
);
KeNCHW2NHWC
<<<
gridSize
,
blockSize
,
0
,
STREAM_DEFAULT
>>>
(
outputs
,
inputs
,
inC
,
inH
,
inW
,
nth
,
argType
);
CHECK_SYNC
(
"NCHW2NHWC"
);
}
__global__
void
KeNHWC2NCHW
(
real
*
outputs
,
const
real
*
inputs
,
int
inH
,
int
inW
,
int
inC
,
int
nthreads
,
int
argType
)
{
__global__
void
KeNHWC2NCHW
(
real
*
outputs
,
const
real
*
inputs
,
int
inH
,
int
inW
,
int
inC
,
int
nthreads
,
int
argType
)
{
const
int
idx
=
threadIdx
.
x
+
blockIdx
.
x
*
blockDim
.
x
;
if
(
idx
<
nthreads
)
{
const
int
c
=
idx
%
inC
;
...
...
@@ -73,17 +81,17 @@ __global__ void KeNHWC2NCHW(real* outputs, const real* inputs,
template
<
>
void
NHWC2NCHW
<
DEVICE_TYPE_GPU
>
(
real
*
outputs
,
const
real
*
inputs
,
const
int
num
,
const
int
inH
,
const
int
inW
,
const
int
inC
,
const
int
argType
)
{
const
real
*
inputs
,
const
int
num
,
const
int
inH
,
const
int
inW
,
const
int
inC
,
const
int
argType
)
{
int
nth
=
num
*
inC
*
inH
*
inW
;
int
blockSize
=
1024
;
int
gridSize
=
(
nth
+
1024
-
1
)
/
1024
;
KeNHWC2NCHW
<<<
gridSize
,
blockSize
,
0
,
STREAM_DEFAULT
>>>
(
outputs
,
inputs
,
inH
,
inW
,
inC
,
nth
,
argType
);
KeNHWC2NCHW
<<<
gridSize
,
blockSize
,
0
,
STREAM_DEFAULT
>>>
(
outputs
,
inputs
,
inH
,
inW
,
inC
,
nth
,
argType
);
CHECK_SYNC
(
"NHWC2NCHW"
);
}
...
...
proto/ModelConfig.proto
浏览文件 @
e033569d
...
...
@@ -288,8 +288,8 @@ message PadConfig {
}
message
ReshapeConfig
{
repeated
uint32
heightAxis
=
1
;
repeated
uint32
widthAxis
=
2
;
repeated
uint32
heightAxis
=
1
;
repeated
uint32
widthAxis
=
2
;
}
message
MultiBoxLossConfig
{
...
...
@@ -344,7 +344,6 @@ message LayerInputConfig {
}
message
LayerConfig
{
required
string
name
=
1
;
required
string
type
=
2
;
optional
uint64
size
=
3
;
...
...
@@ -516,13 +515,13 @@ message LayerConfig {
optional
int32
axis
=
54
[
default
=
2
];
repeated
uint32
offset
=
55
;
repeated
uint32
shape
=
56
;
// for HuberRegressionLoss
optional
double
delta
=
57
[
default
=
1.0
];
optional
uint64
depth
=
58
[
default
=
1
];
// for switch order layer
// for switch order layer
optional
ReshapeConfig
reshape_conf
=
59
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录