Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59b864e

Browse files
authored
Added OnnxCntkImport.ipynb tutorial
1 parent 3311b78 commit 59b864e

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

tutorials/OnnxCntkImport.ipynb

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Importing models from ONNX to CNTK"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"In this tutorial, we will demonstrate how to import ONNX models into CNTK."
15+
]
16+
},
17+
{
18+
"cell_type": "markdown",
19+
"metadata": {},
20+
"source": [
21+
"## Installation"
22+
]
23+
},
24+
{
25+
"cell_type": "markdown",
26+
"metadata": {},
27+
"source": [
28+
"To export to ONNX, simply make sure you have CNTK 2.3 or higher installed. <br>\n",
29+
"Follow CNTK installation instructions __[here](https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-your-machine)__."
30+
]
31+
},
32+
{
33+
"cell_type": "markdown",
34+
"metadata": {},
35+
"source": [
36+
"## Importing in Python"
37+
]
38+
},
39+
{
40+
"cell_type": "markdown",
41+
"metadata": {},
42+
"source": [
43+
"To load an ONNX model, specify the ONNX format for the format parameter of the load function."
44+
]
45+
},
46+
{
47+
"cell_type": "markdown",
48+
"metadata": {},
49+
"source": [
50+
"```python\n",
51+
"import cntk as C\n",
52+
"\n",
53+
"z = C.Function.load(<path of your ONNX model>, format=C.ModelFormat.ONNX)\n",
54+
"```"
55+
]
56+
},
57+
{
58+
"cell_type": "markdown",
59+
"metadata": {},
60+
"source": [
61+
"## Importing in C# #"
62+
]
63+
},
64+
{
65+
"cell_type": "markdown",
66+
"metadata": {},
67+
"source": [
68+
"```csharp\n",
69+
"Function modelFunc = Function.load(<path of your ONNX model>, ModelFormat.ONNX);\n",
70+
"```"
71+
]
72+
}
73+
],
74+
"metadata": {
75+
"kernelspec": {
76+
"display_name": "Python [Root]",
77+
"language": "python",
78+
"name": "Python [Root]"
79+
},
80+
"language_info": {
81+
"codemirror_mode": {
82+
"name": "ipython",
83+
"version": 3
84+
},
85+
"file_extension": ".py",
86+
"mimetype": "text/x-python",
87+
"name": "python",
88+
"nbconvert_exporter": "python",
89+
"pygments_lexer": "ipython3",
90+
"version": "3.5.2"
91+
}
92+
},
93+
"nbformat": 4,
94+
"nbformat_minor": 0
95+
}

0 commit comments

Comments
 (0)