Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
00df570e
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看板
提交
00df570e
编写于
7月 25, 2022
作者:
W
wjj19950828
浏览文件
操作
浏览文件
下载
差异文件
resolve conflict
上级
a957c928
38cd5e17
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
36 addition
and
30 deletion
+36
-30
docs/pytorch_project_convertor/API_docs/vision/torchvision.utils.save_image.md
...convertor/API_docs/vision/torchvision.utils.save_image.md
+4
-5
x2paddle/__init__.py
x2paddle/__init__.py
+1
-1
x2paddle/op_mapper/onnx2paddle/onnx_op_mapper.py
x2paddle/op_mapper/onnx2paddle/onnx_op_mapper.py
+10
-2
x2paddle/op_mapper/onnx2paddle/opset/__init__.py
x2paddle/op_mapper/onnx2paddle/opset/__init__.py
+0
-9
x2paddle/op_mapper/onnx2paddle/opset10.py
x2paddle/op_mapper/onnx2paddle/opset10.py
+1
-1
x2paddle/op_mapper/onnx2paddle/opset11.py
x2paddle/op_mapper/onnx2paddle/opset11.py
+1
-1
x2paddle/op_mapper/onnx2paddle/opset12.py
x2paddle/op_mapper/onnx2paddle/opset12.py
+1
-1
x2paddle/op_mapper/onnx2paddle/opset13.py
x2paddle/op_mapper/onnx2paddle/opset13.py
+1
-1
x2paddle/op_mapper/onnx2paddle/opset14.py
x2paddle/op_mapper/onnx2paddle/opset14.py
+1
-1
x2paddle/op_mapper/onnx2paddle/opset15.py
x2paddle/op_mapper/onnx2paddle/opset15.py
+1
-1
x2paddle/op_mapper/onnx2paddle/opset7.py
x2paddle/op_mapper/onnx2paddle/opset7.py
+1
-1
x2paddle/op_mapper/onnx2paddle/opset8.py
x2paddle/op_mapper/onnx2paddle/opset8.py
+1
-1
x2paddle/op_mapper/onnx2paddle/opset9.py
x2paddle/op_mapper/onnx2paddle/opset9.py
+1
-1
x2paddle/op_mapper/onnx2paddle/opset_legacy.py
x2paddle/op_mapper/onnx2paddle/opset_legacy.py
+0
-0
x2paddle/op_mapper/pytorch2paddle/prim2code.py
x2paddle/op_mapper/pytorch2paddle/prim2code.py
+9
-4
x2paddle/project_convertor/pytorch/torch2paddle/tensor.py
x2paddle/project_convertor/pytorch/torch2paddle/tensor.py
+3
-0
未找到文件。
docs/pytorch_project_convertor/API_docs/vision/torchvision.utils.save_image.md
浏览文件 @
00df570e
...
...
@@ -46,11 +46,10 @@ def make_grid(tensor: Union[paddle.Tensor, List[paddle.Tensor]],
if
tensor
.
dim
()
==
2
:
# single image H x W
tensor
=
tensor
.
unsqueeze
(
0
)
if
tensor
.
dim
()
==
3
:
# single image
if
tensor
.
s
ize
(
0
)
==
1
:
# if single-channel, convert to 3-channel
if
tensor
.
s
hape
[
0
]
==
1
:
# if single-channel, convert to 3-channel
tensor
=
paddle
.
concat
((
tensor
,
tensor
,
tensor
),
0
)
tensor
=
tensor
.
unsqueeze
(
0
)
if
tensor
.
dim
()
==
4
and
tensor
.
size
(
1
)
==
1
:
# single-channel images
if
tensor
.
dim
()
==
4
and
tensor
.
shape
[
1
]
==
1
:
# single-channel images
tensor
=
paddle
.
concat
((
tensor
,
tensor
,
tensor
),
1
)
if
normalize
is
True
:
...
...
@@ -75,11 +74,11 @@ def make_grid(tensor: Union[paddle.Tensor, List[paddle.Tensor]],
else
:
norm_range
(
tensor
,
value_range
)
if
tensor
.
s
ize
(
0
)
==
1
:
if
tensor
.
s
hape
[
0
]
==
1
:
return
tensor
.
squeeze
(
0
)
# make the mini-batch of images into a grid
nmaps
=
tensor
.
s
ize
(
0
)
nmaps
=
tensor
.
s
hape
[
0
]
xmaps
=
min
(
nrow
,
nmaps
)
ymaps
=
int
(
math
.
ceil
(
float
(
nmaps
)
/
xmaps
))
height
,
width
=
int
(
tensor
.
shape
[
2
]
+
padding
),
int
(
tensor
.
shape
[
3
]
+
...
...
x2paddle/__init__.py
浏览文件 @
00df570e
__version__
=
"1.3.
7
"
__version__
=
"1.3.
8
"
from
.core.program
import
PaddleGraph
...
...
x2paddle/op_mapper/onnx2paddle/onnx_op_mapper.py
浏览文件 @
00df570e
# Copyright (c) 20
19
PaddlePaddle Authors. All Rights Reserved.
# Copyright (c) 20
22
PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
...
...
@@ -13,7 +13,15 @@
# limitations under the License.
import
sys
from
x2paddle.op_mapper.onnx2paddle.opset
import
OpSet7
,
OpSet8
,
OpSet9
,
OpSet10
,
OpSet11
,
OpSet12
,
OpSet13
,
OpSet14
,
OpSet15
from
.opset7
import
OpSet7
from
.opset8
import
OpSet8
from
.opset9
import
OpSet9
from
.opset10
import
OpSet10
from
.opset11
import
OpSet11
from
.opset12
import
OpSet12
from
.opset13
import
OpSet13
from
.opset14
import
OpSet14
from
.opset15
import
OpSet15
from
x2paddle.decoder.onnx_decoder
import
ONNXGraphNode
from
x2paddle.core.program
import
PaddleGraph
...
...
x2paddle/op_mapper/onnx2paddle/opset/__init__.py
已删除
100644 → 0
浏览文件 @
a957c928
from
.opset7
import
OpSet7
from
.opset8
import
OpSet8
from
.opset9
import
OpSet9
from
.opset10
import
OpSet10
from
.opset11
import
OpSet11
from
.opset12
import
OpSet12
from
.opset13
import
OpSet13
from
.opset14
import
OpSet14
from
.opset15
import
OpSet15
x2paddle/op_mapper/onnx2paddle/opset
/opset
10.py
→
x2paddle/op_mapper/onnx2paddle/opset10.py
浏览文件 @
00df570e
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
.opset
import
OpSet
from
.opset
_legacy
import
OpSet
class
OpSet10
(
OpSet
):
...
...
x2paddle/op_mapper/onnx2paddle/opset
/opset
11.py
→
x2paddle/op_mapper/onnx2paddle/opset11.py
浏览文件 @
00df570e
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
.opset
import
OpSet
from
.opset
_legacy
import
OpSet
class
OpSet11
(
OpSet
):
...
...
x2paddle/op_mapper/onnx2paddle/opset
/opset
12.py
→
x2paddle/op_mapper/onnx2paddle/opset12.py
浏览文件 @
00df570e
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
.opset
import
OpSet
from
.opset
_legacy
import
OpSet
class
OpSet12
(
OpSet
):
...
...
x2paddle/op_mapper/onnx2paddle/opset
/opset
13.py
→
x2paddle/op_mapper/onnx2paddle/opset13.py
浏览文件 @
00df570e
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
.opset
import
OpSet
from
.opset
_legacy
import
OpSet
class
OpSet13
(
OpSet
):
...
...
x2paddle/op_mapper/onnx2paddle/opset
/opset
14.py
→
x2paddle/op_mapper/onnx2paddle/opset14.py
浏览文件 @
00df570e
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
.opset
import
OpSet
from
.opset
_legacy
import
OpSet
class
OpSet14
(
OpSet
):
...
...
x2paddle/op_mapper/onnx2paddle/opset
/opset
15.py
→
x2paddle/op_mapper/onnx2paddle/opset15.py
浏览文件 @
00df570e
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
.opset
import
OpSet
from
.opset
_legacy
import
OpSet
class
OpSet15
(
OpSet
):
...
...
x2paddle/op_mapper/onnx2paddle/opset
/opset
7.py
→
x2paddle/op_mapper/onnx2paddle/opset7.py
浏览文件 @
00df570e
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
.opset
import
OpSet
from
.opset
_legacy
import
OpSet
class
OpSet7
(
OpSet
):
...
...
x2paddle/op_mapper/onnx2paddle/opset
/opset
8.py
→
x2paddle/op_mapper/onnx2paddle/opset8.py
浏览文件 @
00df570e
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
.opset
import
OpSet
from
.opset
_legacy
import
OpSet
class
OpSet8
(
OpSet
):
...
...
x2paddle/op_mapper/onnx2paddle/opset
/opset
9.py
→
x2paddle/op_mapper/onnx2paddle/opset9.py
浏览文件 @
00df570e
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
.opset
import
OpSet
from
.opset
_legacy
import
OpSet
class
OpSet9
(
OpSet
):
...
...
x2paddle/op_mapper/onnx2paddle/opset
/opset
.py
→
x2paddle/op_mapper/onnx2paddle/opset
_legacy
.py
100755 → 100644
浏览文件 @
00df570e
文件已移动
x2paddle/op_mapper/pytorch2paddle/prim2code.py
浏览文件 @
00df570e
...
...
@@ -72,10 +72,15 @@ def prim_add_(layer,
forward_func
=
[],
layer_id
=
None
,
different_attrs
=
None
):
line
=
"{} = {} + {} * {}"
.
format
(
layer
.
outputs
[
0
],
get_value
(
layer
,
"x"
,
different_attrs
),
layer
.
attrs
[
"alpha"
],
get_value
(
layer
,
"y"
,
different_attrs
))
if
abs
(
layer
.
attrs
[
"alpha"
]
-
1.
)
<
1e-6
:
line
=
"{} = {} + {}"
.
format
(
layer
.
outputs
[
0
],
get_value
(
layer
,
"x"
,
different_attrs
),
get_value
(
layer
,
"y"
,
different_attrs
))
else
:
line
=
"{} = {} + {} * {}"
.
format
(
layer
.
outputs
[
0
],
get_value
(
layer
,
"x"
,
different_attrs
),
layer
.
attrs
[
"alpha"
],
get_value
(
layer
,
"y"
,
different_attrs
))
forward_func
.
extend
(
gen_codes
([
line
],
indent
=
indent
))
...
...
x2paddle/project_convertor/pytorch/torch2paddle/tensor.py
浏览文件 @
00df570e
...
...
@@ -169,6 +169,9 @@ pd_reshape = partial(paddle.Tensor.reshape)
@
add_tensor_function
def
reshape
(
self
,
*
shape
):
# deal with list or tuple type
if
isinstance
(
shape
,
(
list
,
tuple
)):
shape
=
shape
[
0
]
return
pd_reshape
(
self
,
shape
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录