Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
aa98edf9
X
X2Paddle
项目概览
PaddlePaddle
/
X2Paddle
大约 2 年 前同步成功
通知
329
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看板
提交
aa98edf9
编写于
8月 04, 2020
作者:
M
mamingjie-China
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
6469514a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
10 deletion
+14
-10
x2paddle/op_mapper/tf_op_mapper_nhwc.py
x2paddle/op_mapper/tf_op_mapper_nhwc.py
+14
-10
未找到文件。
x2paddle/op_mapper/tf_op_mapper_nhwc.py
浏览文件 @
aa98edf9
...
@@ -199,17 +199,21 @@ class TFOpMapperNHWC(OpMapper):
...
@@ -199,17 +199,21 @@ class TFOpMapperNHWC(OpMapper):
def
Fill
(
self
,
node
):
def
Fill
(
self
,
node
):
dims
=
self
.
graph
.
get_node
(
node
.
layer
.
input
[
0
])
dims
=
self
.
graph
.
get_node
(
node
.
layer
.
input
[
0
])
input_value
=
self
.
graph
.
get_node
(
node
.
layer
.
input
[
1
])
input_value
=
self
.
graph
.
get_node
(
node
.
layer
.
input
[
1
])
inputs
=
dict
()
attr
=
dict
()
assert
input_value
.
layer_type
==
"Const"
,
"Value of fill OP should be Const"
assert
input_value
.
layer_type
==
"Const"
,
"Value of fill OP should be Const"
if
dims
.
layer_type
==
"Const"
:
attr
[
"shape"
]
=
dims
.
value
.
tolist
()
else
:
inputs
[
"shape"
]
=
dims
.
name
attr
[
"dtype"
]
=
string
(
input_value
.
dtype
)
attr
[
"value"
]
=
input_value
.
value
input_value
=
input_value
.
value
input_dtype
=
string
(
input_value
.
dtype
)
program
.
add_layer
(
program
.
add_layer
(
"fluid.layers.fill_constant"
,
"fluid.layers.fill_constant"
,
inputs
=
{}
,
inputs
=
inputs
,
outputs
=
[
node
.
name
],
outputs
=
[
node
.
name
],
shape
=
dims
,
**
attr
)
dtype
=
string
(
input_dtype
),
value
=
input_value
)
def
DepthToSpace
(
self
,
node
):
def
DepthToSpace
(
self
,
node
):
input
=
self
.
graph
.
get_node
(
node
.
layer
.
input
[
0
])
input
=
self
.
graph
.
get_node
(
node
.
layer
.
input
[
0
])
...
@@ -251,8 +255,8 @@ class TFOpMapperNHWC(OpMapper):
...
@@ -251,8 +255,8 @@ class TFOpMapperNHWC(OpMapper):
shape
=
[
0
,
c
,
h
,
w
])
shape
=
[
0
,
c
,
h
,
w
])
program
.
add_layer
(
program
.
add_layer
(
kernel
=
"fluid.layers.pixe
d
_shuffle"
,
kernel
=
"fluid.layers.pixe
l
_shuffle"
,
inputs
=
{
"
input
"
:
reshape_name
},
inputs
=
{
"
x
"
:
reshape_name
},
outputs
=
[
node
.
name
],
outputs
=
[
node
.
name
],
upscale_factor
=
block_size
)
upscale_factor
=
block_size
)
...
@@ -309,9 +313,9 @@ class TFOpMapperNHWC(OpMapper):
...
@@ -309,9 +313,9 @@ class TFOpMapperNHWC(OpMapper):
data_format
=
node
.
get_attr
(
"data_format"
).
decode
()
data_format
=
node
.
get_attr
(
"data_format"
).
decode
()
pad_mode
=
node
.
get_attr
(
"padding"
).
decode
()
pad_mode
=
node
.
get_attr
(
"padding"
).
decode
()
if
data_format
==
"NHWC"
:
if
data_format
==
"NHWC"
:
n
,
c
,
h
,
w
=
input
.
out_shapes
[
0
]
else
:
n
,
h
,
w
,
c
=
input
.
out_shapes
[
0
]
n
,
h
,
w
,
c
=
input
.
out_shapes
[
0
]
else
:
n
,
c
,
h
,
w
=
input
.
out_shapes
[
0
]
if
kernel
.
layer_type
==
'Const'
:
if
kernel
.
layer_type
==
'Const'
:
kernel_value
=
kernel
.
value
kernel_value
=
kernel
.
value
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录