Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
18ccff05
X
X2Paddle
项目概览
PaddlePaddle
/
X2Paddle
大约 1 年 前同步成功
通知
328
Star
698
Fork
167
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
26
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
X2Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
26
Issue
26
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
18ccff05
编写于
10月 10, 2019
作者:
S
SunAhong1993
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the slice and shufflechannel
上级
4c4fb484
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
14 addition
and
36 deletion
+14
-36
x2paddle/op_mapper/caffe_custom_layer/shufflechannel.py
x2paddle/op_mapper/caffe_custom_layer/shufflechannel.py
+1
-7
x2paddle/op_mapper/caffe_op_mapper.py
x2paddle/op_mapper/caffe_op_mapper.py
+13
-29
未找到文件。
x2paddle/op_mapper/caffe_custom_layer/shufflechannel.py
浏览文件 @
18ccff05
...
@@ -8,13 +8,7 @@ def shufflechannel_shape(input_shape):
...
@@ -8,13 +8,7 @@ def shufflechannel_shape(input_shape):
def
shufflechannel_layer
(
inputs
,
group
=
None
,
input_shape
=
None
,
name
=
None
):
def
shufflechannel_layer
(
inputs
,
group
=
None
,
input_shape
=
None
,
name
=
None
):
input
=
inputs
[
0
]
input
=
inputs
[
0
]
c_fm
=
fluid
.
layers
.
split
(
input
,
num_or_sections
=
input_shape
[
0
][
1
],
dim
=
1
)
out
=
fluid
.
layers
.
shuffle_channel
(
x
=
input
,
group
=
group
)
size
=
int
(
input_shape
[
0
][
1
]
/
group
)
new_c_fm
=
[]
for
i
in
range
(
size
):
for
j
in
range
(
group
):
new_c_fm
.
append
(
c_fm
[
j
*
size
+
i
])
out
=
fluid
.
layers
.
concat
(
new_c_fm
,
axis
=
1
)
return
out
return
out
...
...
x2paddle/op_mapper/caffe_op_mapper.py
浏览文件 @
18ccff05
...
@@ -450,35 +450,19 @@ class CaffeOpMapper(OpMapper):
...
@@ -450,35 +450,19 @@ class CaffeOpMapper(OpMapper):
slice_dim
=
params
.
slice_dim
slice_dim
=
params
.
slice_dim
if
slice_dim
!=
1
and
axis
==
1
:
if
slice_dim
!=
1
and
axis
==
1
:
axis
=
slice_dim
axis
=
slice_dim
points
=
list
(
params
.
slice_point
)
output_shape
=
node
.
output_shape
sections_list
=
[]
if
len
(
points
)
==
0
:
for
s
in
output_shape
:
dims
=
node
.
input_shape
[
0
][
axis
]
sections_list
.
append
(
s
[
axis
])
assert
dims
%
top_len
==
0
,
"the parameter of Slice is wrong"
part
=
dims
/
top_len
t
=
part
while
t
<
dims
:
points
.
append
(
int
(
t
))
t
+=
part
maxint32
=
2147483647
points
=
[
0
]
+
points
points
.
append
(
maxint32
)
i
=
0
node
.
fluid_code
.
add_note
(
'{} = []'
.
format
(
node
.
layer_name
))
for
i
in
range
(
len
(
points
)):
attr
=
{
attr
=
{
'axes'
:
[
axis
]
,
'num_or_sections'
:
sections_list
,
'starts'
:
[
points
[
i
]]
,
'dim'
:
axis
,
'ends'
:
[
points
[
i
+
1
]]
'name'
:
string
(
node
.
layer_name
)
}
}
node
.
fluid_code
.
add_layer
(
"slice
"
,
node
.
fluid_code
.
add_layer
(
"split
"
,
inputs
=
input
,
inputs
=
input
,
output
=
node
.
layer_name
+
'_'
+
str
(
i
)
,
output
=
node
.
layer_name
,
param_attr
=
attr
)
param_attr
=
attr
)
node
.
fluid_code
.
add_note
(
'{}.append({})'
.
format
(
node
.
layer_name
,
node
.
layer_name
+
'_'
+
str
(
i
)))
if
i
==
len
(
points
)
-
2
:
break
def
Concat
(
self
,
node
):
def
Concat
(
self
,
node
):
assert
len
(
assert
len
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录