Skip to content

Commit 4d401fc

Browse files
committed
fixed readme
2 parents c442b87 + 27d7040 commit 4d401fc

12 files changed

Lines changed: 458 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## 简介
1212

13-
X2Paddle是飞桨生态下的模型转换工具,致力于帮助其它深度学习框架用户快速迁移至飞桨框架。目前支持**推理模型的框架转换****PyTorch训练代码迁移**,我们还提供了详细的不同框架间API对比文档,降低开发者上手飞桨核心的学习成本
13+
X2Paddle是飞桨生态下的模型转换工具,致力于帮助其它深度学习框架用户快速迁移至飞桨框架。目前支持**推理模型的框架转换****PyTorch训练代码迁移**,我们还提供了详细的不同框架间API对比文档,降低开发者将模型迁移到飞桨的时间成本
1414

1515

1616

@@ -22,7 +22,7 @@ X2Paddle是飞桨生态下的模型转换工具,致力于帮助其它深度学
2222

2323
- **支持的模型丰富**
2424

25-
- 在主流的CV和NLP模型上均支持转换,涵盖了19+个Caffe预测模型转换、27+个TensorFlow预测模型转换、32+个ONNX预测模型转换、27+个PyTorch预测模型转换、2+个PyTorch训练项目转换,详见 ***[支持列表](./docs/introduction/x2paddle_model_zoo.md)***
25+
- 在主流的CV和NLP模型上支持大部分模型转换,目前X2Paddle支持130+ PyTorch OP,90+ ONNX OP,90+ TensorFlow OP 以及 30+ Caffe OP,详见 ***[支持列表](./docs/inference_model_convertor/op_list.md)***
2626

2727
- **简洁易用**
2828

