Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
ba4d2185
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看板
提交
ba4d2185
编写于
8月 11, 2020
作者:
M
mamingjie-China
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug in gatherv2 and change param without__data_format_optimization
上级
f745dab4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
3 deletion
+15
-3
x2paddle/convert.py
x2paddle/convert.py
+1
-1
x2paddle/op_mapper/tf_op_mapper_nhwc.py
x2paddle/op_mapper/tf_op_mapper_nhwc.py
+14
-2
未找到文件。
x2paddle/convert.py
浏览文件 @
ba4d2185
...
@@ -67,7 +67,7 @@ def arg_parser():
...
@@ -67,7 +67,7 @@ def arg_parser():
"--without_data_format_optimization"
,
"--without_data_format_optimization"
,
"-wo"
,
"-wo"
,
action
=
"store_true"
,
action
=
"store_true"
,
default
=
Fals
e
,
default
=
Tru
e
,
help
=
"tf model conversion without data format optimization"
)
help
=
"tf model conversion without data format optimization"
)
parser
.
add_argument
(
parser
.
add_argument
(
"--define_input_shape"
,
"--define_input_shape"
,
...
...
x2paddle/op_mapper/tf_op_mapper_nhwc.py
浏览文件 @
ba4d2185
...
@@ -1068,13 +1068,25 @@ class TFOpMapperNHWC(OpMapper):
...
@@ -1068,13 +1068,25 @@ class TFOpMapperNHWC(OpMapper):
axis
=
axis
.
value
.
tolist
()
axis
=
axis
.
value
.
tolist
()
assert
axis
==
0
,
"Only support axis=0 in GatherV2 OP"
assert
axis
==
0
,
"Only support axis=0 in GatherV2 OP"
attr
=
{
'overwrite'
:
False
}
attr
=
{
'overwrite'
:
False
}
embeddings_shape
=
embeddings
.
out_shapes
[
0
][
-
1
]
reshape_list
=
list
()
reshape_name
=
index
.
layer_name
if
len
(
index
.
out_shapes
[
0
])
!=
1
:
if
len
(
index
.
out_shapes
[
0
])
!=
1
:
reshape_list
=
index
.
out_shapes
[
0
]
reshape_attr
=
{
"shape"
:
[
-
1
]}
reshape_attr
=
{
"shape"
:
[
-
1
]}
reshape_name
=
"{}_reshape"
.
format
(
index
.
layer_name
)
node
.
fluid_code
.
add_layer
(
node
.
fluid_code
.
add_layer
(
"reshape"
,
inputs
=
index
,
output
=
index
,
param_attr
=
reshape_attr
)
"reshape"
,
inputs
=
{
'input'
:
embeddings
,
'index'
:
index
}
inputs
=
index
,
output
=
reshape_name
,
param_attr
=
reshape_attr
)
inputs
=
{
'input'
:
embeddings
,
'index'
:
reshape_name
}
node
.
fluid_code
.
add_layer
(
node
.
fluid_code
.
add_layer
(
"gather"
,
inputs
=
inputs
,
output
=
node
,
param_attr
=
attr
)
"gather"
,
inputs
=
inputs
,
output
=
node
,
param_attr
=
attr
)
if
len
(
index
.
out_shapes
[
0
])
!=
1
:
reshape_attr
=
{
"shape"
:
reshape_list
+
[
embeddings_shape
]}
node
.
fluid_code
.
add_layer
(
"reshape"
,
inputs
=
node
,
output
=
node
,
param_attr
=
reshape_attr
)
def
OneShotIterator
(
self
,
node
):
def
OneShotIterator
(
self
,
node
):
return
self
.
Placeholder
(
node
)
return
self
.
Placeholder
(
node
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录