Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
4fe0b4d2
X
X2Paddle
项目概览
PaddlePaddle
/
X2Paddle
12 个月 前同步成功
通知
327
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,发现更多精彩内容 >>
提交
4fe0b4d2
编写于
3月 18, 2019
作者:
S
sunyanfang01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
compatible with python2 and python3
上级
32375eeb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
5 addition
and
7 deletion
+5
-7
caffe2fluid/convert.py
caffe2fluid/convert.py
+0
-1
caffe2fluid/examples/imagenet/compare.py
caffe2fluid/examples/imagenet/compare.py
+1
-1
caffe2fluid/kaffe/custom_layers/crop.py
caffe2fluid/kaffe/custom_layers/crop.py
+2
-2
caffe2fluid/kaffe/layers.py
caffe2fluid/kaffe/layers.py
+0
-1
caffe2fluid/kaffe/net_template.py
caffe2fluid/kaffe/net_template.py
+1
-1
caffe2fluid/kaffe/paddle/network.py
caffe2fluid/kaffe/paddle/network.py
+1
-1
未找到文件。
caffe2fluid/convert.py
浏览文件 @
4fe0b4d2
...
@@ -42,7 +42,6 @@ def convert(def_path, caffemodel_path, data_output_path, code_output_path,
...
@@ -42,7 +42,6 @@ def convert(def_path, caffemodel_path, data_output_path, code_output_path,
if
code_output_path
:
if
code_output_path
:
print_stderr
(
'Saving source...'
)
print_stderr
(
'Saving source...'
)
with
open
(
code_output_path
,
'wb'
)
as
src_out
:
with
open
(
code_output_path
,
'wb'
)
as
src_out
:
# print(type(transformer.transform_source()))
src_out
.
write
(
str
.
encode
(
transformer
.
transform_source
()))
src_out
.
write
(
str
.
encode
(
transformer
.
transform_source
()))
print_stderr
(
'set env variable before using converted model '
\
print_stderr
(
'set env variable before using converted model '
\
'if used custom_layers:'
)
'if used custom_layers:'
)
...
...
caffe2fluid/examples/imagenet/compare.py
浏览文件 @
4fe0b4d2
...
@@ -55,7 +55,7 @@ def compare(path1, path2, no_exception):
...
@@ -55,7 +55,7 @@ def compare(path1, path2, no_exception):
print
(
'[max_df:%.4e, sq_df:%.4e] when compare %s <=> %s'
%
print
(
'[max_df:%.4e, sq_df:%.4e] when compare %s <=> %s'
%
(
max_df
,
sq_df
,
os
.
path
.
basename
(
f1
),
os
.
path
.
basename
(
f2
)))
(
max_df
,
sq_df
,
os
.
path
.
basename
(
f1
),
os
.
path
.
basename
(
f2
)))
if
no_exception
is
False
:
if
no_exception
is
False
:
assert
(
max_df
<
1e-
4
),
\
assert
(
max_df
<
1e-
5
),
\
'max_df is too large with value[%.6e]'
%
(
max_df
)
'max_df is too large with value[%.6e]'
%
(
max_df
)
assert
(
sq_df
<
1e-10
),
\
assert
(
sq_df
<
1e-10
),
\
'sq_df is too large with value[%.6e]'
%
(
sq_df
)
'sq_df is too large with value[%.6e]'
%
(
sq_df
)
...
...
caffe2fluid/kaffe/custom_layers/crop.py
浏览文件 @
4fe0b4d2
...
@@ -22,7 +22,7 @@ def crop_shape(input_shape, shape=None):
...
@@ -22,7 +22,7 @@ def crop_shape(input_shape, shape=None):
input_shape
.
shape
),
"input_shape is diff with output_shape"
input_shape
.
shape
),
"input_shape is diff with output_shape"
return
shape
return
shape
else
:
else
:
raise
Exception
,
"crop_shape input error"
raise
Exception
(
"crop_shape input error"
)
return
None
return
None
...
@@ -54,7 +54,7 @@ def crop_layer(input, name, shape=None, axis=2, offset=None):
...
@@ -54,7 +54,7 @@ def crop_layer(input, name, shape=None, axis=2, offset=None):
output_shape
=
shape
output_shape
=
shape
input_tensor
=
input
input_tensor
=
input
else
:
else
:
raise
Exception
,
"crop_layer input error"
raise
Exception
(
"crop_layer input error"
)
assert
len
(
output_shape
)
==
len
(
assert
len
(
output_shape
)
==
len
(
input_shape
),
"input_shape is diff with output_shape"
input_shape
),
"input_shape is diff with output_shape"
...
...
caffe2fluid/kaffe/layers.py
浏览文件 @
4fe0b4d2
...
@@ -2,7 +2,6 @@ import re
...
@@ -2,7 +2,6 @@ import re
import
numbers
import
numbers
from
collections
import
namedtuple
from
collections
import
namedtuple
import
sys
import
sys
sys
.
path
.
append
(
'~/paddlepaddle/X2Paddle_v2.0/caffe2fluid/kaffe/custom_layers'
)
from
.
import
custom_layers
from
.
import
custom_layers
from
.shapes
import
*
from
.shapes
import
*
...
...
caffe2fluid/kaffe/net_template.py
浏览文件 @
4fe0b4d2
...
@@ -42,7 +42,7 @@ class MyNet(object):
...
@@ -42,7 +42,7 @@ class MyNet(object):
def
convert
(
cls
,
npy_model
,
fluid_path
,
outputs
=
None
):
def
convert
(
cls
,
npy_model
,
fluid_path
,
outputs
=
None
):
fluid
=
import_fluid
()
fluid
=
import_fluid
()
shapes
=
cls
.
input_shapes
()
shapes
=
cls
.
input_shapes
()
input_name
=
list
(
shapes
.
keys
())[
0
]
#need to review
input_name
=
list
(
shapes
.
keys
())[
0
]
feed_data
=
{}
feed_data
=
{}
for
name
,
shape
in
shapes
.
items
():
for
name
,
shape
in
shapes
.
items
():
data_layer
=
fluid
.
layers
.
data
(
data_layer
=
fluid
.
layers
.
data
(
...
...
caffe2fluid/kaffe/paddle/network.py
浏览文件 @
4fe0b4d2
...
@@ -110,7 +110,7 @@ class Network(object):
...
@@ -110,7 +110,7 @@ class Network(object):
continue
continue
layer
=
self
.
layers
[
op_name
]
layer
=
self
.
layers
[
op_name
]
for
param_name
,
data
in
data_dict
[
op_name
].
items
():
#need to review
for
param_name
,
data
in
data_dict
[
op_name
].
items
():
try
:
try
:
name
=
'%s_%s'
%
(
op_name
,
param_name
)
name
=
'%s_%s'
%
(
op_name
,
param_name
)
v
=
fluid
.
global_scope
().
find_var
(
name
)
v
=
fluid
.
global_scope
().
find_var
(
name
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录