Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
2bcb8fd3
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看板
未验证
提交
2bcb8fd3
编写于
10月 10, 2019
作者:
J
Jason
提交者:
GitHub
10月 10, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #159 from SunAhong1993/develop
modify the slice and shufflechannel
上级
4c4fb484
18ccff05
变更
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
浏览文件 @
2bcb8fd3
...
...
@@ -8,13 +8,7 @@ def shufflechannel_shape(input_shape):
def
shufflechannel_layer
(
inputs
,
group
=
None
,
input_shape
=
None
,
name
=
None
):
input
=
inputs
[
0
]
c_fm
=
fluid
.
layers
.
split
(
input
,
num_or_sections
=
input_shape
[
0
][
1
],
dim
=
1
)
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
)
out
=
fluid
.
layers
.
shuffle_channel
(
x
=
input
,
group
=
group
)
return
out
...
...
x2paddle/op_mapper/caffe_op_mapper.py
浏览文件 @
2bcb8fd3
...
...
@@ -450,35 +450,19 @@ class CaffeOpMapper(OpMapper):
slice_dim
=
params
.
slice_dim
if
slice_dim
!=
1
and
axis
==
1
:
axis
=
slice_dim
points
=
list
(
params
.
slice_point
)
if
len
(
points
)
==
0
:
dims
=
node
.
input_shape
[
0
][
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
=
{
'axes'
:
[
axis
],
'starts'
:
[
points
[
i
]],
'ends'
:
[
points
[
i
+
1
]]
}
node
.
fluid_code
.
add_layer
(
"slice"
,
inputs
=
input
,
output
=
node
.
layer_name
+
'_'
+
str
(
i
),
param_attr
=
attr
)
node
.
fluid_code
.
add_note
(
'{}.append({})'
.
format
(
node
.
layer_name
,
node
.
layer_name
+
'_'
+
str
(
i
)))
if
i
==
len
(
points
)
-
2
:
break
output_shape
=
node
.
output_shape
sections_list
=
[]
for
s
in
output_shape
:
sections_list
.
append
(
s
[
axis
])
attr
=
{
'num_or_sections'
:
sections_list
,
'dim'
:
axis
,
'name'
:
string
(
node
.
layer_name
)
}
node
.
fluid_code
.
add_layer
(
"split"
,
inputs
=
input
,
output
=
node
.
layer_name
,
param_attr
=
attr
)
def
Concat
(
self
,
node
):
assert
len
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录