Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
cc865fd6
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看板
提交
cc865fd6
编写于
9月 05, 2019
作者:
J
jiangjiajun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test
上级
78e76da7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
26 deletion
+25
-26
tools/check_for_lite.py
tools/check_for_lite.py
+1
-0
x2paddle/convert.py
x2paddle/convert.py
+2
-0
x2paddle/core/op_mapper.py
x2paddle/core/op_mapper.py
+22
-0
x2paddle/core/util.py
x2paddle/core/util.py
+0
-23
x2paddle/decoder/onnx_decoder.py
x2paddle/decoder/onnx_decoder.py
+0
-3
未找到文件。
tools/check_for_lite.py
浏览文件 @
cc865fd6
...
...
@@ -32,4 +32,5 @@ if len(unsupported_ops) > 0:
print
(
"========= {} ========"
.
format
(
op
))
else
:
print
(
"
\n
========== Good News! ========"
)
a
=
1
+
2
+
3
+
4
+
5
+
1
+
2
+
3
+
4
+
5
+
1
+
2
+
3
+
4
+
5
+
1
+
2
+
3
+
4
+
5
+
1
+
2
+
3
+
4
+
5
+
1
+
2
+
3
+
4
+
5
+
1
+
2
+
3
+
4
+
5
print
(
"Good! All ops in this model are supported in Paddle-Lite!
\n
"
)
x2paddle/convert.py
浏览文件 @
cc865fd6
...
...
@@ -140,6 +140,8 @@ def caffe2paddle(proto, weight, save_dir, caffe_proto):
def
onnx2paddle
(
model_path
,
save_dir
):
# check onnx installation and version
try
:
import
torch
import
paddle.fluid
import
onnx
version
=
onnx
.
version
.
version
if
version
!=
'1.5.0'
:
...
...
x2paddle/core/op_mapper.py
浏览文件 @
cc865fd6
...
...
@@ -46,6 +46,28 @@ def export_paddle_param(param, param_name, dir):
fp
.
close
()
# This func will copy to generate code file
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
())
def
if_exist
(
var
):
b
=
os
.
path
.
exists
(
os
.
path
.
join
(
param_dir
,
var
.
name
))
return
b
fluid
.
io
.
load_vars
(
exe
,
param_dir
,
fluid
.
default_main_program
(),
predicate
=
if_exist
)
class
OpMapper
(
object
):
def
__init__
(
self
):
self
.
paddle_codes
=
""
...
...
x2paddle/core/util.py
浏览文件 @
cc865fd6
...
...
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle.fluid
as
fluid
import
numpy
import
math
import
os
...
...
@@ -20,25 +19,3 @@ import os
def
string
(
param
):
return
"
\'
{}
\'
"
.
format
(
param
)
# This func will copy to generate code file
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
())
def
if_exist
(
var
):
b
=
os
.
path
.
exists
(
os
.
path
.
join
(
param_dir
,
var
.
name
))
return
b
fluid
.
io
.
load_vars
(
exe
,
param_dir
,
fluid
.
default_main_program
(),
predicate
=
if_exist
)
x2paddle/decoder/onnx_decoder.py
浏览文件 @
cc865fd6
...
...
@@ -274,9 +274,6 @@ class ONNXGraph(Graph):
try
:
import
torch
version
=
torch
.
__version__
if
'1.1.0'
not
in
version
:
print
(
"your model have dynamic graph, torch==1.1.0 is required"
)
return
except
:
print
(
"your model have dynamic graph, we use caff2 to inference graph, please use
\"
pip install torch==1.1.0
\"
."
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录