Skip to content

Commit ad96f22

Browse files
garymmjcwchen
andauthored
Examples: Update to python 3 (onnx#3450)
I think python 2 isn't supported anymore (see onnx/sklearn-onnx#336). Signed-off-by: Gary Miguel <garymiguel@microsoft.com> Co-authored-by: Chun-Wei Chen <jacky82226@gmail.com>
1 parent 8d15ccc commit ad96f22

6 files changed

+35
-65
lines changed

onnx/examples/check_model.ipynb

+5-10
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@
6161
}
6262
],
6363
"source": [
64-
"from __future__ import absolute_import\n",
65-
"from __future__ import division\n",
66-
"from __future__ import print_function\n",
67-
"from __future__ import unicode_literals\n",
68-
"\n",
6964
"import onnx\n",
7065
"import os\n",
7166
"\n",
@@ -99,21 +94,21 @@
9994
],
10095
"metadata": {
10196
"kernelspec": {
102-
"display_name": "Python 2",
97+
"display_name": "Python 3",
10398
"language": "python",
104-
"name": "python2"
99+
"name": "python3"
105100
},
106101
"language_info": {
107102
"codemirror_mode": {
108103
"name": "ipython",
109-
"version": 2
104+
"version": 3
110105
},
111106
"file_extension": ".py",
112107
"mimetype": "text/x-python",
113108
"name": "python",
114109
"nbconvert_exporter": "python",
115-
"pygments_lexer": "ipython2",
116-
"version": "2.7.5"
110+
"pygments_lexer": "ipython3",
111+
"version": "3.9.2"
117112
}
118113
},
119114
"nbformat": 4,

onnx/examples/load_model.ipynb

+5-10
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@
6060
}
6161
],
6262
"source": [
63-
"from __future__ import absolute_import\n",
64-
"from __future__ import division\n",
65-
"from __future__ import print_function\n",
66-
"from __future__ import unicode_literals\n",
67-
"\n",
6863
"import onnx\n",
6964
"import os\n",
7065
"\n",
@@ -77,21 +72,21 @@
7772
],
7873
"metadata": {
7974
"kernelspec": {
80-
"display_name": "Python 2",
75+
"display_name": "Python 3",
8176
"language": "python",
82-
"name": "python2"
77+
"name": "python3"
8378
},
8479
"language_info": {
8580
"codemirror_mode": {
8681
"name": "ipython",
87-
"version": 2
82+
"version": 3
8883
},
8984
"file_extension": ".py",
9085
"mimetype": "text/x-python",
9186
"name": "python",
9287
"nbconvert_exporter": "python",
93-
"pygments_lexer": "ipython2",
94-
"version": "2.7.5"
88+
"pygments_lexer": "ipython3",
89+
"version": "3.9.2"
9590
}
9691
},
9792
"nbformat": 4,

onnx/examples/make_model.ipynb

+10-15
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"The graph in model:\n",
1515
"node {\n",
1616
" input: \"X\"\n",
17-
" input: \"Pads\"\n",
17+
" input: \"Pads\"\n",
1818
" output: \"Y\"\n",
1919
" op_type: \"Pad\"\n",
2020
" attribute {\n",
@@ -25,14 +25,14 @@
2525
"}\n",
2626
"name: \"test-model\"\n",
2727
"initializer {\n",
28-
" dims: 4\n",
28+
" dims: 4\n",
2929
" data_type: 7\n",
3030
" int64_data: 0\n",
3131
" int64_data: 0\n",
3232
" int64_data: 1\n",
3333
" int64_data: 1\n",
3434
" name: \"Pads\"\n",
35-
"}\n",
35+
"}\n",
3636
"input {\n",
3737
" name: \"X\"\n",
3838
" type {\n",
@@ -61,7 +61,7 @@
6161
" }\n",
6262
" }\n",
6363
" }\n",
64-
"}\n",
64+
"}\n",
6565
"output {\n",
6666
" name: \"Y\"\n",
6767
" type {\n",
@@ -84,11 +84,6 @@
8484
}
8585
],
8686
"source": [
87-
"from __future__ import absolute_import\n",
88-
"from __future__ import division\n",
89-
"from __future__ import print_function\n",
90-
"from __future__ import unicode_literals\n",
91-
"\n",
9287
"import onnx\n",
9388
"from onnx import helper\n",
9489
"from onnx import AttributeProto, TensorProto, GraphProto\n",
@@ -103,7 +98,7 @@
10398
"\n",
10499
"# Create second input (ValueInfoProto)\n",
105100
"Pads = helper.make_tensor_value_info('Pads', TensorProto.INT64, [4])\n",
106-
"\n",
101+
"\n",
107102
"# Create one output (ValueInfoProto)\n",
108103
"Y = helper.make_tensor_value_info('Y', TensorProto.FLOAT, [1, 4])\n",
109104
"\n",
@@ -137,21 +132,21 @@
137132
],
138133
"metadata": {
139134
"kernelspec": {
140-
"display_name": "Python 2",
135+
"display_name": "Python 3",
141136
"language": "python",
142-
"name": "python2"
137+
"name": "python3"
143138
},
144139
"language_info": {
145140
"codemirror_mode": {
146141
"name": "ipython",
147-
"version": 2
142+
"version": 3
148143
},
149144
"file_extension": ".py",
150145
"mimetype": "text/x-python",
151146
"name": "python",
152147
"nbconvert_exporter": "python",
153-
"pygments_lexer": "ipython2",
154-
"version": "2.7.5"
148+
"pygments_lexer": "ipython3",
149+
"version": "3.9.2"
155150
}
156151
},
157152
"nbformat": 4,

