Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
fb6577bb
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fb6577bb
编写于
6月 29, 2018
作者:
Y
Yao,kun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code style
上级
abb4bb07
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
13 deletion
+17
-13
src/operators/im2sequence_op.cpp
src/operators/im2sequence_op.cpp
+4
-4
src/operators/im2sequence_op.h
src/operators/im2sequence_op.h
+3
-2
src/operators/kernel/arm/im2sequence_kernel.cpp
src/operators/kernel/arm/im2sequence_kernel.cpp
+5
-4
src/operators/kernel/im2sequence_kernel.h
src/operators/kernel/im2sequence_kernel.h
+2
-1
src/operators/op_param.h
src/operators/op_param.h
+3
-2
未找到文件。
src/operators/im2sequence_op.cpp
浏览文件 @
fb6577bb
...
...
@@ -17,15 +17,15 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
operators
{
int
Im2SequenceOutputSize
(
int
input_size
,
int
kernel
,
int
padding_1
,
int
padding_2
,
int
stride
)
{
int
output_size
=
1
+
(
padding_1
+
padding_2
+
input_size
-
kernel
+
stride
-
1
)
/
stride
;
int
Im2SequenceOutputSize
(
int
input_size
,
int
kernel
,
int
padding_1
,
int
padding_2
,
int
stride
)
{
int
output_size
=
1
+
(
padding_1
+
padding_2
+
input_size
-
kernel
+
stride
-
1
)
/
stride
;
return
output_size
;
}
template
<
typename
Dtype
,
typename
T
>
void
Im2SequenceOp
<
Dtype
,
T
>::
InferShape
()
const
{
auto
in_x_dims
=
param_
.
Input
()
->
dims
();
const
std
::
vector
<
int
>
&
kernels
=
param_
.
Kernels
();
...
...
src/operators/im2sequence_op.h
浏览文件 @
fb6577bb
...
...
@@ -14,9 +14,9 @@ limitations under the License. */
#pragma once
#include <operators/op_param.h>
#include "framework/operator.h"
#include "operators/kernel/im2sequence_kernel.h"
#include <operators/op_param.h>
namespace
paddle_mobile
{
namespace
operators
{
...
...
@@ -27,7 +27,8 @@ template <typename DeviceType, typename T>
class
Im2SequenceOp
:
public
framework
::
OperatorWithKernel
<
DeviceType
>
{
public:
Im2SequenceOp
(
const
std
::
string
&
type
,
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
const
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
,
std
::
shared_ptr
<
framework
::
Scope
>
scope
)
:
framework
::
OperatorWithKernel
<
DeviceType
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
...
...
src/operators/kernel/arm/im2sequence_kernel.cpp
浏览文件 @
fb6577bb
...
...
@@ -25,7 +25,8 @@ inline int Im2SeqOutputSize(int input_size, int filter_size, int padding_0,
}
template
<
>
void
Im2SequenceKernel
<
CPU
,
float
>::
Compute
(
const
Im2SequenceParam
&
param
)
const
{
void
Im2SequenceKernel
<
CPU
,
float
>::
Compute
(
const
Im2SequenceParam
&
param
)
const
{
const
Tensor
*
in_x
=
param
.
Input
();
Tensor
*
out
=
param
.
Output
();
out
->
mutable_data
<
float
>
();
...
...
@@ -46,15 +47,15 @@ void Im2SequenceKernel<CPU, float>::Compute(const Im2SequenceParam ¶m) const
paddings
[
3
],
strides
[
1
]);
const
std
::
vector
<
int
>
dilations
({
1
,
1
});
//
TODO: verify
//
TODO: verify
auto
out_dims
=
out
->
dims
();
out
->
Resize
({
batch_size
,
out
->
numel
()
/
batch_size
});
for
(
int
i
=
0
;
i
<
batch_size
;
i
++
)
{
const
Tensor
src
=
in_x
->
Slice
(
i
,
i
+
1
).
Resize
({
img_channels
,
img_height
,
img_width
});
in_x
->
Slice
(
i
,
i
+
1
).
Resize
({
img_channels
,
img_height
,
img_width
});
Tensor
dst
=
out
->
Slice
(
i
,
i
+
1
).
Resize
(
{
output_height
,
output_width
,
img_channels
,
kernels
[
0
],
kernels
[
1
]});
{
output_height
,
output_width
,
img_channels
,
kernels
[
0
],
kernels
[
1
]});
math
::
Im2ColFunctor
<
math
::
ColFormat
::
kOCF
,
CPU
,
float
>
f
;
f
(
src
,
dilations
,
strides
,
paddings
,
&
dst
);
...
...
src/operators/kernel/im2sequence_kernel.h
浏览文件 @
fb6577bb
...
...
@@ -26,7 +26,8 @@ namespace operators {
using
namespace
framework
;
template
<
typename
DeviceType
,
typename
T
>
class
Im2SequenceKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
Im2SequenceParam
>
{
class
Im2SequenceKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
Im2SequenceParam
>
{
public:
void
Compute
(
const
Im2SequenceParam
&
param
)
const
;
};
...
...
src/operators/op_param.h
浏览文件 @
fb6577bb
...
...
@@ -850,8 +850,9 @@ class FusionConvAddReluParam : public FusionConvAddParam {
class
Im2SequenceParam
:
public
OpParam
{
public:
Im2SequenceParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
Im2SequenceParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
input_x_
=
InputXFrom
<
LoDTensor
>
(
inputs
,
scope
);
out_
=
OutFrom
<
LoDTensor
>
(
outputs
,
scope
);
kernels_
=
GetAttr
<
vector
<
int
>>
(
"kernels"
,
attrs
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录