Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
cca0b409
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
cca0b409
编写于
8月 01, 2019
作者:
J
Jason
提交者:
GitHub
8月 01, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #61 from SunAhong1993/develop
fix the bug
上级
ea037db6
29712df9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
15 deletion
+16
-15
x2paddle/core/graph.py
x2paddle/core/graph.py
+2
-0
x2paddle/decoder/caffe_decoder.py
x2paddle/decoder/caffe_decoder.py
+3
-4
x2paddle/op_mapper/caffe_custom_layer/__init__.py
x2paddle/op_mapper/caffe_custom_layer/__init__.py
+1
-1
x2paddle/op_mapper/caffe_custom_layer/convolutiondepthwise.py
...ddle/op_mapper/caffe_custom_layer/convolutiondepthwise.py
+7
-6
x2paddle/op_mapper/caffe_op_mapper.py
x2paddle/op_mapper/caffe_op_mapper.py
+3
-4
未找到文件。
x2paddle/core/graph.py
浏览文件 @
cca0b409
...
...
@@ -49,11 +49,13 @@ class Graph(object):
def
_make_input_nodes
(
self
):
for
name
,
node
in
self
.
node_map
.
items
():
name
=
name
.
replace
(
'/'
,
'_'
).
replace
(
'-'
,
'_'
)
if
len
(
node
.
inputs
)
==
0
:
self
.
input_nodes
.
append
(
name
)
def
_make_output_nodes
(
self
):
for
name
,
node
in
self
.
node_map
.
items
():
name
=
name
.
replace
(
'/'
,
'_'
).
replace
(
'-'
,
'_'
)
if
len
(
node
.
outputs
)
==
0
:
self
.
output_nodes
.
append
(
name
)
...
...
x2paddle/decoder/caffe_decoder.py
浏览文件 @
cca0b409
...
...
@@ -97,7 +97,6 @@ class CaffeGraph(Graph):
phase_map
=
{
0
:
'train'
,
1
:
'test'
}
filtered_layer_names
=
set
()
filtered_layers
=
[]
print
(
'The filter layer:'
)
for
layer
in
layers
:
phase
=
'test'
if
len
(
layer
.
include
):
...
...
@@ -116,7 +115,7 @@ class CaffeGraph(Graph):
assert
layer
.
name
not
in
filtered_layer_names
filtered_layer_names
.
add
(
layer
.
name
)
else
:
print
(
layer
.
name
)
print
(
'The filter layer:'
+
layer
.
name
)
return
filtered_layers
def
build
(
self
):
...
...
@@ -184,8 +183,8 @@ class CaffeGraph(Graph):
node
=
self
.
node_map
[
layer_name
]
node
.
set_params
(
data
)
else
:
notice
(
'Ignoring parameters for non-existent layer: %s'
%
\
layer_name
)
raise
Exception
(
'Ignoring parameters for non-existent layer: %s'
%
\
layer_name
)
super
(
CaffeGraph
,
self
).
build
()
...
...
x2paddle/op_mapper/caffe_custom_layer/__init__.py
浏览文件 @
cca0b409
...
...
@@ -56,7 +56,7 @@ def get_params(layer, layer_type):
elif
ch
.
isupper
()
and
layer_type
[
i
-
1
].
islower
():
tmp_name
+=
(
s
+
'_'
)
s
=
''
s
+=
ch
s
+=
ch
.
lower
()
tmp_name
+=
s
param_name
=
'_'
.
join
((
tmp_name
,
'param'
))
else
:
...
...
x2paddle/op_mapper/caffe_custom_layer/convolutiondepthwise.py
浏览文件 @
cca0b409
...
...
@@ -18,19 +18,19 @@ def convolutiondepthwise_shape(input_shape,
[
k_h
,
k_w
]
=
[
1
,
1
]
if
isinstance
(
kernel_size
,
numbers
.
Number
):
[
k_h
,
k_w
]
=
[
kernel_size
]
*
2
elif
isinstance
(
kernel_size
,
list
)
and
len
(
kernel_size
)
>
0
:
elif
len
(
kernel_size
)
>
0
:
k_h
=
kernel_h
if
kernel_h
else
kernel_size
[
0
]
k_w
=
kernel_w
if
kernel_w
else
kernel_size
[
len
(
kernel_size
)
-
1
]
[
s_h
,
s_w
]
=
[
1
,
1
]
if
isinstance
(
stride
,
numbers
.
Number
):
[
s_h
,
s_w
]
=
[
stride
]
*
2
elif
isinstance
(
stride
,
list
)
and
len
(
stride
)
>
0
:
elif
len
(
stride
)
>
0
:
s_h
=
stride_h
if
stride_h
else
stride
[
0
]
s_w
=
stride_w
if
stride_w
else
stride
[
len
(
stride
)
-
1
]
[
p_h
,
p_w
]
=
[
0
,
0
]
if
isinstance
(
pad
,
numbers
.
Number
):
[
p_h
,
p_w
]
=
[
pad
]
*
2
elif
isinstance
(
pad
,
list
)
and
len
(
pad
)
>
0
:
elif
len
(
pad
)
>
0
:
p_h
=
pad_h
if
pad_h
else
pad
[
0
]
p_w
=
pad_w
if
pad_w
else
pad
[
len
(
pad
)
-
1
]
dila_len
=
len
(
dilation
)
...
...
@@ -69,22 +69,23 @@ def convolutiondepthwise_layer(inputs,
stride_w
=
None
,
input_shape
=
None
,
name
=
None
):
import
numbers
[
k_h
,
k_w
]
=
[
1
,
1
]
if
isinstance
(
kernel_size
,
numbers
.
Number
):
[
k_h
,
k_w
]
=
[
kernel_size
]
*
2
elif
isinstance
(
kernel_size
,
list
)
and
len
(
kernel_size
)
>
0
:
elif
len
(
kernel_size
)
>
0
:
k_h
=
kernel_h
if
kernel_h
else
kernel_size
[
0
]
k_w
=
kernel_w
if
kernel_w
else
kernel_size
[
len
(
kernel_size
)
-
1
]
[
s_h
,
s_w
]
=
[
1
,
1
]
if
isinstance
(
stride
,
numbers
.
Number
):
[
s_h
,
s_w
]
=
[
stride
]
*
2
elif
isinstance
(
stride
,
list
)
and
len
(
stride
)
>
0
:
elif
len
(
stride
)
>
0
:
s_h
=
stride_h
if
stride_h
else
stride
[
0
]
s_w
=
stride_w
if
stride_w
else
stride
[
len
(
stride
)
-
1
]
[
p_h
,
p_w
]
=
[
0
,
0
]
if
isinstance
(
pad
,
numbers
.
Number
):
[
p_h
,
p_w
]
=
[
pad
]
*
2
elif
isinstance
(
pad
,
list
)
and
len
(
pad
)
>
0
:
elif
len
(
pad
)
>
0
:
p_h
=
pad_h
if
pad_h
else
pad
[
0
]
p_w
=
pad_w
if
pad_w
else
pad
[
len
(
pad
)
-
1
]
input
=
inputs
[
0
]
...
...
x2paddle/op_mapper/caffe_op_mapper.py
浏览文件 @
cca0b409
...
...
@@ -123,22 +123,21 @@ class CaffeOpMapper(OpMapper):
[
k_h
,
k_w
]
=
[
1
,
1
]
if
isinstance
(
params
.
kernel_size
,
numbers
.
Number
):
[
k_h
,
k_w
]
=
[
params
.
kernel_size
]
*
2
elif
isinstance
(
params
.
kernel_size
,
list
)
and
len
(
params
.
kernel_size
)
>
0
:
elif
len
(
params
.
kernel_size
)
>
0
:
k_h
=
params
.
kernel_h
if
params
.
kernel_h
else
params
.
kernel_size
[
0
]
k_w
=
params
.
kernel_w
if
params
.
kernel_w
else
params
.
kernel_size
[
len
(
params
.
kernel_size
)
-
1
]
[
s_h
,
s_w
]
=
[
1
,
1
]
if
isinstance
(
params
.
stride
,
numbers
.
Number
):
[
s_h
,
s_w
]
=
[
params
.
stride
]
*
2
elif
isinstance
(
params
.
stride
,
list
)
and
len
(
params
.
stride
)
>
0
:
elif
len
(
params
.
stride
)
>
0
:
s_h
=
params
.
stride_h
if
params
.
stride_h
else
params
.
stride
[
0
]
s_w
=
params
.
stride_w
if
params
.
stride_w
else
params
.
stride
[
len
(
params
.
stride
)
-
1
]
[
p_h
,
p_w
]
=
[
0
,
0
]
if
isinstance
(
params
.
pad
,
numbers
.
Number
):
[
p_h
,
p_w
]
=
[
params
.
pad
]
*
2
elif
isinstance
(
params
.
pad
,
list
)
and
len
(
params
.
pad
)
>
0
:
elif
len
(
params
.
pad
)
>
0
:
p_h
=
params
.
pad_h
if
params
.
pad_h
else
params
.
pad
[
0
]
p_w
=
params
.
pad_w
if
params
.
pad_w
else
params
.
pad
[
len
(
params
.
pad
)
-
1
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录