onnx/examples/np_array_tensorproto.ipynb

+5-10
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
}
1818
],
1919
"source": [
20-
"from __future__ import absolute_import\n",
21-
"from __future__ import division\n",
22-
"from __future__ import print_function\n",
23-
"from __future__ import unicode_literals\n",
24-
"\n",
2520
"import numpy\n",
2621
"import onnx\n",
2722
"import os\n",
@@ -126,21 +121,21 @@
126121
],
127122
"metadata": {
128123
"kernelspec": {
129-
"display_name": "Python 2",
124+
"display_name": "Python 3",
130125
"language": "python",
131-
"name": "python2"
126+
"name": "python3"
132127
},
133128
"language_info": {
134129
"codemirror_mode": {
135130
"name": "ipython",
136-
"version": 2
131+
"version": 3
137132
},
138133
"file_extension": ".py",
139134
"mimetype": "text/x-python",
140135
"name": "python",
141136
"nbconvert_exporter": "python",
142-
"pygments_lexer": "ipython2",
143-
"version": "2.7.5"
137+
"pygments_lexer": "ipython3",
138+
"version": "3.9.2"
144139
}
145140
},
146141
"nbformat": 4,

onnx/examples/save_model.ipynb

+5-10
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
}
1515
],
1616
"source": [
17-
"from __future__ import absolute_import\n",
18-
"from __future__ import division\n",
19-
"from __future__ import print_function\n",
20-
"from __future__ import unicode_literals\n",
21-
"\n",
2217
"import onnx\n",
2318
"import os\n",
2419
"\n",
@@ -39,21 +34,21 @@
3934
],
4035
"metadata": {
4136
"kernelspec": {
42-
"display_name": "Python 2",
37+
"display_name": "Python 3",
4338
"language": "python",
44-
"name": "python2"
39+
"name": "python3"
4540
},
4641
"language_info": {
4742
"codemirror_mode": {
4843
"name": "ipython",
49-
"version": 2
44+
"version": 3
5045
},
5146
"file_extension": ".py",
5247
"mimetype": "text/x-python",
5348
"name": "python",
5449
"nbconvert_exporter": "python",
55-
"pygments_lexer": "ipython2",
56-
"version": "2.7.5"
50+
"pygments_lexer": "ipython3",
51+
"version": "3.9.2"
5752
}
5853
},
5954
"nbformat": 4,

onnx/examples/shape_inference.ipynb

+5-10
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@
1515
}
1616
],
1717
"source": [
18-
"from __future__ import absolute_import\n",
19-
"from __future__ import division\n",
20-
"from __future__ import print_function\n",
21-
"from __future__ import unicode_literals\n",
22-
"\n",
2318
"import onnx\n",
2419
"from onnx import helper, shape_inference\n",
2520
"from onnx import TensorProto\n",
@@ -86,21 +81,21 @@
8681
],
8782
"metadata": {
8883
"kernelspec": {
89-
"display_name": "Python 2",
84+
"display_name": "Python 3",
9085
"language": "python",
91-
"name": "python2"
86+
"name": "python3"
9287
},
9388
"language_info": {
9489
"codemirror_mode": {
9590
"name": "ipython",
96-
"version": 2
91+
"version": 3
9792
},
9893
"file_extension": ".py",
9994
"mimetype": "text/x-python",
10095
"name": "python",
10196
"nbconvert_exporter": "python",
102-
"pygments_lexer": "ipython2",
103-
"version": "2.7.5"
97+
"pygments_lexer": "ipython3",
98+
"version": "3.9.2"
10499
}
105100
},
106101
"nbformat": 4,

0 commit comments

Comments
 (0)