Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
ffd438e4
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看板
提交
ffd438e4
编写于
8月 22, 2019
作者:
S
SunAhong1993
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the slice
上级
d0ef318d
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
38 addition
and
5 deletion
+38
-5
x2paddle/core/op_mapper.py
x2paddle/core/op_mapper.py
+5
-0
x2paddle/core/util.py
x2paddle/core/util.py
+5
-0
x2paddle/op_mapper/caffe_op_mapper.py
x2paddle/op_mapper/caffe_op_mapper.py
+15
-4
x2paddle/op_mapper/caffe_shape.py
x2paddle/op_mapper/caffe_shape.py
+13
-1
未找到文件。
x2paddle/core/op_mapper.py
浏览文件 @
ffd438e4
...
...
@@ -97,6 +97,11 @@ class OpMapper(object):
import
model
try
:
inputs
,
outputs
=
model
.
x2paddle_net
()
for
i
,
out
in
enumerate
(
outputs
):
if
isinstance
(
out
,
list
):
for
out_part
in
out
:
outputs
.
append
(
out_part
)
del
outputs
[
i
]
input_names
=
[
input
.
name
for
input
in
inputs
]
exe
=
fluid
.
Executor
(
fluid
.
CPUPlace
())
exe
.
run
(
fluid
.
default_startup_program
())
...
...
x2paddle/core/util.py
浏览文件 @
ffd438e4
...
...
@@ -26,6 +26,11 @@ def string(param):
def
run_net
(
param_dir
=
"./"
):
import
os
inputs
,
outputs
=
x2paddle_net
()
for
i
,
out
in
enumerate
(
outputs
):
if
isinstance
(
out
,
list
):
for
out_part
in
out
:
outputs
.
append
(
out_part
)
del
outputs
[
i
]
exe
=
fluid
.
Executor
(
fluid
.
CPUPlace
())
exe
.
run
(
fluid
.
default_startup_program
())
...
...
x2paddle/op_mapper/caffe_op_mapper.py
浏览文件 @
ffd438e4
...
...
@@ -399,9 +399,22 @@ class CaffeOpMapper(OpMapper):
assert
len
(
node
.
inputs
)
==
1
,
'The count of Slice node
\'
s input is not 1.'
input
=
self
.
graph
.
get_bottom_node
(
node
,
idx
=
0
,
copy
=
True
)
top_len
=
len
(
node
.
layer
.
top
)
params
=
node
.
layer
.
slice_param
axis
=
params
.
axis
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
)
...
...
@@ -570,9 +583,7 @@ class CaffeOpMapper(OpMapper):
param_attr
=
attr
)
def
BatchNorm
(
self
,
node
):
assert
len
(
node
.
inputs
)
==
1
and
len
(
node
.
outputs
)
==
1
,
'The count of BatchNorm node
\'
s input and output is not 1.'
assert
len
(
node
.
inputs
)
==
1
,
'The count of BatchNorm node
\'
s input is not 1.'
input
=
self
.
graph
.
get_bottom_node
(
node
,
idx
=
0
,
copy
=
True
)
params
=
node
.
layer
.
batch_norm_param
if
hasattr
(
params
,
'eps'
):
...
...
x2paddle/op_mapper/caffe_shape.py
浏览文件 @
ffd438e4
...
...
@@ -151,10 +151,22 @@ def shape_concat(layer, input_shape):
def
shape_slice
(
layer
,
input_shape
):
inshape
=
input_shape
[
0
]
top_len
=
len
(
layer
.
top
)
params
=
layer
.
slice_param
axis
=
params
.
axis
count
=
inshape
[
axis
]
slice_dim
=
params
.
slice_dim
if
slice_dim
!=
1
and
axis
==
1
:
axis
=
slice_dim
points
=
list
(
params
.
slice_point
)
count
=
inshape
[
axis
]
if
len
(
points
)
==
0
:
assert
count
%
top_len
==
0
,
"the parameter of Slice is wrong"
part
=
count
/
top_len
t
=
part
while
t
<
count
:
points
.
append
(
int
(
t
))
t
+=
part
points
=
[
0
]
+
points
+
[
count
]
output_shape
=
[]
for
i
in
range
(
len
(
points
)):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录