diff --git a/README.md b/README.md index e73b844..dec397e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ | --- | --- | --- | --- | | [Caffe2](http://caffe2.ai) | [onnx/onnx-caffe2](https://github.com/onnx/onnx-caffe2) | [Exporting](tutorials/Caffe2OnnxExport.ipynb) | [Importing](tutorials/OnnxCaffe2Import.ipynb) | | [PyTorch](http://pytorch.org/) | [part of pytorch package](http://pytorch.org/docs/master/onnx.html) | [Exporting](tutorials/PytorchOnnxExport.ipynb), [Extending support](tutorials/PytorchAddExportSupport.md) | coming soon | -| [CNTK](https://github.com/Microsoft/CNTK) | coming soon | coming soon | coming soon | +| [CNTK](https://github.com/Microsoft/CNTK) | [part of CNTK](https://docs.microsoft.com/en-us/cognitive-toolkit/setup-cntk-on-your-machine) | [Exporting](tutorials/CntkOnnxExport.ipynb) | [Importing](tutorials/OnnxCntkImport.ipynb) | | [Apache MXNet](http://mxnet.incubator.apache.org/) | [onnx/onnx-mxnet](https://github.com/onnx/onnx-mxnet) | coming soon | [Importing](tutorials/OnnxMxnetImport.ipynb) [experimental] | | [TensorFlow](https://www.tensorflow.org/) | [onnx/onnx-tensorflow](https://github.com/onnx/onnx-tensorflow) | coming soon | [Importing](tutorials/OnnxTensorflowImport.ipynb) [experimental] | | [Apple CoreML](https://developer.apple.com/documentation/coreml) | [onnx/onnx-coreml](https://github.com/onnx/onnx-coreml) | - | [Importing](tutorials/OnnxCoremlImport.ipynb) | diff --git a/tutorials/CntkOnnxExport.ipynb b/tutorials/CntkOnnxExport.ipynb new file mode 100644 index 0000000..e5068cf --- /dev/null +++ b/tutorials/CntkOnnxExport.ipynb @@ -0,0 +1,100 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Exporting models from CNTK to ONNX" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this tutorial, we will demonstrate how to export a CNTK model to the ONNX format." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Installation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To export to ONNX, simply make sure you have CNTK 2.3 or higher installed.
\n", + "Follow CNTK installation instructions __[here](https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-your-machine)__." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exporting in Python" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To save a CNTK model to the ONNX format, specify the ONNX format in the format parameter of the save function." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "```python\n", + "import cntk as C\n", + "\n", + "x = C.input_variable()\n", + "z = create_model(x)\n", + "z.save(, format=C.ModelFormat.ONNX)\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exporting in C# #" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "```csharp\n", + "var x = CNTKLib.InputVariable();\n", + "Function z = CreateModel(x);\n", + "z.Save(, ModelFormat.ONNX);\n", + "```\n" + ] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Python [Root]", + "language": "python", + "name": "Python [Root]" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/tutorials/OnnxCntkImport.ipynb b/tutorials/OnnxCntkImport.ipynb new file mode 100644 index 0000000..7969c65 --- /dev/null +++ b/tutorials/OnnxCntkImport.ipynb @@ -0,0 +1,95 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Importing models from ONNX to CNTK" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this tutorial, we will demonstrate how to import ONNX models into CNTK." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Installation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To export to ONNX, simply make sure you have CNTK 2.3 or higher installed.
\n", + "Follow CNTK installation instructions __[here](https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-your-machine)__." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Importing in Python" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To load an ONNX model, specify the ONNX format for the format parameter of the load function." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "```python\n", + "import cntk as C\n", + "\n", + "z = C.Function.load(, format=C.ModelFormat.ONNX)\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Importing in C# #" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "```csharp\n", + "Function modelFunc = Function.load(, ModelFormat.ONNX);\n", + "```" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python [Root]", + "language": "python", + "name": "Python [Root]" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +}