Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
c42d85e9
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看板
提交
c42d85e9
编写于
9月 05, 2019
作者:
M
mamingjie-China
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support for python2
上级
e47ffeec
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
9 addition
and
10 deletion
+9
-10
x2paddle/core/fluid_code.py
x2paddle/core/fluid_code.py
+6
-5
x2paddle/core/graph.py
x2paddle/core/graph.py
+2
-0
x2paddle/decoder/caffe_decoder.py
x2paddle/decoder/caffe_decoder.py
+0
-4
x2paddle/op_mapper/onnx_op_mapper.py
x2paddle/op_mapper/onnx_op_mapper.py
+1
-1
未找到文件。
x2paddle/core/fluid_code.py
浏览文件 @
c42d85e9
...
@@ -13,8 +13,9 @@
...
@@ -13,8 +13,9 @@
# limitations under the License.
# limitations under the License.
from
x2paddle.core.graph
import
GraphNode
from
x2paddle.core.graph
import
GraphNode
import
collections
from
x2paddle.core.util
import
*
from
x2paddle.core.util
import
*
import
collections
import
six
class
Layer
(
object
):
class
Layer
(
object
):
...
@@ -28,7 +29,7 @@ class Layer(object):
...
@@ -28,7 +29,7 @@ class Layer(object):
def
get_code
(
self
):
def
get_code
(
self
):
layer_code
=
""
layer_code
=
""
if
self
.
output
is
not
None
:
if
self
.
output
is
not
None
:
if
isinstance
(
self
.
output
,
s
tr
):
if
isinstance
(
self
.
output
,
s
ix
.
string_types
):
layer_code
=
self
.
output
+
" = "
layer_code
=
self
.
output
+
" = "
else
:
else
:
layer_code
=
self
.
output
.
layer_name
+
" = "
layer_code
=
self
.
output
.
layer_name
+
" = "
...
@@ -47,7 +48,7 @@ class Layer(object):
...
@@ -47,7 +48,7 @@ class Layer(object):
"[{}]"
.
format
(
input
.
index
)
+
", "
)
"[{}]"
.
format
(
input
.
index
)
+
", "
)
else
:
else
:
in_list
+=
(
input
.
layer_name
+
", "
)
in_list
+=
(
input
.
layer_name
+
", "
)
elif
isinstance
(
input
,
s
tr
):
elif
isinstance
(
input
,
s
ix
.
string_types
):
in_list
+=
(
input
+
", "
)
in_list
+=
(
input
+
", "
)
else
:
else
:
raise
Exception
(
raise
Exception
(
...
@@ -72,7 +73,7 @@ class Layer(object):
...
@@ -72,7 +73,7 @@ class Layer(object):
"[{}]"
.
format
(
self
.
inputs
.
index
)
+
", "
)
"[{}]"
.
format
(
self
.
inputs
.
index
)
+
", "
)
else
:
else
:
layer_code
+=
(
self
.
inputs
.
layer_name
+
", "
)
layer_code
+=
(
self
.
inputs
.
layer_name
+
", "
)
elif
isinstance
(
self
.
inputs
,
s
tr
):
elif
isinstance
(
self
.
inputs
,
s
ix
.
string_types
):
layer_code
+=
(
self
.
inputs
+
", "
)
layer_code
+=
(
self
.
inputs
+
", "
)
else
:
else
:
raise
Exception
(
"Unknown type of inputs."
)
raise
Exception
(
"Unknown type of inputs."
)
...
@@ -119,6 +120,6 @@ class FluidCode(object):
...
@@ -119,6 +120,6 @@ class FluidCode(object):
for
layer
in
self
.
layers
:
for
layer
in
self
.
layers
:
if
isinstance
(
layer
,
Layer
):
if
isinstance
(
layer
,
Layer
):
codes
.
append
(
layer
.
get_code
())
codes
.
append
(
layer
.
get_code
())
elif
isinstance
(
layer
,
s
tr
):
elif
isinstance
(
layer
,
s
ix
.
string_types
):
codes
.
append
(
layer
)
codes
.
append
(
layer
)
return
codes
return
codes
x2paddle/core/graph.py
浏览文件 @
c42d85e9
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
from
__future__
import
print_function
from
__future__
import
division
import
collections
import
collections
import
copy
as
cp
import
copy
as
cp
...
...
x2paddle/decoder/caffe_decoder.py
浏览文件 @
c42d85e9
...
@@ -236,11 +236,7 @@ class CaffeDecoder(object):
...
@@ -236,11 +236,7 @@ class CaffeDecoder(object):
data
.
MergeFromString
(
open
(
self
.
model_path
,
'rb'
).
read
())
data
.
MergeFromString
(
open
(
self
.
model_path
,
'rb'
).
read
())
pair
=
lambda
layer
:
(
layer
.
name
,
self
.
normalize_pb_data
(
layer
))
pair
=
lambda
layer
:
(
layer
.
name
,
self
.
normalize_pb_data
(
layer
))
layers
=
data
.
layers
or
data
.
layer
layers
=
data
.
layers
or
data
.
layer
import
time
start
=
time
.
time
()
self
.
params
=
[
pair
(
layer
)
for
layer
in
layers
if
layer
.
blobs
]
self
.
params
=
[
pair
(
layer
)
for
layer
in
layers
if
layer
.
blobs
]
end
=
time
.
time
()
print
(
'cost:'
,
str
(
end
-
start
))
def
normalize_pb_data
(
self
,
layer
):
def
normalize_pb_data
(
self
,
layer
):
transformed
=
[]
transformed
=
[]
...
...
x2paddle/op_mapper/onnx_op_mapper.py
浏览文件 @
c42d85e9
...
@@ -94,7 +94,7 @@ class ONNXOpMapper(OpMapper):
...
@@ -94,7 +94,7 @@ class ONNXOpMapper(OpMapper):
print
(
op
)
print
(
op
)
return
False
return
False
def
directly_map
(
self
,
node
,
*
args
,
name
=
''
,
**
kwargs
):
def
directly_map
(
self
,
node
,
name
=
''
,
*
args
,
**
kwargs
):
inputs
=
node
.
layer
.
input
inputs
=
node
.
layer
.
input
outputs
=
node
.
layer
.
output
outputs
=
node
.
layer
.
output
op_type
=
node
.
layer_type
op_type
=
node
.
layer_type
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录