docs/inference_model_convertor/op_list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# X2Paddle支持OP列表
2-
> 目前X2Paddle支持90+的TensorFlow OP,30+的Caffe Layer,80+的ONNX OP,120+的PyTorch Aten,10+的PyTorch Prim覆盖了大部分CV分类模型常用的操作。我们在如下列表中给出了目前X2Paddle支持的全部OP。
2+
> 目前X2Paddle支持90+ TensorFlow OP,30+ Caffe OP,90+ ONNX OP,130+ PyTorch OP,覆盖了大部分CV分类模型常用的操作。我们在如下列表中给出了目前X2Paddle支持的全部OP。
33
44
**注:** 目前,部分OP暂未支持,如您在转换过程中出现OP不支持的情况,可自行添加或反馈给我们。欢迎通过[ISSUE反馈](https://github.com/PaddlePaddle/X2Paddle/issues/new)的方式告知我们(模型名,代码实现或模型获取方式),我们会及时跟进:)
55

tests/onnx/test_auto_scan_conv2d.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
from auto_scan_test import OPConvertAutoScanTest
1616
from hypothesis import reproduce_failure
1717
import hypothesis.strategies as st
18-
import onnx
19-
from onnx import helper
20-
from onnx import TensorProto
2118
import numpy as np
2219
import unittest
2320

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from auto_scan_test import OPConvertAutoScanTest
16+
from hypothesis import reproduce_failure
17+
import hypothesis.strategies as st
18+
import numpy as np
19+
import unittest
20+
import random
21+
22+
23+
class TestHardSigmoidCovert(OPConvertAutoScanTest):
24+
"""
25+
ONNX op: HardSigmoid
26+
OPset version: 7~15
27+
"""
28+
29+
def sample_convert_config(self, draw):
30+
input_shape = draw(
31+
st.lists(
32+
st.integers(
33+
min_value=2, max_value=6), min_size=2, max_size=5))
34+
input_dtype = draw(st.sampled_from(["float32"]))
35+
36+
alpha = random.random()
37+
38+
beta = random.random()
39+
40+
config = {
41+
"op_names": ["HardSigmoid"],
42+
"test_data_shapes": [input_shape],
43+
"test_data_types": [[input_dtype]],
44+
"inputs_shape": [input_shape],
45+
"min_opset_version": 7,
46+
"inputs_name": ["x"],
47+
"outputs_name": ["y"],
48+
"delta": 1e-4,
49+
"rtol": 1e-4
50+
}
51+
52+
attrs = {
53+
"alpha": alpha,
54+
"beta": beta,
55+
}
56+
57+
return (config, attrs)
58+
59+
def test(self):
60+
self.run_and_statis(max_examples=30)
61+
62+
63+
if __name__ == "__main__":
64+
unittest.main()

tests/onnx/test_auto_scan_isinf.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from auto_scan_test import OPConvertAutoScanTest
16+
from hypothesis import reproduce_failure
17+
import hypothesis.strategies as st
18+
import numpy as np
19+
import unittest
20+
import random
21+
22+
23+
class TestIsInfConvert(OPConvertAutoScanTest):
24+
"""
25+
ONNX op: IsInf
26+
OPset version: 10~15
27+
"""
28+
29+
def sample_convert_config(self, draw):
30+
input_shape = draw(
31+
st.lists(
32+
st.integers(
33+
min_value=20, max_value=30), min_size=3, max_size=5))
34+
input_dtype = draw(st.sampled_from(["float32"]))
35+
config = {
36+
"op_names": ["IsInf"],
37+
"test_data_shapes": [input_shape],
38+
"test_data_types": [input_dtype],
39+
"inputs_shape": [input_shape],
40+
"min_opset_version": 10,
41+
"max_opset_version": 15,
42+
"inputs_name": ["x"],
43+
"outputs_name": ["y"],
44+
"delta": 1e-4,
45+
"rtol": 1e-4,
46+
"run_dynamic": True,
47+
}
48+
49+
attrs = {}
50+
return (config, attrs)
51+
52+
def test(self):
53+
self.run_and_statis(max_examples=50)
54+
55+
56+
if __name__ == "__main__":
57+
unittest.main()

tests/onnx/test_auto_scan_isnan.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from auto_scan_test import OPConvertAutoScanTest
16+
from hypothesis import reproduce_failure
17+
import hypothesis.strategies as st
18+
import numpy as np
19+
import unittest
20+
import random
21+
22+
23+
class TestIsNaNConcert(OPConvertAutoScanTest):
24+
"""
25+
ONNX op: IsNaN
26+
OPset version: 9~15
27+
"""
28+
29+
def sample_convert_config(self, draw):
30+
input_shape = draw(
31+
st.lists(
32+
st.integers(
33+
min_value=20, max_value=30), min_size=3, max_size=5))
34+
input_dtype = draw(st.sampled_from(["float32"]))
35+
36+
config = {
37+
"op_names": ["IsNaN", ],
38+
"test_data_shapes": [input_shape],
39+
"test_data_types": [input_dtype],
40+
"inputs_shape": [input_shape],
41+
"min_opset_version": 9,
42+
"inputs_name": ["x"],
43+
"outputs_name": ["y"],
44+
"delta": 1e-4,
45+
"rtol": 1e-4,
46+
"run_dynamic": True,
47+
}
48+
attrs = {}
49+
return (config, attrs)
50+
51+
def test(self):
52+
self.run_and_statis(max_examples=50)
53+
54+
55+
if __name__ == "__main__":
56+
unittest.main()
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from auto_scan_test import OPConvertAutoScanTest
16+
from hypothesis import reproduce_failure
17+
import hypothesis.strategies as st
18+
import numpy as np
19+
import unittest
20+
import random
21+
22+
23+
class TestReduceOpsConvert(OPConvertAutoScanTest):
24+
"""
25+
ONNX op: Reduce Ops
26+
OPset version: 7~15
27+
"""
28+
29+
def sample_convert_config(self, draw):
30+
input_shape = draw(
31+
st.lists(
32+
st.integers(
33+
min_value=20, max_value=30), min_size=3, max_size=5))
34+
35+
input_dtype = draw(st.sampled_from(["float32", "int32", "int64"]))
36+
37+
axes = draw(
38+
st.lists(
39+
st.integers(
40+
min_value=-len(input_shape), max_value=len(input_shape) -
41+
1),
42+
min_size=1,
43+
max_size=1))
44+
45+
keep_dim = draw(st.integers(min_value=0, max_value=1))
46+
config = {
47+
"op_names": ["ReduceL1", "ReduceL2"],
48+
"test_data_shapes": [input_shape],
49+
"test_data_types": [input_dtype],
50+
"inputs_shape": [input_shape],
51+
"min_opset_version": 7,
52+
"max_opset_version": 15,
53+
"inputs_name": ["x"],
54+
"outputs_name": ["y"],
55+
"delta": 1e-4,
56+
"rtol": 1e-4,
57+
}
58+
59+
attrs = {
60+
"axes": axes,
61+
"keepdims": keep_dim,
62+
}
63+
64+
return (config, attrs)
65+
66+
def test(self):
67+
self.run_and_statis(max_examples=50)
68+
69+
70+
if __name__ == "__main__":
71+
unittest.main()

tests/onnx/test_auto_scan_sum_7.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from auto_scan_test import OPConvertAutoScanTest
16+
from hypothesis import reproduce_failure
17+
from onnxbase import randtool
18+
import hypothesis.strategies as st
19+
import numpy as np
20+
import unittest
21+
22+
23+
class TestSumConvert(OPConvertAutoScanTest):
24+
"""
25+
ONNX op: Sum
26+
OPset version: 7
27+
"""
28+
29+
def sample_convert_config(self, draw):
30+
input1_shape = draw(
31+
st.lists(
32+
st.integers(
33+
min_value=10, max_value=20), min_size=2, max_size=4))
34+
35+
input_dtype = draw(st.sampled_from(["float32"]))
36+
37+
config = {
38+
"op_names": ["Sum"],
39+
"test_data_shapes": [input1_shape, input1_shape],
40+
"test_data_types": [[input_dtype], [input_dtype]],
41+
"inputs_shape": [],
42+
"min_opset_version": 7,
43+
"max_opset_version": 7,
44+
"inputs_name": ["x", "y"],
45+
"outputs_name": ["z"],
46+
"delta": 1e-4,
47+
"rtol": 1e-4
48+
}
49+
50+
attrs = {}
51+
52+
return (config, attrs)
53+
54+
def test(self):
55+
self.run_and_statis(max_examples=30)
56+
57+
58+
if __name__ == "__main__":
59+
unittest.main()

0 commit comments

Comments
 (0)