Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
0c3d8fe5
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看板
提交
0c3d8fe5
编写于
2月 02, 2021
作者:
S
SunAhong1993
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add caffe memory data
上级
174c5436
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
49 addition
and
2 deletion
+49
-2
x2paddle/decoder/caffe_decoder.py
x2paddle/decoder/caffe_decoder.py
+1
-1
x2paddle/op_mapper/dygraph/caffe2paddle/caffe_op_mapper.py
x2paddle/op_mapper/dygraph/caffe2paddle/caffe_op_mapper.py
+20
-0
x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py
x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py
+28
-1
未找到文件。
x2paddle/decoder/caffe_decoder.py
浏览文件 @
0c3d8fe5
...
...
@@ -258,7 +258,7 @@ class CaffeGraph(Graph):
assert
input_node_name
in
self
.
node_map
,
'The {} isn
\'
t a valid node'
.
format
(
name
)
input_node
=
self
.
node_map
[
input_node_name
]
if
len
(
input_node
.
layer
.
top
)
>
1
and
input_node
.
layer_type
!=
"Input"
:
if
len
(
input_node
.
layer
.
top
)
>
1
and
input_node
.
layer_type
not
in
[
"Input"
,
"MemoryData"
]
:
need_idx
=
list
(
input_node
.
layer
.
top
).
index
(
node
.
layer
.
bottom
[
idx
])
name
=
input_node_name
+
':'
+
str
(
need_idx
)
else
:
...
...
x2paddle/op_mapper/dygraph/caffe2paddle/caffe_op_mapper.py
浏览文件 @
0c3d8fe5
...
...
@@ -199,6 +199,26 @@ class CaffeOpMapper(OpMapper):
self
.
inputs_info
[
"x{}"
.
format
(
self
.
input_index
)]
=
[[
-
1
]
+
shape
,
"float32"
]
self
.
input_index
+=
1
def
MemoryData
(
self
,
node
):
params
=
node
.
layer
.
memory_data_param
transform_params
=
node
.
layer
.
transform_param
self
.
paddle_graph
.
add_layer
(
"paddle.to_tensor"
,
inputs
=
{},
outputs
=
[
node
.
layer_name
],
data
=
"x{}"
.
format
(
self
.
input_index
))
shape
=
list
()
shape
.
append
(
params
.
batch_size
)
shape
.
append
(
params
.
channels
)
if
hasattr
(
transform_params
,
"crop_size"
):
shape
.
append
(
transform_params
.
crop_size
)
shape
.
append
(
transform_params
.
crop_size
)
else
:
shape
.
append
(
params
.
width
)
shape
.
append
(
params
.
height
)
self
.
inputs_info
[
"x{}"
.
format
(
self
.
input_index
)]
=
[
shape
,
"float32"
]
self
.
input_index
+=
1
def
Convolution
(
self
,
node
):
conv2d_name
=
name_generator
(
"conv"
,
self
.
nn_name2id
)
output_name
=
node
.
layer_name
...
...
x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py
浏览文件 @
0c3d8fe5
...
...
@@ -124,6 +124,8 @@ class CaffeOpMapper(OpMapper):
def
__init__
(
self
,
decoder
):
super
(
CaffeOpMapper
,
self
).
__init__
()
self
.
graph
=
decoder
.
caffe_graph
if
not
self
.
op_checker
():
raise
Exception
(
"Model is not supported yet."
)
self
.
params
=
dict
()
resolver
=
decoder
.
resolver
self
.
used_custom_layers
=
{}
...
...
@@ -191,6 +193,31 @@ class CaffeOpMapper(OpMapper):
outputs
=
[
node
.
name
],
**
layer_attrs
)
def
MemoryData
(
self
,
node
):
params
=
node
.
layer
.
memory_data_param
transform_params
=
node
.
layer
.
transform_param
shape
=
list
()
shape
.
append
(
params
.
batch_size
)
shape
.
append
(
params
.
channels
)
if
hasattr
(
transform_params
,
"crop_size"
):
shape
.
append
(
transform_params
.
crop_size
)
shape
.
append
(
transform_params
.
crop_size
)
else
:
shape
.
append
(
params
.
width
)
shape
.
append
(
params
.
height
)
dtype
=
'float32'
layer_attrs
=
{
"dtype"
:
string
(
dtype
),
"shape"
:
shape
,
"name"
:
string
(
node
.
name
)
}
self
.
paddle_graph
.
add_layer
(
kernel
=
"paddle.static.data"
,
inputs
=
{},
outputs
=
[
node
.
name
],
**
layer_attrs
)
def
Convolution
(
self
,
node
):
data
=
node
.
data
params
=
node
.
layer
.
convolution_param
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录