Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
3498434b
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
接近 2 年 前同步成功
通知
707
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3498434b
编写于
2月 10, 2018
作者:
Y
Yancey1989
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ci
上级
31f598fc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
8 deletion
+11
-8
paddle/operators/concat_op.h
paddle/operators/concat_op.h
+6
-4
paddle/operators/split_op.h
paddle/operators/split_op.h
+3
-2
paddle/operators/strided_memcpy.h
paddle/operators/strided_memcpy.h
+2
-2
未找到文件。
paddle/operators/concat_op.h
浏览文件 @
3498434b
...
@@ -37,8 +37,9 @@ class ConcatKernel : public framework::OpKernel<T> {
...
@@ -37,8 +37,9 @@ class ConcatKernel : public framework::OpKernel<T> {
size_t
output_offset
=
0
;
size_t
output_offset
=
0
;
for
(
auto
*
in
:
ins
)
{
for
(
auto
*
in
:
ins
)
{
auto
in_stride
=
framework
::
stride_numel
(
in
->
dims
());
auto
in_stride
=
framework
::
stride_numel
(
in
->
dims
());
StridedNumelCopyWithAxis
<
T
>
(
ctx
,
axis
,
out
->
data
<
T
>
()
+
output_offset
,
StridedNumelCopyWithAxis
<
T
>
(
ctx
.
device_context
(),
axis
,
out_stride
,
in
->
data
<
T
>
(),
in_stride
);
out
->
data
<
T
>
()
+
output_offset
,
out_stride
,
in
->
data
<
T
>
(),
in_stride
);
output_offset
+=
in_stride
[
axis
];
output_offset
+=
in_stride
[
axis
];
}
}
}
}
...
@@ -57,8 +58,9 @@ class ConcatGradKernel : public framework::OpKernel<T> {
...
@@ -57,8 +58,9 @@ class ConcatGradKernel : public framework::OpKernel<T> {
for
(
auto
&
out
:
outs
)
{
for
(
auto
&
out
:
outs
)
{
out
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
out
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
auto
out_stride
=
framework
::
stride_numel
(
out
->
dims
());
auto
out_stride
=
framework
::
stride_numel
(
out
->
dims
());
StridedNumelCopyWithAxis
<
T
>
(
ctx
,
axis
,
out
->
data
<
T
>
(),
out_stride
,
StridedNumelCopyWithAxis
<
T
>
(
ctx
.
device_context
(),
axis
,
out
->
data
<
T
>
(),
in
->
data
<
T
>
()
+
input_offset
,
in_stride
);
out_stride
,
in
->
data
<
T
>
()
+
input_offset
,
in_stride
);
input_offset
+=
out_stride
[
axis
];
input_offset
+=
out_stride
[
axis
];
}
}
}
}
...
...
paddle/operators/split_op.h
浏览文件 @
3498434b
...
@@ -37,8 +37,9 @@ class SplitOpKernel : public framework::OpKernel<T> {
...
@@ -37,8 +37,9 @@ class SplitOpKernel : public framework::OpKernel<T> {
for
(
auto
&
out
:
outs
)
{
for
(
auto
&
out
:
outs
)
{
out
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
out
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
auto
out_stride
=
framework
::
stride_numel
(
out
->
dims
());
auto
out_stride
=
framework
::
stride_numel
(
out
->
dims
());
StridedNumelCopyWithAxis
<
T
>
(
ctx
,
axis
,
out
->
data
<
T
>
(),
out_stride
,
StridedNumelCopyWithAxis
<
T
>
(
ctx
.
device_context
(),
axis
,
out
->
data
<
T
>
(),
in
->
data
<
T
>
()
+
input_offset
,
in_stride
);
out_stride
,
in
->
data
<
T
>
()
+
input_offset
,
in_stride
);
input_offset
+=
out_stride
[
axis
];
input_offset
+=
out_stride
[
axis
];
}
}
}
}
...
...
paddle/operators/strided_memcpy.h
浏览文件 @
3498434b
...
@@ -50,7 +50,7 @@ inline void StridedMemcpy(const platform::DeviceContext& dev_ctx, const T* src,
...
@@ -50,7 +50,7 @@ inline void StridedMemcpy(const platform::DeviceContext& dev_ctx, const T* src,
// NOTE: The src and dst tensor should have the same elements
// NOTE: The src and dst tensor should have the same elements
// except the specified axis.
// except the specified axis.
template
<
typename
T
>
template
<
typename
T
>
inline
void
StridedNumelCopyWithAxis
(
const
framework
::
Execution
Context
&
ctx
,
inline
void
StridedNumelCopyWithAxis
(
const
platform
::
Device
Context
&
ctx
,
int64_t
axis
,
T
*
dst
,
int64_t
axis
,
T
*
dst
,
const
framework
::
DDim
&
dst_stride_numel
,
const
framework
::
DDim
&
dst_stride_numel
,
const
T
*
src
,
const
T
*
src
,
...
@@ -88,7 +88,7 @@ inline void StridedNumelCopyWithAxis(const framework::ExecutionContext& ctx,
...
@@ -88,7 +88,7 @@ inline void StridedNumelCopyWithAxis(const framework::ExecutionContext& ctx,
auto
&
gpu_place
=
boost
::
get
<
platform
::
CUDAPlace
>
(
place
);
auto
&
gpu_place
=
boost
::
get
<
platform
::
CUDAPlace
>
(
place
);
auto
&
cuda_ctx
=
auto
&
cuda_ctx
=
reinterpret_cast
<
const
platform
::
CUDADeviceContext
&>
(
ctx
);
reinterpret_cast
<
const
platform
::
CUDADeviceContext
&>
(
ctx
);
memory
::
Copy
(
cpu_place
,
dst
+
i
*
dst_after
,
c
pu_place
,
memory
::
Copy
(
gpu_place
,
dst
+
i
*
dst_after
,
g
pu_place
,
src
+
i
*
src_after
,
sizeof
(
T
)
*
src_after
,
src
+
i
*
src_after
,
sizeof
(
T
)
*
src_after
,
cuda_ctx
.
stream
());
cuda_ctx
.
stream
());
#else
#else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录