New NCSDK2 2.04 release
authorEman Copty <eman.copty@intel.com>
Fri, 4 May 2018 21:40:23 +0000 (14:40 -0700)
committerEman Copty <eman.copty@intel.com>
Fri, 4 May 2018 22:40:09 +0000 (15:40 -0700)
288 files changed:
ATTRIBUTIONS [new file with mode: 0644]
Makefile
api/include/fp16.h [new file with mode: 0644]
api/include/mvnc.h
api/include/mvnc_deprecated.h [deleted file]
api/include/ncCommPrivate.h [new file with mode: 0644]
api/include/ncPrivateTypes.h [new file with mode: 0644]
api/python/mvnc/mvncapi.py
api/src/97-usbboot.rules
api/src/Makefile
api/src/Makefile.rpi [deleted file]
api/src/USBLinkDefines.h [deleted file]
api/src/common.h [deleted file]
api/src/common/components/XLink/pc/UsbLinkPlatform.c [new file with mode: 0644]
api/src/common/components/XLink/pc/usb_boot.c [new file with mode: 0644]
api/src/common/components/XLink/pc/usb_boot.h [new file with mode: 0644]
api/src/common/components/XLink/shared/UsbLinkPlatform.h [new file with mode: 0644]
api/src/common/components/XLink/shared/XLink.c [new file with mode: 0644]
api/src/common/components/XLink/shared/XLink.h [new file with mode: 0644]
api/src/common/components/XLink/shared/XLinkDispatcher.c [new file with mode: 0644]
api/src/common/components/XLink/shared/XLinkDispatcher.h [new file with mode: 0644]
api/src/common/components/XLink/shared/XLinkPrivateDefines.h [new file with mode: 0644]
api/src/common/components/XLink/shared/XLinkPublicDefines.h [new file with mode: 0644]
api/src/common/components/XLink/shared/XLinkVersion.h [new file with mode: 0644]
api/src/common/components/XLink/shared/subdir.mk [new file with mode: 0644]
api/src/common/components/XLinkConsole/pc/XLinkConsole.c [new file with mode: 0644]
api/src/common/components/XLinkConsole/pc/XLinkConsole.h [new file with mode: 0644]
api/src/common/shared/include/mvLog.h [new file with mode: 0644]
api/src/common/shared/include/mvMacros.h [new file with mode: 0644]
api/src/fp16.c [new file with mode: 0644]
api/src/mvnc_api.c
api/src/usb_boot.c [deleted file]
api/src/usb_boot.h [deleted file]
api/src/usb_link.h [deleted file]
api/src/usb_link_vsc.c [deleted file]
api/src/version.txt [new file with mode: 0644]
docs/Caffe.md [deleted file]
docs/TOC.html [new file with mode: 0644]
docs/TOC.md [deleted file]
docs/TensorFlow.md [deleted file]
docs/VirtualMachineConfig.md [deleted file]
docs/_config.yml [deleted file]
docs/_layouts/default.html [deleted file]
docs/assets/css/style.css [new file with mode: 0644]
docs/assets/css/style.scss [deleted file]
docs/assets/images/checker.png [new file with mode: 0644]
docs/assets/js/scale.fix.js [new file with mode: 0644]
docs/c_api/mvncAllocateGraph.md [deleted file]
docs/c_api/mvncCloseDevice.md [deleted file]
docs/c_api/mvncDeallocateGraph.md [deleted file]
docs/c_api/mvncDeviceOptions.md [deleted file]
docs/c_api/mvncGetDeviceName.md [deleted file]
docs/c_api/mvncGetDeviceOption.md [deleted file]
docs/c_api/mvncGetGlobalOption.md [deleted file]
docs/c_api/mvncGetGraphOption.md [deleted file]
docs/c_api/mvncGetResult.md [deleted file]
docs/c_api/mvncGlobalOptions.md [deleted file]
docs/c_api/mvncGraphOptions.md [deleted file]
docs/c_api/mvncLoadTensor.md [deleted file]
docs/c_api/mvncOpenDevice.md [deleted file]
docs/c_api/mvncSetDeviceOption.md [deleted file]
docs/c_api/mvncSetGlobalOption.md [deleted file]
docs/c_api/mvncSetGraphOption.md [deleted file]
docs/c_api/mvncStatus.md [deleted file]
docs/c_api/readme.md [deleted file]
docs/caffe.html [new file with mode: 0644]
docs/compiler_error.html [new file with mode: 0644]
docs/compiler_error.md [deleted file]
docs/config.rb [new file with mode: 0644]
docs/configure_network.html [new file with mode: 0644]
docs/configure_network.md [deleted file]
docs/docker.html [new file with mode: 0644]
docs/docker_proxy.html [new file with mode: 0644]
docs/forum.md [deleted file]
docs/images/freezegraph_diagram.jpg [new file with mode: 0644]
docs/index.html [new file with mode: 0644]
docs/install.html [new file with mode: 0644]
docs/install.md [deleted file]
docs/jekyll-theme-modernist.gemspec [new file with mode: 0644]
docs/manifest.md [deleted file]
docs/ncapi/c_api_migration.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncAllocateGraph.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncCloseDevice.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncDeallocateGraph.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncDeviceOptions.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncGetDeviceName.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncGetDeviceOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncGetGlobalOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncGetGraphOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncGetResult.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncGlobalOptions.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncGraphOptions.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncLoadTensor.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncOpenDevice.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncSetDeviceOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncSetGlobalOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncSetGraphOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/mvncStatus.html [new file with mode: 0644]
docs/ncapi/ncapi1/c_api/readme.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Device.AllocateGraph.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Device.CloseDevice.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Device.GetDeviceOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Device.OpenDevice.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Device.SetDeviceOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Device.__init__.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Device.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/DeviceOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/EnumerateDevices.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/GetGlobalOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/GlobalOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Graph.DeallocateGraph.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Graph.GetGraphOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Graph.GetResult.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Graph.LoadTensor.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Graph.SetGraphOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Graph.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/GraphOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/SetGlobalOption.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/Status.html [new file with mode: 0644]
docs/ncapi/ncapi1/py_api/readme.html [new file with mode: 0644]
docs/ncapi/ncapi1/readme.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncDeviceClose.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncDeviceCreate.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncDeviceDestroy.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncDeviceGetOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncDeviceHandle_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncDeviceHwVersion_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncDeviceOpen.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncDeviceOption_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncDeviceSetOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncDeviceState_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoAllocate.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoCreate.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoDataType_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoDestroy.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoGetOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoHandle_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoOption_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoReadElem.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoRemoveElem.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoSetOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoState_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoType_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncFifoWriteElem.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGlobalGetOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGlobalOption_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGlobalSetOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphAllocate.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphAllocateWithFifos.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphAllocateWithFifosEx.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphCreate.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphDestroy.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphGetOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphHandle_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphOption_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphQueueInference.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphQueueInferenceWithFifoElem.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphSetOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncGraphState_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncStatus_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/ncTensorDescriptor_t.html [new file with mode: 0644]
docs/ncapi/ncapi2/c_api/readme.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Device.close.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Device.destroy.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Device.get_option.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Device.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Device.open.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Device.set_option.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/DeviceHwVersion.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/DeviceOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/DeviceState.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Fifo.allocate.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Fifo.destroy.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Fifo.get_option.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Fifo.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Fifo.read_elem.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Fifo.remove_elem.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Fifo.set_option.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Fifo.write_elem.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/FifoDataType.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/FifoOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/FifoState.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/FifoType.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/GlobalOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Graph.allocate.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Graph.allocate_with_fifos.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Graph.destroy.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Graph.get_option.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Graph.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Graph.queue_inference.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Graph.queue_inference_with_fifo_elem.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Graph.set_option.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/GraphOption.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/GraphState.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/Status.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/TensorDescriptor.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/enumerate_devices.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/global_get_option.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/global_set_option.html [new file with mode: 0644]
docs/ncapi/ncapi2/py_api/readme.html [new file with mode: 0644]
docs/ncapi/ncapi2/readme.html [new file with mode: 0644]
docs/ncapi/python_api_migration.html [new file with mode: 0644]
docs/ncapi/readme.html [new file with mode: 0644]
docs/ncs.html [new file with mode: 0644]
docs/ncs1arch.md [deleted file]
docs/py_api/Device.AllocateGraph.md [deleted file]
docs/py_api/Device.CloseDevice.md [deleted file]
docs/py_api/Device.GetDeviceOption.md [deleted file]
docs/py_api/Device.OpenDevice.md [deleted file]
docs/py_api/Device.SetDeviceOption.md [deleted file]
docs/py_api/Device.__init__.md [deleted file]
docs/py_api/Device.md [deleted file]
docs/py_api/DeviceOption.md [deleted file]
docs/py_api/EnumerateDevices.md [deleted file]
docs/py_api/GetGlobalOption.md [deleted file]
docs/py_api/GlobalOption.md [deleted file]
docs/py_api/Graph.DeallocateGraph.md [deleted file]
docs/py_api/Graph.GetGraphOption.md [deleted file]
docs/py_api/Graph.GetResult.md [deleted file]
docs/py_api/Graph.LoadTensor.md [deleted file]
docs/py_api/Graph.SetGraphOption.md [deleted file]
docs/py_api/Graph.md [deleted file]
docs/py_api/GraphOption.md [deleted file]
docs/py_api/SetGlobalOption.md [deleted file]
docs/py_api/Status.md [deleted file]
docs/py_api/readme.md [deleted file]
docs/readme.md [deleted file]
docs/release_notes.html [new file with mode: 0644]
docs/release_notes.md [deleted file]
docs/tensorflow.html [new file with mode: 0644]
docs/tf_compile_guidance.html [new file with mode: 0644]
docs/tf_compile_guidance.md [deleted file]
docs/tf_modelzoo.html [new file with mode: 0644]
docs/tf_slim.html [new file with mode: 0644]
docs/thumbnail.png [new file with mode: 0644]
docs/tools/check.html [new file with mode: 0644]
docs/tools/check.md [deleted file]
docs/tools/compile.html [new file with mode: 0644]
docs/tools/compile.md [deleted file]
docs/tools/profile.html [new file with mode: 0644]
docs/tools/profile.md [deleted file]
docs/virtualenv.html [new file with mode: 0644]
docs/vm_config.html [new file with mode: 0644]
examples/Makefile
examples/apps/hello_ncs_cpp/cpp/hello_ncs.cpp
examples/apps/hello_ncs_py/hello_ncs.py
examples/apps/multistick_cpp/Makefile
examples/apps/multistick_cpp/cpp/fp16.c [deleted file]
examples/apps/multistick_cpp/cpp/fp16.h [deleted file]
examples/apps/multistick_cpp/cpp/multistick.cpp
examples/caffe/AlexNet/Makefile
examples/caffe/AlexNet/cpp/build.sh [changed mode: 0644->0755]
examples/caffe/AlexNet/cpp/fp16.c [deleted file]
examples/caffe/AlexNet/cpp/fp16.h [deleted file]
examples/caffe/AlexNet/cpp/run.cpp
examples/caffe/AlexNet/run.py [changed mode: 0644->0755]
examples/caffe/GoogLeNet/Makefile
examples/caffe/GoogLeNet/cpp/build.sh [changed mode: 0644->0755]
examples/caffe/GoogLeNet/cpp/fp16.c [deleted file]
examples/caffe/GoogLeNet/cpp/fp16.h [deleted file]
examples/caffe/GoogLeNet/cpp/run.cpp
examples/caffe/GoogLeNet/run.py [changed mode: 0644->0755]
examples/caffe/Makefile
examples/caffe/SqueezeNet/Makefile
examples/caffe/SqueezeNet/cpp/build.sh [changed mode: 0644->0755]
examples/caffe/SqueezeNet/cpp/fp16.c [deleted file]
examples/caffe/SqueezeNet/cpp/fp16.h [deleted file]
examples/caffe/SqueezeNet/cpp/run.cpp
examples/caffe/SqueezeNet/run.py [changed mode: 0644->0755]
examples/tensorflow/inception_v1/graph [deleted file]
examples/tensorflow/inception_v1/inception-v1.py [changed mode: 0644->0755]
examples/tensorflow/inception_v1/run.py [changed mode: 0644->0755]
examples/tensorflow/inception_v3/Makefile
examples/tensorflow/inception_v3/graph [deleted file]
examples/tensorflow/inception_v3/inception-v3.py [changed mode: 0644->0755]
examples/tensorflow/inception_v3/run.py [changed mode: 0644->0755]
extras/docker/Dockerfile [new file with mode: 0644]
extras/docker/README.md [new file with mode: 0644]
install-opencv.sh [changed mode: 0644->0755]
install-utilities.sh [new file with mode: 0644]
install.sh
ncsdk.conf
requirements.txt [new file with mode: 0644]
requirements_apt.txt [new file with mode: 0644]
requirements_apt_raspbian.txt [new file with mode: 0644]
uninstall-opencv.sh
uninstall.sh [changed mode: 0644->0755]
version.txt [new file with mode: 0644]

diff --git a/ATTRIBUTIONS b/ATTRIBUTIONS
new file mode 100644 (file)
index 0000000..98d3a24
--- /dev/null
@@ -0,0 +1,140 @@
+                        Movidius Neural Compute API Library
+                        Third Party Components Attributions
+
+The following are licenses for third party software that was used to develop the  Movidius Neural Compute API Library.
+These licenses are listed due to attribution requirements in these license agreements. For the avoidance of doubt,
+the Movidius Neural Compute API Library is solely governed by the terms and conditions of the Intel OBL SDK and Tools
+License License that accompanies it.
+
+1. Numerical Python - NumPy
+
+    License:BSD 3-clause "New" or "Revised" License
+    Homepage:  http://www.numpy.org/
+    Copyright (c) <YEAR>, <OWNER>
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+    Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+2.     The MNIST Dataset Of Handwritten Digits
+    License: Creative Commons Attribution Share Alike 3.0
+    Homepage: http://www.pymvpa.org/datadb/mnist.html
+
+    Creative Commons Legal Code
+    Attribution-ShareAlike 3.0 Unported
+    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE.
+    License
+    THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
+
+    BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
+
+    1. Definitions
+
+    "Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
+    "Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined below) for the purposes of this License.
+    "Creative Commons Compatible License" means a license that is listed at http://creativecommons.org/compatiblelicenses that has been approved by Creative Commons as being essentially equivalent to this License, including, at a minimum, because that license: (i) contains terms that have the same purpose, meaning and effect as the License Elements of this License; and, (ii) explicitly permits the relicensing of adaptations of works made available under that license under this License or a Creative Commons jurisdiction license with the same License Elements as this License.
+    "Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership.
+    "License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike.
+    "Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
+    "Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
+    "Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
+    "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
+    "Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
+    "Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
+    2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
+
+    3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
+
+    to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections;
+    to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified.";
+    to Distribute and Publicly Perform the Work including as incorporated in Collections; and,
+    to Distribute and Publicly Perform Adaptations.
+    For the avoidance of doubt:
+
+    Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
+    Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and,
+    Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License.
+    The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved.
+
+    4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
+
+    You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(c), as requested.
+    You may Distribute or Publicly Perform an Adaptation only under the terms of: (i) this License; (ii) a later version of this License with the same License Elements as this License; (iii) a Creative Commons jurisdiction license (either this or a later license version) that contains the same License Elements as this License (e.g., Attribution-ShareAlike 3.0 US)); (iv) a Creative Commons Compatible License. If you license the Adaptation under one of the licenses mentioned in (iv), you must comply with the terms of that license. If you license the Adaptation under the terms of any of the licenses mentioned in (i), (ii) or (iii) (the "Applicable License"), you must comply with the terms of the Applicable License generally and the following provisions: (I) You must include a copy of, or the URI for, the Applicable License with every copy of each Adaptation You Distribute or Publicly Perform; (II) You may not offer or impose any terms on the Adaptation that restrict the terms of the Applicable License or the ability of the recipient of the Adaptation to exercise the rights granted to that recipient under the terms of the Applicable License; (III) You must keep intact all notices that refer to the Applicable License and to the disclaimer of warranties with every copy of the Work as included in the Adaptation You Distribute or Publicly Perform; (IV) when You Distribute or Publicly Perform the Adaptation, You may not impose any effective technological measures on the Adaptation that restrict the ability of a recipient of the Adaptation from You to exercise the rights granted to that recipient under the terms of the Applicable License. This Section 4(b) applies to the Adaptation as incorporated in a Collection, but this does not require the Collection apart from the Adaptation itself to be made subject to the terms of the Applicable License.
+    If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Ssection 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
+    Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise.
+    5. Representations, Warranties and Disclaimer
+
+    UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
+
+    6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+    7. Termination
+
+    This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
+    Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
+    8. Miscellaneous
+
+    Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
+    Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
+    If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+    No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
+    This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
+    The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.
+    Creative Commons Notice
+    Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor.
+
+    Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of the License.
+
+    Creative Commons may be contacted at http://creativecommons.org/.
+
+3. The Modernist theme
+
+    License:   Creative Commons Zero v1.0 Universal
+    Homepage:   https://github.com/pages-themes/modernist
+
+    Creative Commons CC0 1.0 Universal
+    Creative Commons Legal Code
+    CC0 1.0 Universal
+    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
+    Statement of Purpose
+    The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
+
+    Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
+
+    For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
+
+    1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
+
+    the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
+    moral rights retained by the original author(s) and/or performer(s);
+    publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
+    rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
+    rights protecting the extraction, dissemination, use and reuse of data in a Work;
+    database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
+    other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
+    2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work
+
+    in all territories worldwide,
+    for the maximum duration provided by applicable law or treaty (including future time extensions),
+    in any current or future medium and for any number of copies, and
+    for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver").
+    Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
+    3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work
+
+    in all territories worldwide,
+    for the maximum duration provided by applicable law or treaty (including future time extensions),
+    in any current or future medium and for any number of copies, and
+    for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License").
+    The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not
+    exercise any of his or her remaining Copyright and Related Rights in the Work or
+    assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
+    4. Limitations and Disclaimers.
+
+    No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
+    Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
+    Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
+    Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
index caf958c5a3f39b68e62726ca9d01d50646aa10be..66bfde6c5af35bd22ef27dfe4748cdc8c12db938 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -63,7 +63,8 @@ runexamples: prereqs opencv
        (cd examples; make run)
 
 .PHONY: api
-api: @echo "\nmake api starting."
+api:
+       @echo "\nmake api starting."
        (cd api/src; make; make install)
 
 .PHONY: clean
diff --git a/api/include/fp16.h b/api/include/fp16.h
new file mode 100644 (file)
index 0000000..08a0aaf
--- /dev/null
@@ -0,0 +1,9 @@
+// Copied from Numpy
+
+
+unsigned half2float(unsigned short h);
+unsigned short float2half(unsigned f);
+void floattofp16(unsigned char *dst, float *src, unsigned nelem);
+void fp16tofloat(float *dst, unsigned char *src, unsigned nelem);
+
+
index 082bd1952e1dbc99715e27baab1b0d804ff29cd5..b732c6325e278a5e80321fd6977a8c29d3bffd77 100644 (file)
-#ifndef __MVNC_H_INCLUDED__
-#define __MVNC_H_INCLUDED__
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+#ifndef __NC_H_INCLUDED__
+#define __NC_H_INCLUDED__
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
+#define NC_MAX_NAME_SIZE 28
+#define NC_THERMAL_BUFFER_SIZE 100
+#define NC_DEBUG_BUFFER_SIZE   120
+#define NC_VERSION_MAX_SIZE 4
+
+#if (defined (WINNT) || defined(_WIN32) || defined(_WIN64) )
+#include <windows.h>   // for Sleep()
+#define dllexport __declspec( dllexport )
+#else
+#define dllexport
+#endif //WINNT
+
+typedef enum {
+    NC_OK = 0,
+    NC_BUSY = -1,                     // Device is busy, retry later
+    NC_ERROR = -2,                    // Error communicating with the device
+    NC_OUT_OF_MEMORY = -3,            // Out of memory
+    NC_DEVICE_NOT_FOUND = -4,         // No device at the given index or name
+    NC_INVALID_PARAMETERS = -5,       // At least one of the given parameters is wrong
+    NC_TIMEOUT = -6,                  // Timeout in the communication with the device
+    NC_MVCMD_NOT_FOUND = -7,          // The file to boot Myriad was not found
+    NC_NOT_ALLOCATED = -8,            // The graph or device has been closed during the operation
+    NC_UNAUTHORIZED = -9,             // Unauthorized operation
+    NC_UNSUPPORTED_GRAPH_FILE = -10,  // The graph file version is not supported
+    NC_UNSUPPORTED_CONFIGURATION_FILE = -11, // The configuration file version is not supported
+    NC_UNSUPPORTED_FEATURE = -12,     // Not supported by this FW version
+    NC_MYRIAD_ERROR = -13,            // An error has been reported by the device
+                                      // use  NC_DEVICE_DEBUG_INFO or NC_GRAPH_DEBUG_INFO
+    NC_INVALID_DATA_LENGTH = -14,      // invalid data length has been passed when get/set option
+    NC_INVALID_HANDLE = -15           // handle to object that is invalid
+} ncStatus_t;
+
+typedef enum {
+    NC_RW_LOG_LEVEL = 0,    // Log level, int, MVLOG_DEBUG = 0, debug and above (full verbosity)
+                            // MVLOG_INFO = 1, info and above
+                            // MVLOG_WARN = 2, warnings and above
+                            // MVLOG_ERROR = 3, errors and above
+                            // MVLOG_FATAL = 4, fatal only
+    NC_RO_API_VERSION = 1,  // retruns API Version. array of unsigned int of size 4
+                            //major.minor.hotfix.rc
+} ncGlobalOption_t;
+
+typedef enum {
+    NC_RO_GRAPH_STATE = 1000,           // Returns graph state: CREATED, ALLOCATED, WAITING_FOR_BUFFERS, RUNNING, DESTROYED
+    NC_RO_GRAPH_TIME_TAKEN = 1001,      // Return time taken for last inference (float *)
+    NC_RO_GRAPH_INPUT_COUNT = 1002,     // Returns number of inputs, size of array returned
+                                        // by NC_RO_INPUT_TENSOR_DESCRIPTORS, int
+    NC_RO_GRAPH_OUTPUT_COUNT = 1003,    // Returns number of outputs, size of array returned
+                                        // by NC_RO_OUTPUT_TENSOR_DESCRIPTORS,int
+    NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS = 1004,  // Return a tensorDescriptor pointer array
+                                            // which describes the graph inputs in order.
+                                            // Can be used for fifo creation.
+                                            // The length of the array can be retrieved
+                                            // using the NC_RO_INPUT_COUNT option
+
+    NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS = 1005, // Return a tensorDescriptor pointer
+                                            // array which describes the graph
+                                            // outputs in order. Can be used for
+                                            // fifo creation. The length of the
+                                            // array can be retrieved using the
+                                            // NC_RO_OUTPUT_COUNT option
+
+    NC_RO_GRAPH_DEBUG_INFO = 1006,          // Return debug info, string
+    NC_RO_GRAPH_NAME = 1007,                // Returns name of the graph, string
+    NC_RO_GRAPH_OPTION_CLASS_LIMIT = 1008,  // return the highest option class supported
+    NC_RO_GRAPH_VERSION = 1009,             // returns graph version, string
+    NC_RO_GRAPH_TIME_TAKEN_ARRAY_SIZE = 1011, // Return size of array for time taken option, int
+    NC_RW_GRAPH_EXECUTORS_NUM = 1110,
+} ncGraphOption_t;
+
+typedef enum {
+    NC_DEVICE_CREATED = 0,
+    NC_DEVICE_OPENED = 1,
+    NC_DEVICE_CLOSED = 2,
+} ncDeviceState_t;
+
+typedef enum {
+    NC_GRAPH_CREATED = 0,
+    NC_GRAPH_ALLOCATED = 1,
+    NC_GRAPH_WAITING_FOR_BUFFERS = 2,
+    NC_GRAPH_RUNNING = 3,
+} ncGraphState_t;
+
+typedef enum {
+    NC_FIFO_CREATED = 0,
+    NC_FIFO_ALLOCATED = 1,
+} ncFifoState_t;
 
-#define MVNC_MAX_NAME_SIZE 28
+typedef enum {
+    NC_MA2450 = 0,
+    NC_MA2480 = 1,
+} ncDeviceHwVersion_t;
 
 typedef enum {
-       MVNC_OK = 0,
-       MVNC_BUSY = -1,                     // Device is busy, retry later
-       MVNC_ERROR = -2,                    // Error communicating with the device
-       MVNC_OUT_OF_MEMORY = -3,            // Out of memory
-       MVNC_DEVICE_NOT_FOUND = -4,         // No device at the given index or name
-       MVNC_INVALID_PARAMETERS = -5,       // At least one of the given parameters is wrong
-       MVNC_TIMEOUT = -6,                  // Timeout in the communication with the device
-       MVNC_MVCMD_NOT_FOUND = -7,         // The file to boot Myriad was not found
-       MVNC_NO_DATA = -8,                  // No data to return, call LoadTensor first
-       MVNC_GONE = -9,                     // The graph or device has been closed during the operation
-       MVNC_UNSUPPORTED_GRAPH_FILE = -10,  // The graph file version is not supported
-       MVNC_MYRIAD_ERROR = -11,            // An error has been reported by the device, use MVNC_DEBUG_INFO
-} mvncStatus;
+    NC_RO_DEVICE_THERMAL_STATS = 2000,          // Return temperatures, float *, not for general use
+    NC_RO_DEVICE_THERMAL_THROTTLING_LEVEL = 2001,   // 1=TEMP_LIM_LOWER reached, 2=TEMP_LIM_HIGHER reached
+    NC_RO_DEVICE_STATE = 2002,                  // Returns device state: CREATED, OPENED, CLOSED, DESTROYED
+    NC_RO_DEVICE_CURRENT_MEMORY_USED = 2003,    // Returns current device memory usage
+    NC_RO_DEVICE_MEMORY_SIZE = 2004,            // Returns device memory size
+    NC_RO_DEVICE_MAX_FIFO_NUM = 2005,           // return the maximum number of fifos supported
+    NC_RO_DEVICE_ALLOCATED_FIFO_NUM = 2006,     // return the number of currently allocated fifos
+    NC_RO_DEVICE_MAX_GRAPH_NUM = 2007,          // return the maximum number of graphs supported
+    NC_RO_DEVICE_ALLOCATED_GRAPH_NUM = 2008,    //  return the number of currently allocated graphs
+    NC_RO_DEVICE_OPTION_CLASS_LIMIT = 2009,     //  return the highest option class supported
+    NC_RO_DEVICE_FW_VERSION = 2010,             // return device firmware version, array of unsigned int of size 4
+                                                //major.minor.hwtype.buildnumber
+    NC_RO_DEVICE_DEBUG_INFO = 2011,             // Return debug info, string, not supported yet
+    NC_RO_DEVICE_MVTENSOR_VERSION = 2012,       // returns mv tensor version, array of unsigned int of size 2
+                                                //major.minor
+    NC_RO_DEVICE_NAME = 2013,                   // returns device name as generated internally
+    NC_RO_DEVICE_MAX_EXECUTORS_NUM = 2014,      //Maximum number of executers per graph
+    NC_RO_DEVICE_HW_VERSION = 2015,             //returns HW Version, enum
+} ncDeviceOption_t;
+
+typedef struct _devicePrivate_t devicePrivate_t;
+typedef struct _graphPrivate_t graphPrivate_t;
+typedef struct _fifoPrivate_t fifoPrivate_t;
+typedef struct _ncTensorDescriptorPrivate_t ncTensorDescriptorPrivate_t;
+
+struct ncFifoHandle_t {
+    // keep place for public data here
+    fifoPrivate_t* private_data;
+};
+
+struct ncGraphHandle_t {
+    // keep place for public data here
+    graphPrivate_t* private_data;
+};
+
+struct ncDeviceHandle_t {
+    // keep place for public data here
+    devicePrivate_t* private_data;
+};
 
 typedef enum {
-       MVNC_LOG_LEVEL = 0, // Log level, int, 0 = nothing, 1 = errors, 2 = verbose
-} mvncGlobalOptions;
+    NC_FIFO_HOST_RO = 0, // fifo can be read through the API but can not be
+                         // written ( graphs can read and write data )
+    NC_FIFO_HOST_WO = 1, // fifo can be written through the API but can not be
+                         // read (graphs can read but can not write)
+} ncFifoType_t;
 
 typedef enum {
-       MVNC_ITERATIONS = 0,        // Number of iterations per inference, int, normally 1, not for general use
-       MVNC_NETWORK_THROTTLE = 1,  // Measure temperature once per inference instead of once per layer, int, not for general use
-       MVNC_DONT_BLOCK = 2,        // LoadTensor will return BUSY instead of blocking, GetResult will return NO_DATA, int
-       MVNC_TIME_TAKEN = 1000,     // Return time taken for inference (float *)
-       MVNC_DEBUG_INFO = 1001,     // Return debug info, string
-} mvncGraphOptions;
+    NC_FIFO_FP16 = 0,
+    NC_FIFO_FP32 = 1,
+} ncFifoDataType_t;
+
+struct ncTensorDescriptor_t {
+    unsigned int n;
+    unsigned int c;
+    unsigned int w;
+    unsigned int h;
+    unsigned int totalSize;
+};
 
 typedef enum {
-       MVNC_TEMP_LIM_LOWER = 1,                // Temperature for short sleep, float, not for general use
-       MVNC_TEMP_LIM_HIGHER = 2,               // Temperature for long sleep, float, not for general use
-       MVNC_BACKOFF_TIME_NORMAL = 3,           // Normal sleep in ms, int, not for general use
-       MVNC_BACKOFF_TIME_HIGH = 4,             // Short sleep in ms, int, not for general use
-       MVNC_BACKOFF_TIME_CRITICAL = 5,         // Long sleep in ms, int, not for general use
-       MVNC_TEMPERATURE_DEBUG = 6,             // Stop on critical temperature, int, not for general use
-       MVNC_THERMAL_STATS = 1000,              // Return temperatures, float *, not for general use
-       MVNC_OPTIMISATION_LIST = 1001,          // Return optimisations list, char *, not for general use
-       MVNC_THERMAL_THROTTLING_LEVEL = 1002,   // 1=TEMP_LIM_LOWER reached, 2=TEMP_LIM_HIGHER reached
-} mvncDeviceOptions;
-
-mvncStatus mvncGetDeviceName(int index, char *name, unsigned int nameSize);
-mvncStatus mvncOpenDevice(const char *name, void **deviceHandle);
-mvncStatus mvncCloseDevice(void *deviceHandle);
-mvncStatus mvncAllocateGraph(void *deviceHandle, void **graphHandle, const void *graphFile, unsigned int graphFileLength);
-mvncStatus mvncDeallocateGraph(void *graphHandle);
-mvncStatus mvncSetGlobalOption(int option, const void *data, unsigned int dataLength);
-mvncStatus mvncGetGlobalOption(int option, void *data, unsigned int *dataLength);
-mvncStatus mvncSetGraphOption(void *graphHandle, int option, const void *data, unsigned int dataLength);
-mvncStatus mvncGetGraphOption(void *graphHandle, int option, void *data, unsigned int *dataLength);
-mvncStatus mvncSetDeviceOption(void *deviceHandle, int option, const void *data, unsigned int dataLength);
-mvncStatus mvncGetDeviceOption(void *deviceHandle, int option, void *data, unsigned int *dataLength);
-mvncStatus mvncLoadTensor(void *graphHandle, const void *inputTensor, unsigned int inputTensorLength, void *userParam);
-mvncStatus mvncGetResult(void *graphHandle, void **outputData, unsigned int *outputDataLength, void **userParam);
-
-#include "mvnc_deprecated.h"
+    NC_RW_FIFO_TYPE = 0,            // configure the fifo type to one type from ncFifoType_t
+    NC_RW_FIFO_CONSUMER_COUNT = 1,  // The number of consumers of elements
+                                    // (the number of times data must be read by
+                                    // a graph or host before the element is removed.
+                                    // Defaults to 1. Host can read only once always.
+    NC_RW_FIFO_DATA_TYPE = 2,       // 0 for fp16, 1 for fp32. If configured to fp32,
+                                    // the API will convert the data to the internal
+                                    // fp16 format automatically
+    NC_RW_FIFO_DONT_BLOCK = 3,      // WriteTensor will return NC_OUT_OF_MEMORY instead
+                                    // of blocking, GetResult will return NO_DATA, not supported yet
+    NC_RO_FIFO_CAPACITY = 4,        // return number of maximum elements in the buffer
+    NC_RO_FIFO_READ_FILL_LEVEL = 5,     // return number of tensors in the read buffer
+    NC_RO_FIFO_WRITE_FILL_LEVEL = 6,    // return number of tensors in a write buffer
+    NC_RO_FIFO_TENSOR_DESCRIPTOR = 7,   // return the tensor descriptor of the FIFO
+    NC_RO_FIFO_STATE = 8,               // return the fifo state, returns CREATED, ALLOCATED,DESTROYED
+    NC_RO_FIFO_NAME = 9,                // return fifo name
+    NC_RO_FIFO_ELEMENT_DATA_SIZE = 10,  //element data size in bytes, int
+} ncFifoOption_t;
+
+
+// Global
+dllexport ncStatus_t ncGlobalSetOption(int option, const void *data,
+       unsigned int dataLength);
+dllexport ncStatus_t ncGlobalGetOption(int option, void *data,
+                        unsigned int *dataLength);
+
+// Device
+dllexport ncStatus_t ncDeviceSetOption(struct ncDeviceHandle_t *deviceHandle,
+                        int option, const void *data,
+                        unsigned int dataLength);
+dllexport ncStatus_t ncDeviceGetOption(struct ncDeviceHandle_t *deviceHandle,
+                        int option, void *data, unsigned int *dataLength);
+dllexport ncStatus_t ncDeviceCreate(int index,struct ncDeviceHandle_t **deviceHandle);
+dllexport ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t *deviceHandle);
+dllexport ncStatus_t ncDeviceClose(struct ncDeviceHandle_t *deviceHandle);
+dllexport ncStatus_t ncDeviceDestroy(struct ncDeviceHandle_t **deviceHandle);
+
+// Graph
+dllexport ncStatus_t ncGraphCreate(const char* name, struct ncGraphHandle_t **graphHandle);
+dllexport ncStatus_t ncGraphAllocate(struct ncDeviceHandle_t *deviceHandle,
+                        struct ncGraphHandle_t *graphHandle,
+                        const void *graphBuffer, unsigned int graphBufferLength);
+dllexport ncStatus_t ncGraphDestroy(struct ncGraphHandle_t **graphHandle);
+dllexport ncStatus_t ncGraphSetOption(struct ncGraphHandle_t *graphHandle,
+                        int option, const void *data, unsigned int dataLength);
+dllexport ncStatus_t ncGraphGetOption(struct ncGraphHandle_t *graphHandle,
+                        int option, void *data,
+                        unsigned int *dataLength);
+dllexport ncStatus_t ncGraphQueueInference(struct ncGraphHandle_t *graphHandle,
+                        struct ncFifoHandle_t** fifoIn, unsigned int inFifoCount,
+                        struct ncFifoHandle_t** fifoOut, unsigned int outFifoCount);
+
+//Helper functions
+dllexport ncStatus_t ncGraphQueueInferenceWithFifoElem(struct ncGraphHandle_t *graphHandle,
+                        struct ncFifoHandle_t* fifoIn,
+                        struct ncFifoHandle_t* fifoOut, const void *inputTensor,
+                        unsigned int * inputTensorLength, void *userParam);
+dllexport ncStatus_t ncGraphAllocateWithFifos(struct ncDeviceHandle_t* deviceHandle,
+                        struct ncGraphHandle_t* graphHandle,
+                        const void *graphBuffer, unsigned int graphBufferLength,
+                        struct ncFifoHandle_t ** inFifoHandle,
+                        struct ncFifoHandle_t ** outFifoHandle);
+
+dllexport ncStatus_t ncGraphAllocateWithFifosEx(struct ncDeviceHandle_t* deviceHandle,
+                        struct ncGraphHandle_t* graphHandle,
+                        const void *graphBuffer, unsigned int graphBufferLength,
+                        struct ncFifoHandle_t ** inFifoHandle, ncFifoType_t inFifoType,
+                        int inNumElem, ncFifoDataType_t inDataType,
+                        struct ncFifoHandle_t ** outFifoHandle,  ncFifoType_t outFifoType,
+                        int outNumElem, ncFifoDataType_t outDataType);
+// Fifo
+dllexport ncStatus_t ncFifoCreate(const char* name, ncFifoType_t type,
+                        struct ncFifoHandle_t** fifoHandle);
+dllexport ncStatus_t ncFifoAllocate(struct ncFifoHandle_t* fifoHandle,
+                        struct ncDeviceHandle_t* device,
+                        struct ncTensorDescriptor_t* tensorDesc,
+                        unsigned int numElem);
+dllexport ncStatus_t ncFifoSetOption(struct ncFifoHandle_t* fifoHandle, int option,
+                        const void *data, unsigned int dataLength);
+dllexport ncStatus_t ncFifoGetOption(struct ncFifoHandle_t* fifoHandle, int option,
+                        void *data, unsigned int *dataLength);
+
+
+dllexport ncStatus_t ncFifoDestroy(struct ncFifoHandle_t** fifoHandle);
+dllexport ncStatus_t ncFifoWriteElem(struct ncFifoHandle_t* fifoHandle, const void *inputTensor,
+                        unsigned int * inputTensorLength, void *userParam);
+dllexport ncStatus_t ncFifoReadElem(struct ncFifoHandle_t* fifoHandle, void *outputData,
+                        unsigned int* outputDataLen, void **userParam);
+dllexport ncStatus_t ncFifoRemoveElem(struct ncFifoHandle_t* fifoHandle); //not supported yet
 #ifdef __cplusplus
 }
 #endif
diff --git a/api/include/mvnc_deprecated.h b/api/include/mvnc_deprecated.h
deleted file mode 100644 (file)
index c7fabeb..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef __MVNC_DEPRECATED_H_INCLUDED__
-#define __MVNC_DEPRECATED_H_INCLUDED__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-typedef mvncGraphOptions GraphOptions __attribute__ \
-                       ((deprecated("GraphOptions is deprecated. Please use mvncGraphOptions")));
-typedef mvncDeviceOptions DeviceOptions __attribute__ \
-                       ((deprecated("DeviceOptions is deprecated. Please use mvncDeviceOptions")));
-
-// Deprecated Define
-#define MVNC_MAXNAMESIZE  _Pragma("GCC warning \"'MVNC_MAXNAMESIZE' is deprecated. Please use 'MVNC_MAX_NAME_SIZE'\"") MVNC_MAX_NAME_SIZE
-
-// Deprecated Global Options
-#define MVNC_LOGLEVEL  _Pragma("GCC warning \"'MVNC_LOGLEVEL' is deprecated. Please use 'MVNC_LOG_LEVEL'\"") MVNC_LOG_LEVEL
-
-// Deprecated status values
-#define MVNC_MVCMDNOTFOUND          _Pragma("GCC warning \"'MVNC_MVCMDNOTFOUND' is deprecated. Please use 'MVNC_MVCMD_NOT_FOUND'\"") MVNC_MVCMD_NOT_FOUND
-#define MVNC_NODATA                 _Pragma("GCC warning \"'MVNC_NO_DATA' is deprecated. Please use 'MVNC_NO_DATA'\"") MVNC_NO_DATA
-#define MVNC_UNSUPPORTEDGRAPHFILE   _Pragma("GCC warning \"'MVNC_UNSUPPORTEDGRAPHFILE' is deprecated. Please use 'MVNC_UNSUPPORTED_GRAPH_FILE'\"") MVNC_UNSUPPORTED_GRAPH_FILE
-#define MVNC_MYRIADERROR            _Pragma("GCC warning \"'MVNC_MYRIADERROR' is deprecated. Please use 'MVNC_MYRIAD_ERROR'\"") MVNC_MYRIAD_ERROR
-
-// Deprecated Graph Options values
-#define MVNC_DONTBLOCK  _Pragma("GCC warning \"'MVNC_DONTBLOCK' is deprecated. Please use 'MVNC_DONT_BLOCK'\"") MVNC_DONT_BLOCK
-#define MVNC_TIMETAKEN  _Pragma("GCC warning \"'MVNC_TIMETAKEN' is deprecated. Please use 'MVNC_TIME_TAKEN'\"") MVNC_TIME_TAKEN
-#define MVNC_DEBUGINFO  _Pragma("GCC warning \"'MVNC_DEBUGINFO' is deprecated. Please use 'MVNC_DEBUG_INFO'\"") MVNC_DEBUG_INFO
-
-// Deprecated Device Options Values
-#define MVNC_THERMALSTATS      _Pragma("GCC warning \"'MVNC_THERMALSTATS' is deprecated. Please use 'MVNC_THERMAL_STATS'\"") MVNC_THERMAL_STATS
-#define MVNC_OPTIMISATIONLIST  _Pragma("GCC warning \"'MVNC_OPTIMISATIONLIST' is deprecated. Please use 'MVNC_OPTIMISATION_LIST'\"") MVNC_OPTIMISATION_LIST
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/api/include/ncCommPrivate.h b/api/include/ncCommPrivate.h
new file mode 100644 (file)
index 0000000..805950f
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @file
+///
+/// @brief     MVNC host-device communication structures
+///
+
+
+// Includes
+// ----------------------------------------------------------------------------
+#ifndef _MVNC_COMM_H_
+#define _MVNC_COMM_H_
+
+struct tensorDescriptor_t {
+    uint32_t n;
+    uint32_t c;
+    uint32_t w;
+    uint32_t h;
+    uint32_t totalSize;
+};                              //If this structure is equivalent with the API structure, it is just a coincidence. Don't make any assumptions based on this in the code.
+
+typedef enum {
+    NC_GRAPH_OK,
+    NC_GRAPH_WRONG_INPUT_FORMAT,
+    NC_GRAPH_MYRIAD_ERROR
+} ncGraphError_t;
+
+typedef enum {
+    GRAPH_WAITING_FOR_BUFFERS,
+    GRAPH_RUNNING
+} graphState_t;
+
+typedef enum {
+    GRAPH_MON_CLASS_GRAPH_CMD = 0,
+    GRAPH_MON_CLASS_BUFFER_CMD = 1,
+    GRAPH_MON_CLASS_GET_CLASS0 = 2,
+    GRAPH_MON_CLASS_GET_CLASS1 = 3,
+    GRAPH_MON_CLASS_GET_CLASS2 = 4,
+    GRAPH_MON_CLASS_GET_CLASS3 = 5,
+    GRAPH_MON_CLASS_SET_CLASS0 = 6,
+    GRAPH_MON_CLASS_SET_CLASS1 = 7,
+    GRAPH_MON_CLASS_SET_CLASS2 = 8,
+    GRAPH_MON_CLASS_SET_CLASS3 = 9,
+    //TODO: expandable for set/getoption classes
+} graphMonClass_t;
+
+typedef enum {
+    GRAPH_ALLOCATE_CMD = 0,
+    GRAPH_DEALLOCATE_CMD = 1,
+    GRAPH_TRIGGER_CMD = 2,
+} graphCommandType_t;
+
+typedef enum {
+    CLASS0_TIMING_DATA = 0,
+    CLASS0_DEBUG_DATA = 1,
+    CLASS0_STATE = 2,
+} graphOptionClass0_t;
+typedef enum {
+    CLASS1_GR_NI = 0,
+} graphOptionClass1_t;
+typedef enum {
+    CLASS2_GR_NI = 0,
+} graphOptionClass2_t;
+typedef enum {
+    CLASS3_GR_NI = 0,
+} graphOptionClass3_t;
+
+typedef enum {
+    BUFFER_ALLOCATE_CMD = 0,
+    BUFFER_DEALLOCATE_CMD = 1,
+
+} bufferCommandType_t;
+
+typedef struct {
+    graphCommandType_t type;
+    uint32_t id;
+    char streamName[16];
+    uint32_t buffId1;
+    uint32_t buffId2;
+    uint32_t releaseElemBuff1;
+    uint32_t releaseElemBuff2;
+    uint32_t executors_number;
+    uint8_t laterUse[16];
+} graphCommand_t;
+
+typedef struct {
+    bufferCommandType_t type;
+    char name[16];
+    uint32_t id;
+    uint32_t elemCnt;
+    struct tensorDescriptor_t desc;
+    uint8_t readChannel;
+    uint8_t writeChannel;
+    uint8_t laterUse[10];
+} bufferCommand_t;
+
+typedef struct {
+    union {
+        graphOptionClass0_t c0;
+        graphOptionClass1_t c1;
+        graphOptionClass2_t c2;
+        graphOptionClass3_t c3;
+    } type;
+    uint32_t id;
+} graphOptionSet_t;
+
+typedef struct {
+    graphMonClass_t cmdClass;
+    union {
+        graphCommand_t graphCmd;
+        bufferCommand_t buffCmd;
+        graphOptionSet_t optionCmd;
+    } cmd;
+} graphMonCommand_t;
+
+typedef enum {
+    CLASS0_THERMAL_STATS = 1,
+    CLASS0_DEVICE_CAPABILITIES = 2,
+    CLASS0_DEVICE_USED_MEMORY = 3,
+} deviceOptionClass0;
+typedef enum {
+    CLASS1_DEV_NI = 0,
+} deviceOptionClass1;
+typedef enum {
+    CLASS2_GET_TEMP_LIM_LOWER = 0,
+    CLASS2_SET_TEMP_LIM_LOWER,
+    CLASS2_GET_TEMP_LIM_HIGHER,
+    CLASS2_SET_TEMP_LIM_HIGHER,
+    CLASS2_GET_BACKOFF_TIME_NORMAL,
+    CLASS2_SET_BACKOFF_TIME_NORMAL,
+    CLASS2_GET_BACKOFF_TIME_HIGH,
+    CLASS2_SET_BACKOFF_TIME_HIGH,
+    CLASS2_GET_BACKOFF_TIME_CRITICAL,
+    CLASS2_SET_BACKOFF_TIME_CRITICAL,
+    CLASS2_GET_TEMPERATURE_DEBUG,
+    CLASS2_SET_TEMPERATURE_DEBUG,
+    CLASS2_OPT_LIST,
+} deviceOptionClass2;
+
+typedef enum {
+    CLASS3_START_SHELL = 0,
+    CLASS3_SET_LOG_LEVEL_GLOBAL,
+    CLASS3_SET_LOG_LEVEL_FATHOM,
+    CLASS3_SET_LOG_LEVEL_XLINK,
+} deviceOptionClass3;   //TODO: move to separate header
+
+typedef struct {
+    union {
+        deviceOptionClass0 c0;
+        deviceOptionClass1 c1;
+        deviceOptionClass2 c2;
+        deviceOptionClass3 c3;
+    } type;
+    uint32_t optionClass;
+    uint32_t data;
+} deviceCommand_t;
+
+typedef struct {
+    uint32_t max_graphs;
+    uint32_t max_fifos;
+    uint32_t max_memory;
+    uint32_t max_device_opt_class;
+    uint32_t max_graph_opt_class;
+    uint32_t max_executors;
+    uint32_t fw_version[4];
+    uint32_t mv_tensor_version[2];
+} deviceCapabilities_t;
+
+
+#endif
diff --git a/api/include/ncPrivateTypes.h b/api/include/ncPrivateTypes.h
new file mode 100644 (file)
index 0000000..6da7d06
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @file
+/// @brief     MVNC host-device communication structures
+///
+
+
+// Includes
+// ----------------------------------------------------------------------------
+
+#ifndef _NC_PRIVATE_TYPES_H_
+#define _NC_PRIVATE_TYPES_H_
+
+#include <pthread.h>
+#include <mvnc.h>
+#include "ncCommPrivate.h"
+#include "XLinkPublicDefines.h"
+#define NC_MAX_NAME_SIZE        28
+
+typedef enum {
+    NC_OPTION_CLASS0 = 0,
+    NC_OPTION_CLASS1 = 1,
+    NC_OPTION_CLASS2 = 2,
+    NC_OPTION_CLASS3 = 3,
+} ncOptionClass_t;
+
+struct _devicePrivate_t {
+    int throttle_happened;
+    float *thermal_stats;
+    char *dev_addr;             // Device USB address as returned by usb_
+    char *dev_addr2;            // USB address post FW flash (might for some devices)
+    char *dev_file;             // Device filename in /dev directory
+    char *optimisation_list;
+    XLinkHandler_t *usb_link;
+    struct _devicePrivate_t *next;  // Next device in chain
+    struct _graphPrivate_t *graphs; // List of associated graphs
+    struct _fifoPrivate_t *fifos;   // List of associated fifos
+    streamId_t device_mon_stream_id;
+    streamId_t graph_monitor_stream_id;
+    pthread_mutex_t dev_data_m;
+    pthread_mutex_t dev_stream_m;
+    pthread_mutex_t graph_streamm;
+    deviceCapabilities_t dev_attr;
+    ncDeviceState_t state;
+} *devices;
+struct _userParamPrivate_t {
+    void *data;
+    struct _userParamPrivate_t *next;
+};
+struct _graphPrivate_t {
+    uint32_t id;
+    uint32_t blob_version[2];
+    int started;
+    int batch_size;
+    int executors_number;
+    int input_count;
+    int output_count;
+    struct ncTensorDescriptor_t input_tensor_desc;
+    struct ncTensorDescriptor_t output_tensor_desc;
+    unsigned nstages;
+    struct _devicePrivate_t *dev;
+    struct _graphPrivate_t *next;
+    char name[NC_MAX_NAME_SIZE];
+    streamId_t graph_stream_id;
+    ncGraphState_t state;
+};
+
+struct _fifoPrivate_t {
+    ncFifoType_t type;
+    int consumer_cnt;
+    uint32_t id;
+    streamId_t streamId;
+    struct ncTensorDescriptor_t tensor_desc;
+    struct _devicePrivate_t *dev;
+    struct _fifoPrivate_t *next;
+    char name[NC_MAX_NAME_SIZE];
+    struct _userParamPrivate_t *user_param_in;  //used for write fifo
+    struct _userParamPrivate_t *user_param_out; //used for read fifo
+    int write_count;
+    int consumed_by_graph;
+    int num_elements;
+    int api_read_element;
+    int api_read_adjust;
+    int datatype;
+    int consumers_remaining;
+    int datasize;
+    pthread_mutex_t fifo_mutex;
+    ncFifoState_t state;
+};
+#endif
index cfdcace246ac73aa36b528d1e84257293515061f..b362b00f823739b4d1990fb3e7a21020da7ba04f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2017 Intel Corporation.
+# Copyright 2018 Intel Corporation.
 # The source code, information and material ("Material") contained herein is
 # owned by Intel Corporation or its suppliers or licensors, and title to such
 # Material remains with Intel Corporation or its suppliers or licensors.
 # or otherwise.
 # Any license under such intellectual property rights must be express and
 # approved by Intel in writing.
-
+import os
 import sys
 import numpy
 import warnings
+import platform
 from enum import Enum
 from ctypes import *
 
 # The toolkit wants its local version
 try:
-    f = CDLL("./libmvnc.so")
+    if 'Windows' in platform.architecture()[1]:
+        f = CDLL("./mvnc.dll")
+    else:
+        f = CDLL("./libmvnc.so")
 except:
-    f = CDLL("libmvnc.so")
+    if 'Windows' in platform.architecture()[1]:
+        path = os.path.abspath(__file__)
+        dir_path = os.path.dirname(path)
+        f = CDLL(os.path.join(dir_path, "mvnc.dll"))
+    else:
+        f = CDLL("libmvnc.so")
 
 warnings.simplefilter('default', DeprecationWarning)
 
+"""Define statements"""
+MAX_NAME_SIZE = 28
+THERMAL_BUFFER_SIZE = 100
+DEBUG_BUFFER_SIZE = 120
+VERSION_MAX_SIZE = 4
+
+OPTION_CLASS_SIZE = 100
+GRAPH_CLASS0_BASE = 1000
+DEVICE_CLASS0_BASE = 2000
+SUPPORT_HIGHCLASS = False
+
 
 class EnumDeprecationHelper(object):
     def __init__(self, new_target, deprecated_values):
@@ -39,232 +59,719 @@ class EnumDeprecationHelper(object):
 
     def __getattr__(self, attr):
         if (attr in self.deprecated_values):
-                warnings.warn('\033[93m' + "\"" + attr + "\" is deprecated. Please use \"" +
-                              self.deprecated_values[attr] + "\"!" + '\033[0m',
-                              DeprecationWarning, stacklevel=2)
-                return getattr(self.new_target, self.deprecated_values[attr])
+            warnings.warn('\033[93m' + "\"" + attr +
+                          "\" is deprecated. Please use \"" +
+                          self.deprecated_values[attr] + "\"!" + '\033[0m',
+                          DeprecationWarning, stacklevel=2)
+            return getattr(self.new_target, self.deprecated_values[attr])
         return getattr(self.new_target, attr)
 
 
-class mvncStatus(Enum):
+"""Enum declarations"""
+
+
+class Status(Enum):
     OK = 0
-    BUSY = -1
-    ERROR = -2
-    OUT_OF_MEMORY = -3
-    DEVICE_NOT_FOUND = -4
-    INVALID_PARAMETERS = -5
-    TIMEOUT = -6
-    MVCMD_NOT_FOUND = -7
-    NO_DATA = -8
-    GONE = -9
-    UNSUPPORTED_GRAPH_FILE = -10
-    MYRIAD_ERROR = -11
-
-Status = EnumDeprecationHelper(mvncStatus, {"MVCMDNOTFOUND": "MVCMD_NOT_FOUND",
-                                            "NODATA": "NO_DATA",
-                                            "UNSUPPORTEDGRAPHFILE": "UNSUPPORTED_GRAPH_FILE",
-                                            "MYRIADERROR": "MYRIAD_ERROR"})
-
-
-class mvncGlobalOption(Enum):
-    LOG_LEVEL = 0
-
-GlobalOption = EnumDeprecationHelper(mvncGlobalOption, {"LOGLEVEL": "LOG_LEVEL"})
-
-
-class mvncDeviceOption(Enum):
-    TEMP_LIM_LOWER = 1
-    TEMP_LIM_HIGHER = 2
-    BACKOFF_TIME_NORMAL = 3
-    BACKOFF_TIME_HIGH = 4
-    BACKOFF_TIME_CRITICAL = 5
-    TEMPERATURE_DEBUG = 6
-    THERMAL_STATS = 1000
-    OPTIMISATION_LIST = 1001
-    THERMAL_THROTTLING_LEVEL = 1002
-
-DeviceOption = EnumDeprecationHelper(mvncDeviceOption, {"THERMALSTATS": "THERMAL_STATS",
-                                                        "OPTIMISATIONLIST": "OPTIMISATION_LIST"})
-
-
-class mvncGraphOption(Enum):
-    ITERATIONS = 0
-    NETWORK_THROTTLE = 1
-    DONT_BLOCK = 2
-    TIME_TAKEN = 1000
-    DEBUG_INFO = 1001
-
-GraphOption = EnumDeprecationHelper(mvncGraphOption, {"DONTBLOCK": "DONT_BLOCK",
-                                                      "TIMETAKEN": "TIME_TAKEN",
-                                                      "DEBUGINFO": "DEBUG_INFO"})
-
-
-def EnumerateDevices():
-    name = create_string_buffer(28)
+    BUSY = -1                               # Device is busy, retry later
+    ERROR = -2                              # Error communicating with the device
+    OUT_OF_MEMORY = -3                      # Out of memory
+    DEVICE_NOT_FOUND = -4                   # No device at the given index or name
+    INVALID_PARAMETERS = -5                 # At least one of the given parameters is wrong
+    TIMEOUT = -6                            # Timeout in the communication with the device
+    MVCMD_NOT_FOUND = -7                    # The file to boot Myriad was not found
+    NOT_ALLOCATED = -8                      # The graph or device has been closed during the operation
+    UNAUTHORIZED = -9
+    UNSUPPORTED_GRAPH_FILE = -10            # The graph file version is not supported
+    UNSUPPORTED_CONFIGURATION_FILE = -11    # The configuration file version is not supported
+    UNSUPPORTED_FEATURE = -12               # Not supported by this FW version
+    MYRIAD_ERROR = -13                      # An error has been reported by the device, use NC_DEVICE_DEBUG_INFO or NC_GRAPH_DEBUG_INFO
+    INVALID_DATA_LENGTH = -14               # invalid data length has been passed when reading an array/buffer option
+    INVALID_HANDLE = -15                    # handle to object that is invalid
+
+
+class GlobalOption(Enum):
+    RW_LOG_LEVEL = 0       # Log level, int, MVLOG_DEBUG = 0, debug and above (full verbosity)
+                           # MVLOG_INFO = 1, info and above
+                           # MVLOG_WARN = 2, warnings and above
+                           # MVLOG_ERROR = 3, errors and above
+                           # MVLOG_FATAL = 4, fatal only
+    RO_API_VERSION = 1     # returns api version. array of unsigned int of size 4
+                           # major.minor.hotfix.rc
+
+
+class GraphOption(Enum):
+    RO_GRAPH_STATE = 1000                  # returns graph state; CREATED, ALLOCATED, WAITING_FOR_BUFFERS, RUNNING, DESTROYED
+    RO_TIME_TAKEN = 1001                   # Return time taken for last inference (float *)
+    RO_INPUT_COUNT = 1002                  # Returns number of inputs, size of array returned by NC_RO_INPUT_TENSOR_DESCRIPTORS, int
+    RO_OUTPUT_COUNT = 1003                 # Returns number of outputs, size of array returned by NC_RO_OUTPUT_TENSOR_DESCRIPTORS, int
+    RO_INPUT_TENSOR_DESCRIPTORS = 1004     # Return a tensorDescriptor pointer array which describes the graph inputs in order.
+                                           # Can be used for Buffer creation. The length of the array can be retrieved using the INPUT_COUNT option
+    RO_OUTPUT_TENSOR_DESCRIPTORS = 1005    # Return a tensorDescriptor pointer array which describes the graph outputs in order.
+                                           # Can be used for Buffer creation. The length of the array can be retrieved using the OUTPUT_COUNT option
+    RO_DEBUG_INFO = 1006                   # Return debug info, string
+    RO_GRAPH_NAME = 1007                   # Returns/sets name of the graph, string
+    RO_CLASS_LIMIT = 1008                  # return the highest option class supported
+    RO_GRAPH_VERSION = 1009                # returns graph version, string
+    RO_TIME_TAKEN_ARRAY_SIZE = 1011        # Return size of array for time taken option, int
+    RW_EXECUTORS_NUM = 1110
+
+
+class DeviceState(Enum):
+    CREATED = 0
+    OPENED = 1
+    CLOSED = 2
+
+
+class GraphState(Enum):
+    CREATED = 0
+    ALLOCATED = 1
+    WAITING_FOR_BUFFERS = 2
+    RUNNING = 3
+
+
+class FifoState(Enum):
+    CREATED = 0
+    ALLOCATED = 1
+
+
+class DeviceOption(Enum):
+    RO_THERMAL_STATS = 2000                # Return temperatures, float *, not for general use
+    RO_THERMAL_THROTTLING_LEVEL = 2001     # 1=TEMP_LIM_LOWER reached, 2=TEMP_LIM_HIGHER reached
+    RO_DEVICE_STATE = 2002                 # CREATED, OPENED, CLOSED, DESTROYED
+    RO_CURRENT_MEMORY_USED = 2003          # Returns current device memory usage
+    RO_MEMORY_SIZE = 2004                  # Returns device memory size
+    RO_MAX_FIFO_NUM = 2005                 # return the maximum number of fifos supported
+    RO_ALLOCATED_FIFO_NUM = 2006           # return the number of currently allocated fifos
+    RO_MAX_GRAPH_NUM = 2007                # return the maximum number of graphs supported
+    RO_ALLOCATED_GRAPH_NUM = 2008          # return the number of currently allocated graphs
+    RO_CLASS_LIMIT = 2009                  # return the highest option class supported
+    RO_FW_VERSION = 2010                   # return device firmware version, array of unsigned int, size 4
+                                           # major.minor.hw.build number
+    RO_DEBUG_INFO = 2011                   # Return debug info, string, not supported yet
+    RO_MVTENSOR_VERSION = 2012             # returns mv tensor version, array of unsigned int, size 2
+                                           # major.minor
+    RO_DEVICE_NAME = 2013                  # returns device name, string
+    RO_MAX_EXECUTORS_NUM = 2014            # Maximum number of executers per graph
+    RO_HW_VERSION = 2015                   # returns HW Version, enum
+
+class DeviceHwVersion(Enum):
+    MA2450 = 0
+    MA2480 = 1
+
+
+class FifoType(Enum):
+    HOST_RO = 0             # fifo can be read through the API but can not be written (graphs can read and write data)
+    HOST_WO = 1             # fifo can be written through the API but can not be read (graphs can read but can not write)
+
+
+class FifoDataType(Enum):
+    FP16 = 0
+    FP32 = 1
+
+
+class TensorDescriptor(Structure):
+    _fields_ = [('n', c_uint),
+                ('c', c_uint),
+                ('w', c_uint),
+                ('h', c_uint),
+                ('totalSize', c_uint)]
+
+
+class FifoOption(Enum):
+    RW_TYPE = 0                # configure the fifo type to one type from ncFifoType_t
+    RW_CONSUMER_COUNT = 1      # The number of consumers of elements (the number of times data must be read by a graph or host before the element is removed. Defaults to 1. Host can read only once always.
+    RW_DATA_TYPE = 2           # 0 for fp16, 1 for fp32. If configured to fp32, the API will convert the data to the internal fp16 format automatically
+    RW_DONT_BLOCK = 3          # WriteTensor will return NC_OUT_OF_MEMORY instead of blocking, GetResult will return NO_DATA, not supported yet
+    RO_CAPACITY = 4            # return number of maximum elements in the fifo
+    RO_READ_FILL_LEVEL = 5     # return number of tensors in the buffer
+    RO_WRITE_FILL_LEVEL = 6    # return number of tensors in the buffer
+    RO_TENSOR_DESCRIPTOR = 7   # return the tensor descriptor of the FIFO
+    RO_STATE = 8               # return the fifo state; CREATED, ALLOCATED, DESTROYED
+    RO_NAME = 9                # returns fifo name
+
+
+def enumerate_devices():
+    """
+    :return array: list of Device handles
+    """
     i = 0
     devices = []
     while True:
-        if f.mvncGetDeviceName(i, name, 28) != 0:
+        handle = c_void_p()
+        if f.ncDeviceCreate(i, byref(handle)) != Status.OK.value:
             break
-        devices.append(name.value.decode("utf-8"))
+        devices.append(handle)
         i = i + 1
     return devices
 
 
-def SetGlobalOption(opt, data):
-    data = c_int(data)
-    status = f.mvncSetGlobalOption(opt.value, pointer(data), sizeof(data))
+def global_set_option(option, value):
+    """
+    :param option: a GlobalOption enumeration
+    :param value: value for the option
+    """
+    data = c_int(value)
+    status = f.ncGlobalSetOption(option.value, pointer(data), sizeof(data))
     if status != Status.OK.value:
         raise Exception(Status(status))
 
 
-def GetGlobalOption(opt):
-    if opt == GlobalOption.LOG_LEVEL:
-        optsize = c_uint()
-        optvalue = c_uint()
-        status = f.mvncGetGlobalOption(opt.value, byref(optvalue), byref(optsize))
-        if status != Status.OK.value:
-            raise Exception(Status(status))
-        return optvalue.value
-    optsize = c_uint()
-    optdata = POINTER(c_byte)()
-    status = f.mvncGetDeviceOption(0, opt.value, byref(optdata), byref(optsize))
+def global_get_option(option):
+    """
+    :param option: a GlobalOption enumeration
+    :return option: value for the option
+    """
+    # Determine option data type
+    if option == GlobalOption.RW_LOG_LEVEL:
+        optdata = c_uint()
+
+        def get_optval(raw_optdata): return raw_optdata.value
+    elif option == GlobalOption.RO_API_VERSION:
+        optdata = create_string_buffer(VERSION_MAX_SIZE * sizeof(c_uint))
+
+        def get_optval(raw_optdata): return numpy.frombuffer(raw_optdata, c_uint)
+    else:
+        raise Exception(Status.INVALID_PARAMETERS)
+
+    # Read global option
+    optsize = c_uint(sizeof(optdata))
+    status = f.ncGlobalGetOption(option.value, byref(optdata), byref(optsize))
+    if status == Status.INVALID_DATA_LENGTH.value:
+        # Create a buffer of the correct size and try again
+        optdata = create_string_buffer(optsize.value)
+        status = f.ncGlobalGetOption(
+            option.value, byref(optdata), byref(optsize))
     if status != Status.OK.value:
         raise Exception(Status(status))
-    v = create_string_buffer(optsize.value)
-    memmove(v, optdata, optsize.value)
-    return v.raw
 
+    # Get appropriately formatted option value and return
+    return get_optval(optdata)
 
-class Device:
-    def __init__(self, name):
-        self.handle = c_void_p()
-        self.name = name
 
-    def OpenDevice(self):
-        status = f.mvncOpenDevice(bytes(bytearray(self.name, "utf-8")), byref(self.handle))
+def getOptionClass(option, base):
+    return int((option.value - base)/OPTION_CLASS_SIZE)
+
+
+class Fifo:
+    def __init__(self, name, fifo_type, skip_init=False):
+        self.handle = c_void_p()
+        self.device = None
+        pName = name.encode('ascii')
+        
+        if skip_init == False:
+            status = f.ncFifoCreate(pName, fifo_type.value, byref(self.handle))
+            if status != Status.OK.value:
+                raise Exception(Status(status))
+
+    def allocate(self, device, tensor_desc, n_elem):
+        """
+        allocate a buffer. A buffer is a FIFO container, which based on type allows some of the following accesses:
+        * read from HOST
+        * read from device (graph)
+        * write from HOST
+        * write from device
+        """
+        self.device = device
+        n_elem = c_uint(n_elem)
+        status = f.ncFifoAllocate(
+            self.handle, device.handle, byref(tensor_desc), n_elem)
         if status != Status.OK.value:
             raise Exception(Status(status))
 
-    def CloseDevice(self):
-        status = f.mvncCloseDevice(self.handle)
-        self.handle = c_void_p()
+    def destroy(self):
+        """
+        destroy a buffer.
+        """
+        status = f.ncFifoDestroy(byref(self.handle))
+        self.handle = 0
         if status != Status.OK.value:
             raise Exception(Status(status))
 
-    def SetDeviceOption(self, opt, data):
-        if opt == DeviceOption.TEMP_LIM_HIGHER or opt == DeviceOption.TEMP_LIM_LOWER:
-            data = c_float(data)
+    def set_option(self, option, value):
+        """
+        Modify fifo options.
+        """
+        if (option == FifoOption.RW_DATA_TYPE or option == FifoOption.RW_TYPE):
+            data = c_int(value.value)
         else:
-            data = c_int(data)
-        status = f.mvncSetDeviceOption(self.handle, opt.value, pointer(data), sizeof(data))
+            data = c_int(value)
+        status = f.ncFifoSetOption(
+            self.handle, option.value, pointer(data), sizeof(data))
         if status != Status.OK.value:
             raise Exception(Status(status))
 
-    def GetDeviceOption(self, opt):
-        if opt == DeviceOption.TEMP_LIM_HIGHER or opt == DeviceOption.TEMP_LIM_LOWER:
-            optdata = c_float()
-        elif (opt == DeviceOption.BACKOFF_TIME_NORMAL or opt == DeviceOption.BACKOFF_TIME_HIGH or
-              opt == DeviceOption.BACKOFF_TIME_CRITICAL or opt == DeviceOption.TEMPERATURE_DEBUG or
-              opt == DeviceOption.THERMAL_THROTTLING_LEVEL):
+    def get_option(self, option):
+        """
+        Read fifo options.
+        """
+        # Determine option data type
+        if (option == FifoOption.RW_TYPE or
+                option == FifoOption.RW_CONSUMER_COUNT or
+                option == FifoOption.RW_DATA_TYPE or
+                option == FifoOption.RW_DONT_BLOCK or
+                option == FifoOption.RO_CAPACITY or
+                option == FifoOption.RO_READ_FILL_LEVEL or
+                option == FifoOption.RO_WRITE_FILL_LEVEL or
+                option == FifoOption.RO_STATE):
+            # int
             optdata = c_int()
+
+            def get_optval(raw_optdata): return raw_optdata.value
+        elif (option == FifoOption.RO_TENSOR_DESCRIPTOR):
+            # TensorDescriptor struct
+            optdata = TensorDescriptor()
+
+            def get_optval(raw_optdata): return raw_optdata
+        elif (option == FifoOption.RO_NAME):
+            # string
+            optdata = create_string_buffer(MAX_NAME_SIZE)
+
+            def get_optval(raw_optdata): return raw_optdata.value.decode()
+        else:
+            raise Exception(Status.INVALID_PARAMETERS)
+
+        # Read device option
+        optsize = c_uint(sizeof(optdata))
+        status = f.ncFifoGetOption(
+            self.handle, option.value, byref(optdata), byref(optsize))
+        if status == Status.INVALID_DATA_LENGTH.value:
+            # Create a buffer of the correct size and try again
+            optdata = create_string_buffer(optsize.value)
+            status = f.ncFifoGetOption(
+                self.handle, option.value, byref(optdata), byref(optsize))
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+        # Get appropriately formatted option value and return
+        return get_optval(optdata)
+
+    def write_elem(self, input_tensor, user_obj):
+        """
+        Send an input to a selected fifo. The fifo type must allow HOST write access to the fifo.
+        """
+        tensor = input_tensor.tostring()
+        user_obj = py_object(user_obj)
+        key = c_long(addressof(user_obj))
+        self.device.userobjs[key.value] = user_obj
+        input_len = c_uint(len(tensor))
+        status = f.ncFifoWriteElem(self.handle, tensor, byref(input_len), key)
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+    def read_elem(self):
+        """
+        Receive result from a fifo. The fifo type must allow HOST read access to the fifo.
+        Blocks if necessary. The output is fp32 or fp16 data, depending on the fifo configuration.
+        This operation will pop (remove and return) the data in case of CONSUMER_COUNT=1.
+        In case the count is bigger than one, the element will be removed only when all consumers consumed the data.
+        Even if the count is bigger than one, the API can read only once.
+        """
+
+        # first read tensor descriptor to allocate buffer for output
+        tensor_desc = TensorDescriptor()
+        optsize = c_uint(sizeof(tensor_desc))
+        status = f.ncFifoGetOption(
+            self.handle, FifoOption.RO_TENSOR_DESCRIPTOR.value, byref(tensor_desc), byref(optsize))
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+        # Get datatype
+        optdata = c_int()
+        optsize = c_uint(sizeof(optdata))
+        status = f.ncFifoGetOption(
+            self.handle, FifoOption.RW_DATA_TYPE.value, byref(optdata), byref(optsize))
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+        datatype = optdata.value
+
+        if (datatype == FifoDataType.FP32.value):
+            sizeof_td_dt = tensor_desc.totalSize / \
+                (tensor_desc.n * tensor_desc.c * tensor_desc.w * tensor_desc.h)
+            tensorlen = c_uint(
+                int(tensor_desc.totalSize / sizeof_td_dt * numpy.dtype(numpy.float32).itemsize))
         else:
-            optdata = POINTER(c_byte)()
-        optsize = c_uint()
-        status = f.mvncGetDeviceOption(self.handle, opt.value, byref(optdata), byref(optsize))
+            tensorlen = c_uint(tensor_desc.totalSize)
+
+        tensor = create_string_buffer(tensorlen.value)
+        user_obj = c_long()
+        status = f.ncFifoReadElem(self.handle, byref(
+            tensor), byref(tensorlen), byref(user_obj))
+        # if status == Status.NO_DATA.value:
+        #    return None, None
         if status != Status.OK.value:
             raise Exception(Status(status))
-        if opt == DeviceOption.TEMP_LIM_HIGHER or opt == DeviceOption.TEMP_LIM_LOWER:
-            return optdata.value
-        elif (opt == DeviceOption.BACKOFF_TIME_NORMAL or opt == DeviceOption.BACKOFF_TIME_HIGH or
-              opt == DeviceOption.BACKOFF_TIME_CRITICAL or opt == DeviceOption.TEMPERATURE_DEBUG or
-              opt == DeviceOption.THERMAL_THROTTLING_LEVEL):
-            return optdata.value
-        v = create_string_buffer(optsize.value)
-        memmove(v, optdata, optsize.value)
-        if opt == DeviceOption.OPTIMISATION_LIST:
-            l = []
-            for i in range(40):
-                if v.raw[i * 50] != 0:
-                    ss = v.raw[i * 50:]
-                    end = ss.find(b'\x00')
-                    val = ss[0:end].decode()
-                    if val:
-                        l.append(val)
-            return l
-        if opt == DeviceOption.THERMAL_STATS:
-            return numpy.frombuffer(v.raw, dtype=numpy.float32)
-        return int.from_bytes(v.raw, byteorder='little')
-
-    def AllocateGraph(self, graphfile):
-        hgraph = c_void_p()
-        status = f.mvncAllocateGraph(self.handle, byref(hgraph), graphfile, len(graphfile))
+
+        # Convert to numpy array
+        if (datatype == FifoDataType.FP32.value):
+            tensor = numpy.fromstring(tensor.raw, dtype=numpy.float32)
+        else:
+            tensor = numpy.fromstring(tensor.raw, dtype=numpy.float16)
+
+        retuserobj = self.device.userobjs[user_obj.value]
+        del self.device.userobjs[user_obj.value]
+        return tensor, retuserobj.value
+
+    def remove_elem(self):  # not supported yet
+        """
+        Remove oldest element from a buffer.
+        """
+        status = f.ncFifoRemoveElem(byref(self.handle))
         if status != Status.OK.value:
             raise Exception(Status(status))
-        return Graph(hgraph)
 
 
-class Graph:
+class Device:
     def __init__(self, handle):
+        """
+        """
         self.handle = handle
         self.userobjs = {}
 
-    def SetGraphOption(self, opt, data):
-        data = c_int(data)
-        status = f.mvncSetGraphOption(self.handle, opt.value, pointer(data), sizeof(data))
+    def open(self):
+        """
+        Open function boots and initializes the device.
+        """
+        status = f.ncDeviceOpen(self.handle)
         if status != Status.OK.value:
             raise Exception(Status(status))
 
-    def GetGraphOption(self, opt):
-        if opt == GraphOption.ITERATIONS or opt == GraphOption.NETWORK_THROTTLE or opt == GraphOption.DONT_BLOCK:
+    def close(self):
+        """
+        Close function will reset the device and stop the communication.
+        """
+        status = f.ncDeviceClose(self.handle)
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+    def destroy(self):
+        """
+        Destroy device handler, and clears allocated memory
+        """
+        status = f.ncDeviceDestroy(byref(self.handle))
+        self.handle = c_void_p()
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+    def set_option(self, option, value):
+        """
+        Set an optional feature of the device.
+        :param option: a DeviceOption enumeration
+        :param value: value for the option
+        """
+        # Handle high class
+        opClass = getOptionClass(option, DEVICE_CLASS0_BASE)
+        if (opClass > 1 and SUPPORT_HIGHCLASS is True):
+            data = self.set_option_hc(f, Status, option, value)
+        else:
+            # Determine option data type
+            if (option == DeviceOption.RO_THERMAL_THROTTLING_LEVEL or option == DeviceOption.RO_DEVICE_STATE or
+                option == DeviceOption.RO_CURRENT_MEMORY_USED or option == DeviceOption.RO_MEMORY_SIZE or
+                option == DeviceOption.RO_MAX_FIFO_NUM or option == DeviceOption.RO_ALLOCATED_FIFO_NUM or
+                option == DeviceOption.RO_MAX_GRAPH_NUM or option == DeviceOption.RO_ALLOCATED_GRAPH_NUM or
+                    option == DeviceOption.RO_CLASS_LIMIT or option == DeviceOption.RO_HW_VERSION):
+                data = c_int(value)
+            else:
+                raise Exception(Status.INVALID_PARAMETERS)
+
+        # Write device option
+        status = f.ncDeviceSetOption(
+            self.handle, option.value, pointer(data), sizeof(data))
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+    def get_option(self, option):
+        """
+        Get optional information from the device.
+        :param option: a DeviceOption enumeration
+        :return option: value for the option
+        """
+        # Handle high class
+        opClass = getOptionClass(option, DEVICE_CLASS0_BASE)
+        if (opClass > 1 and SUPPORT_HIGHCLASS is True):
+            ret = self.get_option_hc(f, Status, option)
+            return ret
+
+        # Determine option data type
+        if (option == DeviceOption.RO_THERMAL_THROTTLING_LEVEL or
+                option == DeviceOption.RO_DEVICE_STATE or
+                option == DeviceOption.RO_CURRENT_MEMORY_USED or
+                option == DeviceOption.RO_MEMORY_SIZE or
+                option == DeviceOption.RO_MAX_FIFO_NUM or
+                option == DeviceOption.RO_ALLOCATED_FIFO_NUM or
+                option == DeviceOption.RO_MAX_GRAPH_NUM or
+                option == DeviceOption.RO_ALLOCATED_GRAPH_NUM or
+                option == DeviceOption.RO_CLASS_LIMIT or
+                option == DeviceOption.RO_MAX_EXECUTORS_NUM or
+                option == DeviceOption.RO_HW_VERSION):
+            # int
             optdata = c_int()
+
+            def get_optval(raw_optdata): return raw_optdata.value
+        elif (option == DeviceOption.RO_THERMAL_STATS):
+            # float array
+            optdata = create_string_buffer(THERMAL_BUFFER_SIZE)
+
+            def get_optval(raw_optdata):
+                return numpy.frombuffer(raw_optdata, c_float)
+        elif (option == DeviceOption.RO_FW_VERSION or
+              option == DeviceOption.RO_MVTENSOR_VERSION):
+            # unsigned int array
+            optdata = create_string_buffer(VERSION_MAX_SIZE * sizeof(c_uint))
+
+            def get_optval(raw_optdata):
+                return numpy.frombuffer(raw_optdata, c_uint)
+        elif option == DeviceOption.RO_DEBUG_INFO:
+            # string
+            optdata = create_string_buffer(DEBUG_BUFFER_SIZE)
+
+            def get_optval(raw_optdata): return raw_optdata.value.decode()
+        elif option == DeviceOption.RO_DEVICE_NAME:
+            # string
+            optdata = create_string_buffer(MAX_NAME_SIZE)
+
+            def get_optval(raw_optdata): return raw_optdata.value.decode()
         else:
-            optdata = POINTER(c_byte)()
-        optsize = c_uint()
-        status = f.mvncGetGraphOption(self.handle, opt.value, byref(optdata), byref(optsize))
+            raise Exception(Status.INVALID_PARAMETERS)
+
+        # Read device option
+        optsize = c_uint(sizeof(optdata))
+        status = f.ncDeviceGetOption(
+            self.handle, option.value, byref(optdata), byref(optsize))
+        if status == Status.INVALID_DATA_LENGTH.value:
+            # Create a buffer of the correct size and try again
+            optdata = create_string_buffer(optsize.value)
+            status = f.ncDeviceGetOption(
+                self.handle, option.value, byref(optdata), byref(optsize))
         if status != Status.OK.value:
             raise Exception(Status(status))
-        if opt == GraphOption.ITERATIONS or opt == GraphOption.NETWORK_THROTTLE or opt == GraphOption.DONT_BLOCK:
-            return optdata.value
-        v = create_string_buffer(optsize.value)
-        memmove(v, optdata, optsize.value)
-        if opt == GraphOption.TIME_TAKEN:
-            return numpy.frombuffer(v.raw, dtype=numpy.float32)
-        if opt == GraphOption.DEBUG_INFO:
-            return v.raw[0:v.raw.find(0)].decode()
-        return int.from_bytes(v.raw, byteorder='little')
-
-    def DeallocateGraph(self):
-        status = f.mvncDeallocateGraph(self.handle)
-        self.handle = 0
+
+        # Get appropriately formatted option value and return
+        return get_optval(optdata)
+
+
+class Graph:
+    def __init__(self, name):
+        self.handle = c_void_p()
+        self.device = None
+        pName = name.encode('ascii')
+            
+        """
+        Initalize a new graph.
+        This function will not send anything to the device,
+        all parameters can be configured after calling this function.
+        Takes a name as input.  Returns a handle to the graph.
+        """
+        status = f.ncGraphCreate(pName, byref(self.handle))
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+    def allocate(self, device, graph_buffer):
+        """
+        Allocate a graph on the device. When calling this function, the graph is sent to the device,
+        no STATIC parameters of the graph can be configured after this function call.
+        """
+        self.device = device
+        status = f.ncGraphAllocate(device.handle, self.handle, graph_buffer, len(graph_buffer))
         if status != Status.OK.value:
             raise Exception(Status(status))
 
-    def LoadTensor(self, tensor, userobj):
-        tensor = tensor.tostring()
-        userobj = py_object(userobj)
-        key = c_long(addressof(userobj))
-        self.userobjs[key.value] = userobj
-        status = f.mvncLoadTensor(self.handle, tensor, len(tensor), key)
-        if status == Status.BUSY.value:
-            return False
+    def allocate_with_fifos(self, device, graph_buffer,
+                                  input_fifo_type=FifoType.HOST_WO, input_fifo_num_elem=2,
+                                  input_fifo_data_type=FifoDataType.FP32,
+                                  output_fifo_type=FifoType.HOST_RO, output_fifo_num_elem=2,
+                                  output_fifo_data_type=FifoDataType.FP32):
+        """
+        Convenience function to initialize & allocate graph with Input & Output fifos
+        """
+        input_fifo = Fifo("", None, skip_init=True)
+        output_fifo = Fifo("", None, skip_init=True)
+        input_fifo.device = device
+        output_fifo.device = device
+        in_num_elem = c_uint(input_fifo_num_elem)
+        out_num_elem = c_uint(output_fifo_num_elem)
+        self.device = device
+
+        status = f.ncGraphAllocateWithFifosEx(device.handle, self.handle,
+                                              graph_buffer, len(graph_buffer),
+                                              byref(input_fifo.handle),
+                                              input_fifo_type.value, in_num_elem,
+                                              input_fifo_data_type.value,
+                                              byref(output_fifo.handle),
+                                              output_fifo_type.value, out_num_elem,
+                                              output_fifo_data_type.value)
         if status != Status.OK.value:
-            del self.userobjs[key.value]
             raise Exception(Status(status))
-        return True
-
-    def GetResult(self):
-        tensor = c_void_p()
-        tensorlen = c_uint()
-        userobj = c_long()
-        status = f.mvncGetResult(self.handle, byref(tensor), byref(tensorlen), byref(userobj))
-        if status == Status.NO_DATA.value:
-            return None, None
+
+        return input_fifo, output_fifo
+
+    def set_option(self, option, value):
+        """
+        Set an optional feature of the graph.
+        :param option: a GraphOption enumeration
+        :param value: value for the option
+        """
+        # Write device option
+        data = c_int(value)
+        status = f.ncGraphSetOption(
+            self.handle, option.value, pointer(data), sizeof(data))
         if status != Status.OK.value:
             raise Exception(Status(status))
-        v = create_string_buffer(tensorlen.value)
-        memmove(v, tensor, tensorlen.value)
-        tensor = numpy.frombuffer(v.raw, dtype=numpy.float16)
-        retuserobj = self.userobjs[userobj.value]
-        del self.userobjs[userobj.value]
-        return tensor, retuserobj.value
+
+    def get_option(self, option):
+        """
+        Get optional information from the graph.
+        :param option: a GraphOption enumeration
+        :return option: value for the option
+        """
+        # Handle high class
+        opClass = getOptionClass(option, GRAPH_CLASS0_BASE)
+        if (opClass > 1 and SUPPORT_HIGHCLASS is True):
+            ret = self.get_option_hc(f, Status, option)
+            return ret
+
+        # Determine option data type
+        if (option == GraphOption.RO_GRAPH_STATE or
+                option == GraphOption.RO_INPUT_COUNT or
+                option == GraphOption.RO_OUTPUT_COUNT or
+                option == GraphOption.RO_CLASS_LIMIT or
+                option == GraphOption.RO_TIME_TAKEN_ARRAY_SIZE or
+                option == GraphOption.RW_EXECUTORS_NUM):
+            # int
+            optdata = c_int()
+
+            def get_optval(raw_optdata): return raw_optdata.value
+        elif (option == GraphOption.RO_TIME_TAKEN):
+            # float array
+            arraysize = c_int()
+            optsize = c_uint(sizeof(arraysize))
+            status = f.ncGraphGetOption(
+                self.handle, GraphOption.RO_TIME_TAKEN_ARRAY_SIZE.value, byref(arraysize), byref(optsize))
+            if status != Status.OK.value:
+                raise Exception(Status(status))
+            optdata = create_string_buffer(arraysize.value)
+
+            def get_optval(raw_optdata):
+                return numpy.frombuffer(raw_optdata, c_float)
+        elif (option == GraphOption.RO_GRAPH_VERSION):
+            # unsigned int array
+            optdata = create_string_buffer(VERSION_MAX_SIZE * sizeof(c_uint))
+
+            def get_optval(raw_optdata):
+                return numpy.frombuffer(raw_optdata, c_uint)
+        elif option == GraphOption.RO_DEBUG_INFO:
+            # string
+            optdata = create_string_buffer(DEBUG_BUFFER_SIZE)
+
+            def get_optval(raw_optdata): return raw_optdata.value.decode()
+        elif option == GraphOption.RO_GRAPH_NAME:
+            # string
+            optdata = create_string_buffer(MAX_NAME_SIZE)
+
+            def get_optval(raw_optdata): return raw_optdata.value.decode()
+        elif option == GraphOption.RO_INPUT_TENSOR_DESCRIPTORS:
+            # list of TensorDescriptor structs
+
+            # Get the number of input TensorDescriptors
+            desc_count = c_int()
+            optsize = c_uint(sizeof(desc_count))
+            status = f.ncGraphGetOption(
+                self.handle, GraphOption.RO_INPUT_COUNT.value, byref(desc_count), byref(optsize))
+            if status != Status.OK.value:
+                raise Exception(Status(status))
+
+            # Create an appropriately sized buffer for getting the TensorDescriptor data
+            optdata = create_string_buffer(
+                desc_count.value * sizeof(TensorDescriptor))
+
+            def get_optval(raw_optdata):
+                # Split the ctypes char array into a list of TensorDescriptors and return the list
+                desc_list = []
+                struct_size = sizeof(TensorDescriptor)
+                for i in range(0, desc_count.value * struct_size, struct_size):
+                    desc_bytes = raw_optdata[i:i+struct_size]
+                    desc_list.append(TensorDescriptor.from_buffer_copy(desc_bytes))
+                return desc_list
+        elif option == GraphOption.RO_OUTPUT_TENSOR_DESCRIPTORS:
+            # list of TensorDescriptor structs
+
+            # Get the number of output TensorDescriptors
+            desc_count = c_int()
+            optsize = c_uint(sizeof(desc_count))
+            status = f.ncGraphGetOption(
+                self.handle, GraphOption.RO_OUTPUT_COUNT.value, byref(desc_count), byref(optsize))
+            if status != Status.OK.value:
+                raise Exception(Status(status))
+
+            # Create an appropriately sized buffer for getting the TensorDescriptor data
+            optdata = create_string_buffer(
+                desc_count.value * sizeof(TensorDescriptor))
+
+            def get_optval(raw_optdata):
+                # Split the ctypes char array into a list of TensorDescriptors and return the list
+                desc_list = []
+                struct_size = sizeof(TensorDescriptor)
+                for i in range(0, desc_count.value * struct_size, struct_size):
+                    desc_bytes = raw_optdata[i:i+struct_size]
+                    desc_list.append(TensorDescriptor.from_buffer_copy(desc_bytes))
+                return desc_list
+        else:
+            raise Exception(Status.INVALID_PARAMETERS)
+
+        # Read device option
+        optsize = c_uint(sizeof(optdata))
+        status = f.ncGraphGetOption(
+            self.handle, option.value, byref(optdata), byref(optsize))
+        if status == Status.INVALID_DATA_LENGTH.value:
+            # Create a buffer of the correct size and try again
+            optdata = create_string_buffer(optsize.value)
+            status = f.ncGraphGetOption(
+                self.handle, option.value, byref(optdata), byref(optsize))
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+        # Get appropriately formatted option value and return
+        return get_optval(optdata)
+
+    def queue_inference(self, input_fifo, output_fifo):
+        """
+        Trigger graph execution with specified inputs and outputs.
+        """
+        status = f.ncGraphQueueInference(self.handle, byref(input_fifo.handle),
+                                         1, byref(output_fifo.handle), 1)
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+    def queue_inference_with_fifo_elem(self, input_fifo, output_fifo, input_tensor, user_obj):
+        """
+        Trigger graph execution with specified inputs and outputs.
+        """
+        tensor = input_tensor.tostring()
+        user_obj = py_object(user_obj)
+        key = c_long(addressof(user_obj))
+        input_fifo.device.userobjs[key.value] = user_obj
+        input_len = c_uint(len(tensor))
+        status = f.ncGraphQueueInferenceWithFifoElem(self.handle, input_fifo.handle,
+                                                     output_fifo.handle, tensor,
+                                                     byref(input_len), key)
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+    def destroy(self):
+        """
+        destroy a graph on the device.
+        """
+        status = f.ncGraphDestroy(byref(self.handle))
+        self.handle = 0
+        if status != Status.OK.value:
+            raise Exception(Status(status))
+
+
+# Add highclass methods
+try:
+    from mvnc.highclass import *
+    Device.set_option_hc = device_set_option_hc
+    Device.get_option_hc = device_get_option_hc
+    Graph.get_option_hc = graph_get_option_hc
+    SUPPORT_HIGHCLASS = True
+except:
+    pass
index eb61fa4e3f36f363e0c1a24eb4777f4977e7c28d..edce7051408c35df4618dddce3f7768e7a872773 100644 (file)
@@ -1,3 +1,5 @@
 SUBSYSTEM=="usb", ATTRS{idProduct}=="2150", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
+SUBSYSTEM=="usb", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
 SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
 SUBSYSTEM=="tty", ATTRS{idProduct}=="2150", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
+SUBSYSTEM=="tty", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
index 5d6b45d0ff68b86ec65cfcffbf6813892b55bab1..64c444e0de9c03947f128e0c6377f9ecbe44618c 100644 (file)
@@ -1,18 +1,38 @@
 ARCH := $(shell uname -m)
 
-LIBS += -lpthread -lusb-1.0 -ldl
 
 OUT := libmvnc.so.0
 OBJDIR := obj-$(ARCH)
 INSTALLDIR := ${DESTDIR}/usr/local
 PYTHON3DIST := $(shell python3 -c "import site; print(site.getsitepackages()[0])")
 PYTHON2DIST := $(shell python -c "import site; print(site.getsitepackages()[0])")
-
+VERSION_NUMBER=`cat ./version.txt`
 SRCS := \
-       usb_boot.c \
-       usb_link_vsc.c \
-       mvnc_api.c
+       mvnc_api.c \
+       fp16.c
+
+
+MV_COMMON_BASE=$(realpath ./common)
+XLINK_BASE=$(MV_COMMON_BASE)/components/XLink
+XLINKCONSOLE_BASE=$(MV_COMMON_BASE)/components/XLinkConsole
+
+XLINK_SRCS=$(XLINK_BASE)/pc/usb_boot.c
+XLINK_SRCS+=$(XLINK_BASE)/shared/XLink.c
+XLINK_SRCS+=$(XLINK_BASE)/shared/XLinkDispatcher.c
+XLINK_SRCS+=$(XLINKCONSOLE_BASE)/pc/XLinkConsole.c
+XLINK_SRCS+=$(XLINK_BASE)/pc/UsbLinkPlatform.c
 
+XLINK_CFLAGS= -I$(XLINK_BASE)/shared \
+                       -I$(XLINK_BASE)/pc \
+                       -I$(XLINKCONSOLE_BASE)/pc \
+                       -I $(MV_COMMON_BASE)/swCommon/include/ \
+                       -I $(MV_COMMON_BASE)/shared/include/
+
+CFLAGS+=$(XLINK_CFLAGS) -D__PC__ -DUSE_USB_VSC -DVERSION_NAME="\"$(VERSION_NUMBER)\""
+#CFLAGS+=-DXLINK_NO_BOOT
+CFLAGS+=-DDEVICE_SHELL_ENABLED
+
+LIBS += -lpthread -lusb-1.0 -ldl -lmvnc_highclass -L$(INSTALLDIR)/lib/
 INCLUDES := \
        -I. \
        -I../include \
@@ -22,31 +42,32 @@ CFLAGS += -O2 -Wall -pthread -fPIC -MMD -MP
 LDFLAGS += -shared
 
 OBJS := $(SRCS:%.c=$(OBJDIR)/%.o)
+OBJS += $(XLINK_SRCS:%.c=$(OBJDIR)/%.o)
 DEPS := $(OBJS:.o=.d)
-
 all: obj-$(ARCH)/libmvnc.so.0
 
 $(OBJDIR)/$(OUT): $(OBJS)
+       if [ ! -e ./version.txt ] ; then echo "missing version.txt file"; exit 1; fi;
        $(CC) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
        ln -fs $(OBJDIR)/$(OUT) libmvnc.so
        ln -fs $(OBJDIR)/$(OUT) $(OUT)
 
-$(OBJDIR)/%.o: %.c | $(OBJDIR)
+$(OBJDIR)/%.o: %.c
+       @mkdir -p $(dir $@)
        $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
 
-$(OBJDIR):
-       @mkdir $@
-
 -include $(DEPS)
 
 basicinstall: $(OBJDIR)/$(OUT)
        mkdir -p $(INSTALLDIR)/include/
+       mkdir -p $(INSTALLDIR)/include/mvnc2
        mkdir -p $(INSTALLDIR)/lib/
        cp $(OBJDIR)/$(OUT) $(INSTALLDIR)/lib/
        ln -fs libmvnc.so.0 $(INSTALLDIR)/lib/libmvnc.so
-       cp ../include/*.h $(INSTALLDIR)/include/
+       cp ../include/mvnc.h $(INSTALLDIR)/include/mvnc2
+       ln -fs $(INSTALLDIR)/include/mvnc2/mvnc.h $(INSTALLDIR)/include/mvnc.h 
        mkdir -p $(INSTALLDIR)/lib/mvnc
-       cp mvnc/MvNCAPI.mvcmd $(INSTALLDIR)/lib/mvnc/
+       cp mvnc/MvNCAPI-*.mvcmd $(INSTALLDIR)/lib/mvnc/
        mkdir -p ${DESTDIR}/etc/udev/rules.d/
        cp 97-usbboot.rules ${DESTDIR}/etc/udev/rules.d/
 
@@ -67,9 +88,9 @@ uninstall:
        rm -f $(INSTALLDIR)/lib/libmvnc.so.0
        rm -f $(INSTALLDIR)/lib/libmvnc.so
        rm -f $(INSTALLDIR)/include/mvnc.h
-       rm -f $(INSTALLDIR)/include/mvnc_deprecated.h
+       rm -f $(INSTALLDIR)/include/mvnc2/mvnc.h
        rm -f $(INSTALLDIR)/lib/mvnc/MvNCAPI.mvcmd
-       rm -rf $(INSTALLDIR)/lib/mvnc
+#      rm -rf $(INSTALLDIR)/lib/mvnc
        rm -rf ${DESTDIR}$(PYTHON3DIST)/mvnc
        rm -rf ${DESTDIR}$(PYTHON2DIST)/mvnc
        rm -f ${DESTDIR}/etc/udev/rules.d/97-usbboot.rules
diff --git a/api/src/Makefile.rpi b/api/src/Makefile.rpi
deleted file mode 100644 (file)
index 6cf9012..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-ARCH := armv7l
-
-PIROOT := $(shell echo $(HOME))/piroot
-CC := arm-linux-gnueabihf-gcc --sysroot=$(PIROOT)
-LIBS += -ludev -lpthread -lusb-1.0 -ldl
-
-OUT := libmvnc.so.0
-OBJDIR := obj-$(ARCH)
-INSTALLDIR := ${DESTDIR}/usr/local
-PYTHON3DIST := $(shell python3 -c "import site; print(site.getsitepackages()[0])")
-PYTHON2DIST := $(shell python -c "import site; print(site.getsitepackages()[0])")
-
-SRCS := \
-       usb_boot.c \
-       usb_link_vsc.c \
-       mvnc_api.c
-
-INCLUDES := \
-       -I. \
-       -I../include \
-       -I$(SYSROOT)/usr/include/libusb-1.0 \
-
-CFLAGS += -O2 -Wall -pthread -fPIC -MMD -MP
-LDFLAGS += -shared
-
-OBJS := $(SRCS:%.c=$(OBJDIR)/%.o)
-DEPS := $(OBJS:.o=.d)
-
-$(OBJDIR)/$(OUT): $(OBJS)
-       $(CC) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
-
-$(OBJDIR)/%.o: %.c | $(OBJDIR)
-       $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
-
-$(OBJDIR):
-       @mkdir $@
-
--include $(DEPS)
-
-clean:
-       rm -f $(OUT)
-       rm -f $(OBJS)
-       rm -rf $(OBJDIR)
diff --git a/api/src/USBLinkDefines.h b/api/src/USBLinkDefines.h
deleted file mode 100644 (file)
index 4ec8cad..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* Copyright 2017 Intel Corporation.
-* The source code, information and material ("Material") contained herein is
-* owned by Intel Corporation or its suppliers or licensors, and title to such
-* Material remains with Intel Corporation or its suppliers or licensors.
-* The Material contains proprietary information of Intel or its suppliers and
-* licensors. The Material is protected by worldwide copyright laws and treaty
-* provisions.
-* No part of the Material may be used, copied, reproduced, modified, published,
-* uploaded, posted, transmitted, distributed or disclosed in any way without
-* Intel's prior express written permission. No license under any patent,
-* copyright or other intellectual property rights in the Material is granted to
-* or conferred upon you, either expressly, by implication, inducement, estoppel
-* or otherwise.
-* Any license under such intellectual property rights must be express and
-* approved by Intel in writing.
-*/
-
-#ifndef _USBLINKCOMMONDEFINES_H
-#define _USBLINKCOMMONDEFINES_H
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define MAX_NAME_LENGTH 52
-// Packet length will define the maximum message length between pc and myriad. All bigger messages than this number will be split in multiple messages
-#define PACKET_LENGTH (64*1024)
-
-typedef struct bufferEntryDesc_t {
-       char name[MAX_NAME_LENGTH];
-       uint8_t *data;
-       uint32_t length;
-} bufferEntryDesc_t;
-
-typedef enum {
-       USB_LINK_GET_MYRIAD_STATUS = 0,
-       USB_LINK_RESET_REQUEST,
-       USB_LINK_HOST_SET_DATA,
-       USB_LINK_HOST_GET_DATA
-} hostcommands_t;
-
-typedef enum {
-       MYRIAD_NOT_INIT = 0,
-       MYRIAD_INITIALIZED = 0x11,
-       MYRIAD_WAITING = 0x22,
-       MYRIAD_RUNNING = 0x33,
-       MYRIAD_FINISHED = 0x44,
-       MYRIAD_PENDING = 0x55,
-} myriadStatus_t;
-
-typedef struct usbHeader_t {
-       uint8_t cmd;
-       uint8_t hostready;
-       uint16_t reserved;
-       uint32_t dataLength;
-       uint32_t offset;
-       char name[MAX_NAME_LENGTH];
-} usbHeader_t;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-/* end of include file */
diff --git a/api/src/common.h b/api/src/common.h
deleted file mode 100644 (file)
index 7385f0c..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-* Copyright 2017 Intel Corporation.
-* The source code, information and material ("Material") contained herein is
-* owned by Intel Corporation or its suppliers or licensors, and title to such
-* Material remains with Intel Corporation or its suppliers or licensors.
-* The Material contains proprietary information of Intel or its suppliers and
-* licensors. The Material is protected by worldwide copyright laws and treaty
-* provisions.
-* No part of the Material may be used, copied, reproduced, modified, published,
-* uploaded, posted, transmitted, distributed or disclosed in any way without
-* Intel's prior express written permission. No license under any patent,
-* copyright or other intellectual property rights in the Material is granted to
-* or conferred upon you, either expressly, by implication, inducement, estoppel
-* or otherwise.
-* Any license under such intellectual property rights must be express and
-* approved by Intel in writing.
-*/
-
-// Common logging macros
-#define PRINT_DEBUG(...)  {if (mvnc_loglevel > 1) fprintf(__VA_ARGS__);}
-#define PRINT_DEBUG_F(...)  {if (mvnc_loglevel > 1) \
-                                { fprintf(__VA_ARGS__); fflush(stderr); } }\
-
-#define PRINT_INFO(...)   {if (mvnc_loglevel > 0) fprintf(__VA_ARGS__);}
-#define PRINT_INFO_F(...)  {if (mvnc_loglevel > 0) \
-                                { fprintf(__VA_ARGS__); fflush(stderr); } }\
-
-#define PRINT(...) fprintf(stderr,__VA_ARGS__)
-
-// Common defines
-#define DEFAULT_VID                            0x03E7
-#define DEFAULT_PID                            0x2150  // Myriad2v2 ROM
-#define DEFAULT_OPEN_VID                       DEFAULT_VID
-#define DEFAULT_OPEN_PID                       0xf63b  // Once opened in VSC mode, VID/PID change
diff --git a/api/src/common/components/XLink/pc/UsbLinkPlatform.c b/api/src/common/components/XLink/pc/UsbLinkPlatform.c
new file mode 100644 (file)
index 0000000..f37edd1
--- /dev/null
@@ -0,0 +1,529 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @brief     Application configuration Leon header
+///
+
+#include "UsbLinkPlatform.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <sys/timeb.h>
+
+#include <errno.h>
+
+#if (defined(_WIN32) || defined(_WIN64) )
+#include "usb_winusb.h"
+#include "gettime.h"
+extern void initialize_usb_boot();
+#else
+#include <unistd.h>
+#include <sys/wait.h>
+#include <sys/un.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <libusb.h>
+#endif
+#include "usb_boot.h"
+
+#ifdef USE_LINK_JTAG
+#include <sys/types.h>          /* See NOTES */
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif  /*USE_LINK_JTAG*/
+
+#define USB_LINK_SOCKET_PORT 5678
+
+#define USBLINK_ERROR_PRINT
+#ifdef USBLINK_ERROR_PRINT
+#define USBLINK_ERROR(...) printf(__VA_ARGS__)
+#else
+#define USBLINK_ERROR(...) (void)0
+#endif  /*USBLINK_ERROR_PRINT*/
+
+#ifdef USBLINKDEBUG
+#define USBLINK_PRINT(...) printf(__VA_ARGS__)
+#else
+#define USBLINK_PRINT(...) (void)0
+#endif  /*USBLINKDEBUG*/
+
+
+#ifndef USE_USB_VSC
+int usbFdWrite = -1;
+int usbFdRead = -1;
+#endif  /*USE_USB_VSC*/
+
+static int statuswaittimeout = 5;
+
+#include <pthread.h>
+#include <assert.h>
+
+pthread_t readerThreadId;
+
+#define MAX_EVENTS 64
+
+uint32_t numPoolsAllocated = 0;
+
+#define USB_ENDPOINT_IN 0x81
+#define USB_ENDPOINT_OUT 0x01
+
+//libusb_device_handle* f;
+
+static double seconds()
+{
+    static double s;
+    struct timespec ts;
+
+    clock_gettime(CLOCK_MONOTONIC, &ts);
+    if(!s)
+        s = ts.tv_sec + ts.tv_nsec * 1e-9;
+    return ts.tv_sec + ts.tv_nsec * 1e-9 - s;
+}
+
+static int usb_write(libusb_device_handle *f, const void *data, size_t size, unsigned int timeout)
+{
+    while(size > 0)
+    {
+        int bt,ss = size;
+        if(ss > 1024*1024*10)
+            ss = 1024*1024*10;
+#if (defined(_WIN32) || defined(_WIN64) )
+        int rc = usb_bulk_write(f, USB_ENDPOINT_OUT, (unsigned char *)data, ss, &bt, timeout);
+#else
+        int rc = libusb_bulk_transfer(f, USB_ENDPOINT_OUT, (unsigned char *)data, ss, &bt, timeout);
+#endif
+        if(rc)
+            return rc;
+        data = (char *)data + bt;
+        size -= bt;
+    }
+    return 0;
+}
+
+static int usb_read(libusb_device_handle *f, void *data, size_t size, unsigned int timeout)
+{
+    while(size > 0)
+    {
+        int bt,ss = size;
+        if(ss > 1024*1024*10)
+            ss = 1024*1024*10;
+#if (defined(_WIN32) || defined(_WIN64))
+        int rc = usb_bulk_read(f, USB_ENDPOINT_IN, (unsigned char *)data, ss, &bt, timeout);
+#else
+        int rc = libusb_bulk_transfer(f, USB_ENDPOINT_IN,(unsigned char *)data, ss, &bt, timeout);
+#endif
+        if(rc)
+            return rc;
+        data = ((char *)data) + bt;
+        size -= bt;
+    }
+    return 0;
+}
+
+libusb_device_handle *usblink_open(const char *path)
+{
+    usbBootError_t rc = USB_BOOT_DEVICE_NOT_FOUND;
+    libusb_device_handle *h = NULL;
+    libusb_device *dev = NULL;
+    double waittm = seconds() + statuswaittimeout;
+    while(seconds() < waittm){
+        int size = path != NULL ? strlen(path) : 0;
+        rc = usb_find_device(0, (char *)path, size, (void **)&dev, DEFAULT_OPENVID, DEFAULT_OPENPID);
+        if(rc == USB_BOOT_SUCCESS)
+            break;
+        usleep(1000);
+    }
+    if (rc == USB_BOOT_TIMEOUT || rc == USB_BOOT_DEVICE_NOT_FOUND) // Timeout
+        return 0;
+#if (defined(_WIN32) || defined(_WIN64) )
+       h = usb_open_device(dev, NULL, 0, NULL);
+       int libusb_rc = ((h != NULL) ? (0) : (-1));
+       if (libusb_rc < 0)
+       {
+               usb_close_device(h);
+               usb_free_device(dev);
+               return 0;
+       }
+       //usb_close_device(h);
+       //usb_free_device(dev);
+#else
+    int libusb_rc = libusb_open(dev, &h);
+    if (libusb_rc < 0)
+    {
+        libusb_unref_device(dev);
+        return 0;
+    }
+    libusb_unref_device(dev);
+    libusb_rc = libusb_claim_interface(h, 0);
+    if(libusb_rc < 0)
+    {
+        libusb_close(h);
+        return 0;
+    }
+#endif
+    return h;
+}
+
+void usblink_close(libusb_device_handle *f)
+{
+#if (defined(_WIN32) || defined(_WIN64))
+    usb_close_device(f);
+#else
+    libusb_release_interface(f, 0);
+    libusb_close(f);
+#endif
+}
+
+int USBLinkWrite(void* fd, void* data, int size, unsigned int timeout)
+{
+    int rc = 0;
+#ifndef USE_USB_VSC
+    int byteCount = 0;
+#ifdef USE_LINK_JTAG
+    while (byteCount < size){
+        byteCount += write(usbFdWrite, &((char*)data)[byteCount], size - byteCount);
+        printf("write %d %d\n", byteCount, size);
+    }
+#else
+    if(usbFdWrite < 0)
+    {
+        return -1;
+    }
+    while(byteCount < size)
+    {
+       int toWrite = (PACKET_LENGTH && (size - byteCount > PACKET_LENGTH)) \
+                        ? PACKET_LENGTH:size - byteCount;
+       int wc = write(usbFdWrite, ((char*)data) + byteCount, toWrite);
+//       printf("wwrite %x %d %x %d\n", wc, handler->commFd, ((char*)data) + byteCount, toWrite);
+
+       if ( wc != toWrite)
+       {
+           return -2;
+       }
+
+       byteCount += toWrite;
+       unsigned char acknowledge;
+       int rc;
+       rc = read(usbFdWrite, &acknowledge, sizeof(acknowledge));
+       if ( rc < 0)
+       {
+           return -2;
+       }
+       if (acknowledge == 0xEF)
+       {
+//         printf("read %x\n", acknowledge);
+       }
+       else
+       {
+//         printf("read err %x %d\n", acknowledge, rc);
+           return -2;
+       }
+    }
+#endif  /*USE_LINK_JTAG*/
+#else
+    rc = usb_write((libusb_device_handle *) fd, data, size, timeout);
+#endif  /*USE_USB_VSC*/
+    return rc;
+}
+
+ int USBLinkRead(void* fd, void* data, int size, unsigned int timeout)
+{
+    //printf("%s() fd %p size %d\n", __func__, fd, size);
+    int rc = 0;
+#ifndef USE_USB_VSC
+    int nread =  0;
+#ifdef USE_LINK_JTAG
+    while (nread < size){
+        nread += read(usbFdWrite, &((char*)data)[nread], size - nread);
+        printf("read %d %d\n", nread, size);
+    }
+#else
+    if(usbFdRead < 0)
+    {
+        return -1;
+    }
+
+    while(nread < size)
+    {
+        int toRead = (PACKET_LENGTH && (size - nread > PACKET_LENGTH)) \
+                        ? PACKET_LENGTH : size - nread;
+
+        while(toRead > 0)
+        {
+            rc = read(usbFdRead, &((char*)data)[nread], toRead);
+//          printf("read %x %d\n", *(int*)data, nread);
+            if ( rc < 0)
+            {
+                return -2;
+            }
+            toRead -=rc;
+            nread += rc;
+        }
+        unsigned char acknowledge = 0xEF;
+        int wc = write(usbFdRead, &acknowledge, sizeof(acknowledge));
+        if (wc == sizeof(acknowledge))
+        {
+//          printf("write %x %d\n", acknowledge, wc);
+        }
+        else
+        {
+            return -2;
+        }
+    }
+#endif  /*USE_LINK_JTAG*/
+#else
+    rc = usb_read((libusb_device_handle *) fd, data, size, timeout);
+#endif  /*USE_USB_VSC*/
+    return rc;
+}
+
+int UsbLinkPlatformGetDeviceName(int index, char* name, int nameSize)
+{
+    usbBootError_t rc = usb_find_device(index, name, nameSize, 0, 0, 0);
+    switch(rc) {
+        case USB_BOOT_SUCCESS:
+            return USB_LINK_PLATFORM_SUCCESS;
+        case USB_BOOT_DEVICE_NOT_FOUND:
+            return USB_LINK_PLATFORM_DEVICE_NOT_FOUND;
+        case USB_BOOT_TIMEOUT:
+            return USB_LINK_PLATFORM_TIMEOUT;
+        default:
+            return USB_LINK_PLATFORM_ERROR;
+    }
+}
+//#define XLINK_NO_BOOT
+int UsbLinkPlatformBootRemote(const char* deviceName, const char* binaryPath)
+{
+#ifndef XLINK_NO_BOOT
+
+    unsigned filesize;
+    FILE *fp;
+    char *tx_buf;
+    char subaddr[28+2];
+    int rc;
+
+#ifndef USE_USB_VSC
+    if (usbFdRead != -1){
+        close(usbFdRead);
+        usbFdRead = -1;
+    }
+    if (usbFdWrite != -1){
+        close(usbFdWrite);
+        usbFdWrite = -1;
+    }
+#endif  /*USE_USB_VSC*/
+
+    // Load the executable
+    fp = fopen(binaryPath, "rb");
+    if(fp == NULL)
+    {
+        if(usb_loglevel)
+            perror(binaryPath);
+        return -7;
+    }
+    fseek(fp, 0, SEEK_END);
+    filesize = ftell(fp);
+    rewind(fp);
+    if(!(tx_buf = (char*)malloc(filesize)))
+    {
+        if(usb_loglevel)
+            perror("buffer");
+        fclose(fp);
+        return -3;
+    }
+    if(fread(tx_buf, 1, filesize, fp) != filesize)
+    {
+        if(usb_loglevel)
+            perror(binaryPath);
+        fclose(fp);
+        free(tx_buf);
+        return -7;
+    }
+    fclose(fp);
+
+    // This will be the string to search for in /sys/dev/char links
+    int chars_to_write = snprintf(subaddr, 28, "-%s:", deviceName);
+    if(chars_to_write >= 28) {
+        printf("Path to your boot util is too long for the char array here!\n");
+    }
+    // Boot it
+    rc = usb_boot(deviceName, tx_buf, filesize);
+    free(tx_buf);
+    if(rc)
+    {
+        return rc;
+    }
+    if(usb_loglevel > 1)
+        fprintf(stderr, "Boot successful, device address %s\n", deviceName);
+#endif
+    return 0;
+}
+
+int USBLinkPlatformResetRemote(void* fd)
+{
+#ifndef USE_USB_VSC
+#ifdef USE_LINK_JTAG
+    /*Nothing*/
+#else
+    if (usbFdRead != -1){
+        close(usbFdRead);
+        usbFdRead = -1;
+    }
+    if (usbFdWrite != -1){
+        close(usbFdWrite);
+        usbFdWrite = -1;
+    }
+#endif  /*USE_LINK_JTAG*/
+#else
+    usblink_close((libusb_device_handle *) fd);
+#endif  /*USE_USB_VSC*/
+    return -1;
+}
+int UsbLinkPlatformConnect(const char* devPathRead, const char* devPathWrite, void** fd)
+{
+    #ifndef USE_USB_VSC
+#ifdef USE_LINK_JTAG
+    struct sockaddr_in serv_addr;
+    usbFdWrite = socket(AF_INET, SOCK_STREAM, 0);
+    usbFdRead = socket(AF_INET, SOCK_STREAM, 0);
+    assert(usbFdWrite >=0);
+    assert(usbFdRead >=0);
+    memset(&serv_addr, '0', sizeof(serv_addr));
+
+    serv_addr.sin_family = AF_INET;
+    serv_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
+    serv_addr.sin_port = htons(USB_LINK_SOCKET_PORT);
+
+    if (connect(usbFdWrite, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0)
+    {
+        perror("ERROR connecting");
+        exit(1);
+    }
+    printf("this is working\n");
+    return 0;
+
+#else
+    usbFdRead= open(devPathRead, O_RDWR);
+    if(usbFdRead < 0)
+    {
+        return -1;
+    }
+    // set tty to raw mode
+    struct termios  tty;
+    speed_t     spd;
+    int rc;
+    rc = tcgetattr(usbFdRead, &tty);
+    if (rc < 0) {
+        usbFdRead = -1;
+        return -2;
+    }
+
+    spd = B115200;
+    cfsetospeed(&tty, (speed_t)spd);
+    cfsetispeed(&tty, (speed_t)spd);
+
+    cfmakeraw(&tty);
+
+    rc = tcsetattr(usbFdRead, TCSANOW, &tty);
+    if (rc < 0) {
+        usbFdRead = -1;
+        return -2;
+    }
+
+    usbFdWrite= open(devPathWrite, O_RDWR);
+    if(usbFdWrite < 0)
+    {
+        usbFdWrite = -1;
+        return -2;
+    }
+    // set tty to raw mode
+    rc = tcgetattr(usbFdWrite, &tty);
+    if (rc < 0) {
+        usbFdWrite = -1;
+        return -2;
+    }
+
+    spd = B115200;
+    cfsetospeed(&tty, (speed_t)spd);
+    cfsetispeed(&tty, (speed_t)spd);
+
+    cfmakeraw(&tty);
+
+    rc = tcsetattr(usbFdWrite, TCSANOW, &tty);
+    if (rc < 0) {
+        usbFdWrite = -1;
+        return -2;
+    }
+    return 0;
+#endif  /*USE_LINK_JTAG*/
+#else
+    *fd = usblink_open(devPathWrite);
+    if (*fd == 0)
+    {
+       /* could fail due to port name change */
+       //printf("fail\n");
+       return -1;
+    }
+//    dev = new fastmemDevice("usb");
+//    int usbInit = dev->fastmemInit();
+    if(*fd)
+        return 0;
+    else
+        return -1;
+#endif  /*USE_USB_VSC*/
+}
+int UsbLinkPlatformInit(int loglevel)
+{
+    usb_loglevel = loglevel;
+#if (defined(_WIN32) || defined(_WIN64))
+    initialize_usb_boot();
+#endif
+    return 0;
+}
+
+void deallocateData(void* ptr,uint32_t size, uint32_t alignment)
+{
+    if (!ptr)
+        return;
+#if (defined(_WIN32) || defined(_WIN64) )
+    _aligned_free(ptr);
+#else
+    free(ptr);
+#endif
+}
+
+void* allocateData(uint32_t size, uint32_t alignment)
+{
+    void* ret = NULL;
+#if (defined(_WIN32) || defined(_WIN64) )
+    ret = _aligned_malloc(size, alignment);
+#else
+    posix_memalign(&ret, alignment, size);
+#endif
+    return ret;
+}
+
diff --git a/api/src/common/components/XLink/pc/usb_boot.c b/api/src/common/components/XLink/pc/usb_boot.c
new file mode 100644 (file)
index 0000000..a67ad92
--- /dev/null
@@ -0,0 +1,502 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+// USB utility for use with Myriad2v2 ROM
+// Very heavily modified from Sabre version of usb_boot
+// Author: David Steinberg <david.steinberg@movidius.com>
+// Copyright(C) 2015 Movidius Ltd.
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#if (defined(_WIN32) || defined(_WIN64) )
+#include "usb_winusb.h"
+#include "gettime.h"
+#else
+#include <unistd.h>
+#include <getopt.h>
+#include <libusb.h>
+#endif
+#include "usb_boot.h"
+
+
+
+#define DEFAULT_VID                 0x03E7
+
+#define DEFAULT_WRITE_TIMEOUT       2000
+#define DEFAULT_CONNECT_TIMEOUT     20          // in 100ms units
+#define DEFAULT_CHUNKSZ             1024*1024
+
+#define OPEN_DEV_ERROR_MESSAGE_LENGTH 128
+
+static unsigned int bulk_chunklen = DEFAULT_CHUNKSZ;
+static int write_timeout = DEFAULT_WRITE_TIMEOUT;
+static int connect_timeout = DEFAULT_CONNECT_TIMEOUT;
+static int initialized;
+
+typedef struct {
+    int pid;
+    char name[10];
+} deviceBootInfo_t;
+
+static deviceBootInfo_t supportedDevices[] = {
+    {
+        .pid = 0x2150,
+        .name = "ma2450"
+    },
+    {
+        .pid = 0x2485,
+        .name = "ma2480"
+    },
+    {
+        //To support the case where the port name change, or it's already booted
+        .pid = DEFAULT_OPENPID,
+        .name = ""
+    }
+};
+// for now we'll only use the loglevel for usb boot. can bring it into
+// the rest of usblink later
+// use same levels as mvnc_loglevel for now
+int usb_loglevel;
+#if (defined(_WIN32) || defined(_WIN64) )
+void initialize_usb_boot()
+{
+
+    // We sanitize the situation by trying to reset the devices that have been left open
+    initialized = 1;
+}
+#else
+void __attribute__((constructor)) usb_library_load()
+{
+    initialized = !libusb_init(NULL);
+    //libusb_set_debug(NULL, LIBUSB_LOG_LEVEL_DEBUG);
+}
+
+void __attribute__((destructor)) usb_library_unload()
+{
+    if(initialized)
+        libusb_exit(NULL);
+}
+#endif
+
+typedef struct timespec highres_time_t;
+
+static inline void highres_gettime(highres_time_t *ptr) {
+    clock_gettime(CLOCK_REALTIME, ptr);
+}
+
+static inline double highres_elapsed_ms(highres_time_t *start, highres_time_t *end) {
+    struct timespec temp;
+    if((end->tv_nsec - start->tv_nsec) < 0) {
+        temp.tv_sec = end->tv_sec - start->tv_sec - 1;
+        temp.tv_nsec = 1000000000 + end->tv_nsec-start->tv_nsec;
+    } else {
+        temp.tv_sec = end->tv_sec - start->tv_sec;
+        temp.tv_nsec = end->tv_nsec - start->tv_nsec;
+    }
+    return (double)(temp.tv_sec * 1000) + (((double)temp.tv_nsec) * 0.000001);
+}
+
+static const char *get_pid_name(int pid)
+{
+    int n = sizeof(supportedDevices)/sizeof(supportedDevices[0]);
+    int i;
+
+    for (i = 0; i < n; i++)
+    {
+        if (supportedDevices[i].pid == pid)
+            return supportedDevices[i].name;
+    }
+         if(usb_loglevel)
+                   fprintf(stderr, "%s(): Error pid:=%i not supported\n", __func__, pid);
+    return ""; //shouldn't happen
+}
+
+const char * usb_get_pid_name(int pid)
+{
+    return get_pid_name(pid);
+}
+
+static int get_pid_by_name(const char* name)
+{
+    char* p = strchr(name, '-');
+    if (p == NULL) {
+        fprintf(stderr, "%s(): Error name not supported\n", __func__);
+        return -1;
+    }
+    p++; //advance to point to the name
+    int i;
+    int n = sizeof(supportedDevices)/sizeof(supportedDevices[0]);
+
+    for (i = 0; i < n; i++)
+    {
+        if (strcmp(supportedDevices[i].name, p) == 0)
+            return supportedDevices[i].pid;
+    }
+    return -1;
+}
+
+static int is_pid_supported(int pid)
+{
+    int n = sizeof(supportedDevices)/sizeof(supportedDevices[0]);
+    int i;
+    for (i = 0; i < n; i++) {
+        if (supportedDevices[i].pid == pid)
+            return 1;
+    }
+    return 0;
+}
+
+#if (!defined(_WIN32) && !defined(_WIN64) )
+static const char *gen_addr(libusb_device *dev, int pid)
+{
+    static char buff[4 * 7 + 7];    // '255-' x 7 (also gives us nul-terminator for last entry)
+                                    // 7 => to add "-maXXXX"
+    uint8_t pnums[7];
+    int pnum_cnt, i;
+    char *p;
+
+    pnum_cnt = libusb_get_port_numbers(dev, pnums, 7);
+    if (pnum_cnt == LIBUSB_ERROR_OVERFLOW) {
+        // shouldn't happen!
+        strcpy(buff, "<error>");
+        return buff;
+    }
+    p = buff;
+    for (i = 0; i < pnum_cnt - 1; i++)
+        p += sprintf(p, "%u.", pnums[i]);
+    p += sprintf(p, "%u", pnums[i]);
+
+    sprintf(p, "-%s", get_pid_name(pid));
+    return buff;
+}
+#endif
+// if device is NULL, return device address for device at index idx
+// if device is not NULL, search by name and return device struct
+usbBootError_t usb_find_device(unsigned idx, char *addr, unsigned addrsize, void **device, int vid, int pid)
+{
+    int res;
+#if (defined(_WIN32) || defined(_WIN64) )
+    //static libusb_device **devs;
+    // 2 => vid
+    // 2 => pid
+    // '255-' x 7 (also gives us nul-terminator for last entry)
+    // 7 => to add "-maXXXX"
+    uint8_t devs[15][2 + 2 + 4 * 7 + 7] = { 0 };//to store ven_id,dev_id;
+#else
+    static libusb_device **devs;
+    libusb_device *dev;
+    struct libusb_device_descriptor desc;
+#endif
+    int count = 0;
+    size_t i;
+
+    if(!initialized)
+    {
+        if(usb_loglevel)
+            fprintf(stderr, "Library has not been initialized when loaded\n");
+        return USB_BOOT_ERROR;
+    }
+#if (defined(_WIN32) || defined(_WIN64))
+    if (!devs || idx == 0)
+    {
+        if (((res = usb_list_devices(vid, pid, &devs)) < 0))
+        {
+            if (usb_loglevel)
+                fprintf(stderr, "Unable to get USB device list: %s\n", libusb_strerror(res));
+            return USB_BOOT_ERROR;
+        }
+    }
+#else
+    if(!devs || idx == 0)
+    {
+        if(devs)
+        {
+            libusb_free_device_list(devs, 1);
+            devs = 0;
+        }
+        if((res = libusb_get_device_list(NULL, &devs)) < 0)
+        {
+            if(usb_loglevel)
+                fprintf(stderr, "Unable to get USB device list: %s\n", libusb_strerror(res));
+            return USB_BOOT_ERROR;
+        }
+    }
+#endif
+    i = 0;
+#if (defined(_WIN32) || defined(_WIN64))
+    while (res-- > 0)
+    {
+        if (((int)(devs[res][0] << 8 | devs[res][1]) == vid && (devs[res][2] << 8 | devs[res][3]) == pid) ||
+            (pid == 0 && vid == 0 &&
+            (((int)(devs[res][0] << 8 | devs[res][1]) == DEFAULT_VID && is_pid_supported((int)(devs[res][2] << 8 | devs[res][3])) == 1) ||
+            ((int)(devs[res][0] << 8 | devs[res][1]) == DEFAULT_OPENVID && (int)(devs[res][2] << 8 | devs[res][3]) == DEFAULT_OPENPID))))
+        {
+            if (device)
+            {
+                const char *caddr = &devs[res][4];
+                if (!strcmp(caddr, addr))
+                {
+                    if (usb_loglevel > 1)
+                        fprintf(stderr, "Found Address: %s - VID/PID %04x:%04x\n", addr, (int)(devs[res][0] << 8 | devs[res][1]), (int)(devs[res][2] << 8 | devs[res][3]));
+                    *device = enumerate_usb_device(vid, pid, addr, 0);
+                    return USB_BOOT_SUCCESS;
+                }
+            }
+            else if (idx == count)
+            {
+                const char *caddr = &devs[res][4];
+                if (usb_loglevel > 1)
+                    fprintf(stderr, "Device %d Address: %s - VID/PID %04x:%04x\n", idx, caddr, (int)(devs[res][0] << 8 | devs[res][1]), (int)(devs[res][2] << 8 | devs[res][3]));
+                strncpy(addr, caddr, addrsize);
+                return USB_BOOT_SUCCESS;
+            }
+            count++;
+        }
+    }
+#else
+    while ((dev = devs[i++]) != NULL)
+    {
+        if((res = libusb_get_device_descriptor(dev, &desc)) < 0)
+        {
+            if(usb_loglevel)
+                fprintf(stderr, "Unable to get USB device descriptor: %s\n", libusb_strerror(res));
+            continue;
+        }
+
+        if((desc.idVendor == vid && desc.idProduct == pid) ||
+            (pid == 0 && vid == 0 &&
+                ( (desc.idVendor == DEFAULT_VID && is_pid_supported(desc.idProduct) == 1) ||
+                  (desc.idVendor == DEFAULT_OPENVID && desc.idProduct == DEFAULT_OPENPID)) ))
+        {
+            if(device)
+            {
+                const char *caddr = gen_addr(dev, get_pid_by_name(addr));
+                if(!strcmp(caddr, addr))
+                {
+                    if(usb_loglevel > 1)
+                        fprintf(stderr, "Found Address: %s - VID/PID %04x:%04x\n", addr, desc.idVendor, desc.idProduct);
+                    libusb_ref_device(dev);
+                    libusb_free_device_list(devs, 1);
+                    *device = dev;
+                    devs = 0;
+                    return USB_BOOT_SUCCESS;
+                }
+            } else if(idx == count)
+            {
+                const char *caddr = gen_addr(dev, desc.idProduct);
+                if (usb_loglevel > 1)
+                    fprintf(stderr, "Device %d Address: %s - VID/PID %04x:%04x\n", idx, caddr, desc.idVendor, desc.idProduct);
+                strncpy(addr, caddr, addrsize);
+                return USB_BOOT_SUCCESS;
+            }
+            count++;
+        }
+    }
+    libusb_free_device_list(devs, 1);
+    devs = 0;
+#endif
+    return USB_BOOT_DEVICE_NOT_FOUND;
+}
+#if (!defined(_WIN32) && !defined(_WIN64) )
+static libusb_device_handle *usb_open_device(libusb_device *dev, uint8_t *endpoint, char *err_string_buff, int err_max_len)
+{
+    struct libusb_config_descriptor *cdesc;
+    const struct libusb_interface_descriptor *ifdesc;
+    libusb_device_handle *h = NULL;
+    int res, i;
+
+    if((res = libusb_open(dev, &h)) < 0)
+    {
+        snprintf(err_string_buff, err_max_len, "cannot open device: %s\n", libusb_strerror(res));
+        return 0;
+    }
+    if((res = libusb_set_configuration(h, 1)) < 0)
+    {
+        snprintf(err_string_buff, err_max_len, "setting config 1 failed: %s\n", libusb_strerror(res));
+        libusb_close(h);
+        return 0;
+    }
+    if((res = libusb_claim_interface(h, 0)) < 0)
+    {
+        snprintf(err_string_buff, err_max_len, "claiming interface 0 failed: %s\n", libusb_strerror(res));
+        libusb_close(h);
+        return 0;
+    }
+    if((res = libusb_get_config_descriptor(dev, 0, &cdesc)) < 0)
+    {
+        snprintf(err_string_buff, err_max_len, "Unable to get USB config descriptor: %s\n", libusb_strerror(res));
+        libusb_close(h);
+        return 0;
+    }
+    ifdesc = cdesc->interface->altsetting;
+    for(i=0; i<ifdesc->bNumEndpoints; i++)
+    {
+        if(usb_loglevel > 1)
+            fprintf(stderr, "Found EP 0x%02x : max packet size is %u bytes\n",
+                ifdesc->endpoint[i].bEndpointAddress, ifdesc->endpoint[i].wMaxPacketSize);
+        if((ifdesc->endpoint[i].bmAttributes & LIBUSB_TRANSFER_TYPE_MASK) != LIBUSB_TRANSFER_TYPE_BULK)
+            continue;
+        if( !(ifdesc->endpoint[i].bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) )
+        {
+            *endpoint = ifdesc->endpoint[i].bEndpointAddress;
+            bulk_chunklen = ifdesc->endpoint[i].wMaxPacketSize;
+            libusb_free_config_descriptor(cdesc);
+            return h;
+        }
+    }
+    libusb_free_config_descriptor(cdesc);
+    strcpy(err_string_buff, "Unable to find BULK OUT endpoint\n");
+    libusb_close(h);
+    return 0;
+}
+#endif
+// timeout: -1 = no (infinite) timeout, 0 = must happen immediately
+static int wait_findopen(const char *device_address, int timeout, libusb_device **dev, libusb_device_handle **devh, uint8_t *endpoint)
+{
+    int i, rc;
+    char last_open_dev_err[OPEN_DEV_ERROR_MESSAGE_LENGTH];
+
+    usleep(100000);
+    if(usb_loglevel > 1)
+    {
+        // I know about switch(), but for some reason -1 is picked up correctly
+        if(timeout == -1)
+            fprintf(stderr, "Starting wait for connect, no timeout\n");
+        else if(timeout == 0)
+            fprintf(stderr, "Trying to connect\n");
+        else fprintf(stderr, "Starting wait for connect with %ums timeout\n", timeout * 100);
+    }
+    last_open_dev_err[0] = 0;
+    i = 0;
+    for(;;)
+    {
+        int addr_size = device_address != NULL ? strlen(device_address) : 0;
+        rc = usb_find_device(0, (char *)device_address, addr_size, (void **)dev,
+                                DEFAULT_VID, get_pid_by_name(device_address));
+        if(rc < 0)
+            return USB_BOOT_ERROR;
+        if(!rc)
+        {
+            if( (*devh = usb_open_device(*dev, endpoint, last_open_dev_err, OPEN_DEV_ERROR_MESSAGE_LENGTH)) )
+            {
+                if(usb_loglevel > 1)
+                    fprintf(stderr, "Found and opened device\n");
+                return 0;
+            }
+#if (!defined(_WIN32) && !defined(_WIN64) )
+            libusb_unref_device(*dev);
+#endif
+        }
+        if(timeout != -1 && i == timeout)
+        {
+            if(usb_loglevel)
+            {
+                if(last_open_dev_err[0])
+                    fprintf(stderr, "%s", last_open_dev_err);
+                fprintf(stderr, "error: device not found!\n");
+            }
+            return rc ? USB_BOOT_DEVICE_NOT_FOUND : USB_BOOT_TIMEOUT;
+        }
+        i++;
+        usleep(100000);
+    }
+    return 0;
+}
+
+static int send_file(libusb_device_handle *h, uint8_t endpoint, const uint8_t *tx_buf, unsigned filesize)
+{
+    int rc;
+    int twb, wbr, wb;
+    const uint8_t *p;
+    double elapsedTime;
+    highres_time_t t1, t2;
+
+    elapsedTime = 0;
+    twb = 0;
+    p = tx_buf;
+    if(usb_loglevel > 1)
+        fprintf(stderr, "Performing bulk write of %u bytes...\n", filesize);
+    while(twb < filesize)
+    {
+        highres_gettime(&t1);
+        wb = filesize - twb;
+        if(wb > bulk_chunklen)
+            wb = bulk_chunklen;
+        wbr = 0;
+#if (defined(_WIN32) || defined(_WIN64) )
+        rc = usb_bulk_write(h, endpoint, (void *)p, wb, &wbr, write_timeout);
+#else
+        rc = libusb_bulk_transfer(h, endpoint, (void *)p, wb, &wbr, write_timeout);
+#endif
+        if(rc || (wb != wbr))
+        {
+            if(rc == LIBUSB_ERROR_NO_DEVICE)
+                break;
+            if(usb_loglevel)
+                fprintf(stderr, "bulk write: %s (%d bytes written, %d bytes to write)\n", libusb_strerror(rc), wbr, wb);
+            if(rc == LIBUSB_ERROR_TIMEOUT)
+                return USB_BOOT_TIMEOUT;
+            else return USB_BOOT_ERROR;
+        }
+        highres_gettime(&t2);
+        elapsedTime += highres_elapsed_ms(&t1, &t2);
+        twb += wbr;
+        p += wbr;
+    }
+    if(usb_loglevel > 1)
+    {
+        double MBpS = ((double)filesize / 1048576.) / (elapsedTime * 0.001);
+        fprintf(stderr, "Successfully sent %u bytes of data in %lf ms (%lf MB/s)\n", filesize, elapsedTime, MBpS);
+    }
+    return 0;
+}
+
+int usb_boot(const char *addr, const void *mvcmd, unsigned size)
+{
+    int rc = 0;
+#if (defined(_WIN32) || defined(_WIN64) )
+    void *dev = NULL;
+    struct _usb_han *h;
+#else
+    libusb_device *dev;
+    libusb_device_handle *h;
+#endif
+    uint8_t endpoint;
+
+    rc = wait_findopen(addr, connect_timeout, &dev, &h, &endpoint);
+    if(rc)
+        return rc;
+    rc = send_file(h, endpoint, mvcmd, size);
+#if (defined(_WIN32) || defined(_WIN64) )
+    usb_close_device(h);
+    usb_free_device(dev);
+    //usb_shutdown();
+#else
+    libusb_release_interface(h, 0);
+    libusb_close(h);
+    libusb_unref_device(dev);
+#endif
+    return rc;
+}
diff --git a/api/src/common/components/XLink/pc/usb_boot.h b/api/src/common/components/XLink/pc/usb_boot.h
new file mode 100644 (file)
index 0000000..cdcabb1
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int usb_loglevel;
+
+#define DEFAULT_OPENVID             0x03E7
+#define DEFAULT_OPENPID             0xf63b      // Once opened in VSC mode, VID/PID change
+
+typedef enum usbBootError {
+    USB_BOOT_SUCCESS = 0,
+    USB_BOOT_ERROR,
+    USB_BOOT_DEVICE_NOT_FOUND,
+    USB_BOOT_TIMEOUT
+} usbBootError_t;
+
+usbBootError_t usb_find_device(unsigned idx, char *addr, unsigned addrsize, void **device, int vid, int pid);
+int usb_boot(const char *addr, const void *mvcmd, unsigned size);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/api/src/common/components/XLink/shared/UsbLinkPlatform.h b/api/src/common/components/XLink/shared/UsbLinkPlatform.h
new file mode 100644 (file)
index 0000000..c59445f
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @brief     Application configuration Leon header
+///
+#ifndef _XLINK_USBLINKPLATFORM_H
+#define _XLINK_USBLINKPLATFORM_H
+#include <stdint.h>
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define MAX_POOLS_ALLOC 32
+#define PACKET_LENGTH (64*1024)
+
+#ifdef __PC__
+#define MAX_LINKS 16
+#else
+#define MAX_LINKS 1
+#endif
+/*
+The USB specific implementation is contained in the file called UsbLinkPlatform.c/cpp.
+It implements the following functions:
+*/
+int USBLinkWrite(void* fd, void* data, int size, unsigned int timeout);
+int USBLinkRead(void* fd, void* data, int size, unsigned int timeout);
+int UsbLinkPlatformConnect(const char* devPathRead,
+                           const char* devPathWrite, void** fd);
+int UsbLinkPlatformInit(int loglevel);
+
+int UsbLinkPlatformGetDeviceName(int index,
+                                 char* name,
+                                 int nameSize);
+
+int UsbLinkPlatformBootRemote(const char* deviceName,
+                                const char* binaryPath);
+int USBLinkPlatformResetRemote(void* fd);
+
+void* allocateData(uint32_t size, uint32_t alignment);
+void deallocateData(void* ptr,uint32_t size, uint32_t alignment);
+
+typedef enum usbLinkPlatformErrorCode {
+    USB_LINK_PLATFORM_SUCCESS = 0,
+    USB_LINK_PLATFORM_ERROR,
+    USB_LINK_PLATFORM_DEVICE_NOT_FOUND,
+    USB_LINK_PLATFORM_TIMEOUT
+} usbLinkPlatformErrorCode_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* end of include file */
diff --git a/api/src/common/components/XLink/shared/XLink.c b/api/src/common/components/XLink/shared/XLink.c
new file mode 100644 (file)
index 0000000..38a2edb
--- /dev/null
@@ -0,0 +1,1179 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @file
+///
+/// @brief     Application configuration Leon header
+///
+
+#include "XLink.h"
+
+#include "stdio.h"
+#include "stdint.h"
+#include "string.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include <pthread.h>
+#include <semaphore.h>
+#if (defined(_WIN32) || defined(_WIN64))
+#include "gettime.h"
+#endif
+#include "mvMacros.h"
+#include "UsbLinkPlatform.h"
+#include "XLinkDispatcher.h"
+#define _USBLINK_ENABLE_PRIVATE_INCLUDE_
+#include "XLinkPrivateDefines.h"
+
+#ifdef MVLOG_UNIT_NAME
+#undef MVLOG_UNIT_NAME
+#define MVLOG_UNIT_NAME xLink
+#endif
+#include "mvLog.h"
+
+#define USB_DATA_TIMEOUT 2000
+#define CIRCULAR_INCREMENT(x,maxVal) \
+    { \
+         x++; \
+         if (x == maxVal) \
+             x = 0; \
+    }
+//avoid problems with unsigned. first compare and then give the nuw value
+#define CIRCULAR_DECREMENT(x,maxVal) \
+{ \
+    if (x == 0) \
+        x = maxVal; \
+    else \
+        x--; \
+}
+#define EXTRACT_IDS(streamId, linkId) \
+{ \
+    linkId = (streamId >> 24) & 0XFF; \
+    streamId = streamId & 0xFFFFFF; \
+}
+
+#define COMBIN_IDS(streamId, linkid) \
+     streamId = streamId | ((linkid & 0xFF) << 24);
+
+
+int dispatcherLocalEventGetResponse(xLinkEvent_t* event, xLinkEvent_t* response);
+int dispatcherRemoteEventGetResponse(xLinkEvent_t* event, xLinkEvent_t* response);
+//adds a new event with parameters and returns event id
+int dispatcherEventSend(xLinkEvent_t* event);
+streamDesc_t* getStreamById(void* fd, streamId_t id);
+void releaseStream(streamDesc_t*);
+int addNewPacketToStream(streamDesc_t* stream, void* buffer, uint32_t size);
+
+struct dispatcherControlFunctions controlFunctionTbl;
+XLinkGlobalHandler_t* glHandler; //TODO need to either protect this with semaphor
+                                 //or make profiling data per device
+linkId_t nextUniqueLinkId = 0; //incremental number, doesn't get decremented.
+//streams
+typedef struct xLinkDesc_t {
+    int nextUniqueStreamId; //incremental number, doesn't get decremented.
+                                //Needs to be per link to match remote
+    streamDesc_t availableStreams[USB_LINK_MAX_STREAMS];
+    xLinkState_t peerState;
+    void* fd;
+    linkId_t id;
+} xLinkDesc_t;
+
+xLinkDesc_t availableXLinks[MAX_LINKS];
+
+sem_t  pingSem; //to b used by myriad
+
+
+/*#################################################################################
+###################################### INTERNAL ###################################
+##################################################################################*/
+
+static float timespec_diff(struct timespec *start, struct timespec *stop)
+{
+    if ((stop->tv_nsec - start->tv_nsec) < 0) {
+        start->tv_sec = stop->tv_sec - start->tv_sec - 1;
+        start->tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000;
+    } else {
+        start->tv_sec = stop->tv_sec - start->tv_sec;
+        start->tv_nsec = stop->tv_nsec - start->tv_nsec;
+    }
+
+    return start->tv_nsec/ 1000000000.0 + start->tv_sec;
+}
+
+int handleIncomingEvent(xLinkEvent_t* event){
+    //this function will be dependent whether this is a client or a Remote
+    //specific actions to this peer
+    void* buffer ;
+    streamDesc_t* stream ;
+    switch (event->header.type){
+    case USB_WRITE_REQ:
+        /*If we got here, we will read the data no matter what happens.
+          If we encounter any problems we will still read the data to keep
+          the communication working but send a NACK.*/
+        stream = getStreamById(event->xLinkFD, event->header.streamId);
+        ASSERT_X_LINK(stream);
+
+        stream->localFillLevel += event->header.size;
+        mvLog(MVLOG_DEBUG,"Got write of %ld, current local fill level is %ld out of %ld %ld\n",
+            event->header.size, stream->localFillLevel, stream->readSize, stream->writeSize);
+
+        buffer = allocateData(ALIGN_UP(event->header.size, __CACHE_LINE_SIZE), __CACHE_LINE_SIZE);
+        if (buffer == NULL){
+            mvLog(MVLOG_FATAL,"out of memory\n");
+            ASSERT_X_LINK(0);
+        }
+        int sc = USBLinkRead(event->xLinkFD, buffer, event->header.size, USB_DATA_TIMEOUT);
+        if(sc < 0){
+            mvLog(MVLOG_ERROR,"%s() Read failed %d\n", __func__, (int)sc);
+        }
+
+        event->data = buffer;
+        if (addNewPacketToStream(stream, buffer, event->header.size)){
+            mvLog(MVLOG_WARN,"No more place in stream. release packet\n");
+            deallocateData(buffer, ALIGN_UP(event->header.size, __CACHE_LINE_SIZE), __CACHE_LINE_SIZE);
+            event->header.flags.bitField.ack = 0;
+            event->header.flags.bitField.nack = 1;
+            assert(0);
+        }
+        releaseStream(stream);
+        break;
+    case USB_READ_REQ:
+        break;
+    case USB_READ_REL_REQ:
+        break;
+    case USB_CREATE_STREAM_REQ:
+        break;
+    case USB_CLOSE_STREAM_REQ:
+        break;
+    case USB_PING_REQ:
+        break;
+    case USB_RESET_REQ:
+        break;
+    case USB_WRITE_RESP:
+        break;
+    case USB_READ_RESP:
+        break;
+    case USB_READ_REL_RESP:
+        break;
+    case USB_CREATE_STREAM_RESP:
+        break;
+    case USB_CLOSE_STREAM_RESP:
+        break;
+    case USB_PING_RESP:
+        break;
+    case USB_RESET_RESP:
+        break;
+    default:
+        ASSERT_X_LINK(0);
+    }
+    //adding event for the scheduler. We let it know that this is a remote event
+    dispatcherAddEvent(EVENT_REMOTE, event);
+    return 0;
+}
+ int dispatcherEventReceive(xLinkEvent_t* event){
+    static xLinkEvent_t prevEvent;
+    int sc = USBLinkRead(event->xLinkFD, &event->header, sizeof(event->header), 0);
+
+    if(sc < 0 && event->header.type == USB_RESET_RESP) {
+               return sc;
+    }
+    if(sc < 0){
+        mvLog(MVLOG_ERROR,"%s() Read failed %d\n", __func__, (int)sc);
+        return sc;
+    }
+
+    mvLog(MVLOG_DEBUG,"Incoming event %d %d %d %d\n",
+                                (int)event->header.type,
+                                (int)event->header.id,
+                                (int)prevEvent.header.id,
+                                (int)prevEvent.header.type);
+
+    if (prevEvent.header.id == event->header.id &&
+            prevEvent.header.type == event->header.type &&
+            prevEvent.xLinkFD == event->xLinkFD)
+    {
+        //TODO: Historically this check comes from a bug in the myriad USB stack.
+        //Shouldn't be the case anymore
+        mvLog(MVLOG_FATAL,"Duplicate id detected. \n");
+        ASSERT_X_LINK(0);
+    }
+    prevEvent = *event;
+    handleIncomingEvent(event);
+
+    if(event->header.type == USB_RESET_REQ)
+    {
+        return -1;
+    }
+
+    return 0;
+}
+
+int getLinkIndex(void* fd)
+{
+    int i;
+    for (i = 0; i < MAX_LINKS; i++)
+        if (availableXLinks[i].fd == fd)
+            return i;
+    return -1;
+}
+
+xLinkDesc_t* getLinkById(linkId_t id)
+{
+    int i;
+    for (i = 0; i < MAX_LINKS; i++)
+        if (availableXLinks[i].id == id)
+            return &availableXLinks[i];
+    return NULL;
+}
+xLinkDesc_t* getLink(void* fd)
+{
+    int i;
+    for (i = 0; i < MAX_LINKS; i++)
+        if (availableXLinks[i].fd == fd)
+            return &availableXLinks[i];
+    return NULL;
+}
+int getNextAvailableLinkIndex()
+{
+    int i;
+    for (i = 0; i < MAX_LINKS; i++)
+        if (availableXLinks[i].id == INVALID_LINK_ID)
+            return i;
+
+    mvLog(MVLOG_ERROR,"%s():- no next available link!\n", __func__);
+    return -1;
+}
+int getNextAvailableStreamIndex(xLinkDesc_t* link)
+{
+    if (link == NULL)
+        return -1;
+
+    int idx;
+    for (idx = 0; idx < USB_LINK_MAX_STREAMS; idx++) {
+        if (link->availableStreams[idx].id == INVALID_STREAM_ID)
+            return idx;
+    }
+
+    mvLog(MVLOG_DEBUG,"%s(): - no next available stream!\n", __func__);
+    return -1;
+}
+
+streamDesc_t* getStreamById(void* fd, streamId_t id)
+{
+    xLinkDesc_t* link = getLink(fd);
+    ASSERT_X_LINK(link != NULL);
+    int stream;
+    for (stream = 0; stream < USB_LINK_MAX_STREAMS; stream++) {
+        if (link->availableStreams[stream].id == id) {
+            sem_wait(&link->availableStreams[stream].sem);
+            return &link->availableStreams[stream];
+        }
+    }
+    return NULL;
+}
+
+streamDesc_t* getStreamByName(xLinkDesc_t* link, const char* name)
+{
+    ASSERT_X_LINK(link != NULL);
+    int stream;
+    for (stream = 0; stream < USB_LINK_MAX_STREAMS; stream++) {
+        if (link->availableStreams[stream].id != INVALID_STREAM_ID &&
+            strcmp(link->availableStreams[stream].name, name) == 0) {
+                sem_wait(&link->availableStreams[stream].sem);
+                    return &link->availableStreams[stream];
+        }
+    }
+    return NULL;
+}
+
+void releaseStream(streamDesc_t* stream)
+{
+    if (stream && stream->id != INVALID_STREAM_ID) {
+        sem_post(&stream->sem);
+    }
+    else {
+        mvLog(MVLOG_DEBUG,"trying to release a semaphore for a released stream\n");
+    }
+}
+
+streamId_t getStreamIdByName(xLinkDesc_t* link, const char* name)
+{
+    streamDesc_t* stream = getStreamByName(link, name);
+    streamId_t id;
+    if (stream) {
+        id = stream->id;
+        releaseStream(stream);
+        return id;
+    }
+    else
+        return INVALID_STREAM_ID;
+}
+
+streamPacketDesc_t* getPacketFromStream(streamDesc_t* stream)
+{
+    streamPacketDesc_t* ret = NULL;
+    if (stream->availablePackets)
+    {
+        ret = &stream->packets[stream->firstPacketUnused];
+        stream->availablePackets--;
+        CIRCULAR_INCREMENT(stream->firstPacketUnused,
+                            USB_LINK_MAX_PACKETS_PER_STREAM);
+        stream->blockedPackets++;
+    }
+    return ret;
+}
+
+void deallocateStream(streamDesc_t* stream)
+{
+    if (stream && stream->id != INVALID_STREAM_ID)
+    {
+        if (stream->readSize)
+        {
+            stream->readSize = 0;
+            stream->closeStreamInitiated = 0;
+        }
+    }
+}
+
+
+int releasePacketFromStream(streamDesc_t* stream, uint32_t* releasedSize)
+{
+    streamPacketDesc_t* currPack = &stream->packets[stream->firstPacket];
+    if(stream->blockedPackets == 0){
+        mvLog(MVLOG_ERROR,"There is no packet to release\n");
+        return 0; // ignore this, although this is a big problem on application side
+    }
+    stream->localFillLevel -= currPack->length;
+    mvLog(MVLOG_DEBUG,"Got release of %ld , current local fill level is %ld out of %ld %ld\n",
+        currPack->length, stream->localFillLevel, stream->readSize, stream->writeSize);
+
+    deallocateData(currPack->data, ALIGN_UP_INT32((int32_t)currPack->length, __CACHE_LINE_SIZE), __CACHE_LINE_SIZE);
+    CIRCULAR_INCREMENT(stream->firstPacket, USB_LINK_MAX_PACKETS_PER_STREAM);
+    stream->blockedPackets--;
+    *releasedSize = currPack->length;
+    return 0;
+}
+
+int isStreamSpaceEnoughFor(streamDesc_t* stream, uint32_t size)
+{
+    if(stream->remoteFillPacketLevel >= USB_LINK_MAX_PACKETS_PER_STREAM ||
+        stream->remoteFillLevel + size > stream->writeSize){
+        return 0;
+    }
+    else
+        return 1;
+}
+
+int addNewPacketToStream(streamDesc_t* stream, void* buffer, uint32_t size){
+    if (stream->availablePackets + stream->blockedPackets < USB_LINK_MAX_PACKETS_PER_STREAM)
+    {
+        stream->packets[stream->firstPacketFree].data = buffer;
+        stream->packets[stream->firstPacketFree].length = size;
+        CIRCULAR_INCREMENT(stream->firstPacketFree, USB_LINK_MAX_PACKETS_PER_STREAM);
+        stream->availablePackets++;
+        return 0;
+    }
+    return -1;
+}
+
+streamId_t allocateNewStream(void* fd,
+                             const char* name,
+                             uint32_t writeSize,
+                             uint32_t readSize,
+                             streamId_t forcedId)
+{
+    streamId_t streamId;
+    streamDesc_t* stream;
+    xLinkDesc_t* link = getLink(fd);
+    ASSERT_X_LINK(link != NULL);
+
+    stream = getStreamByName(link, name);
+
+    if (stream != NULL)
+    {
+        /*the stream already exists*/
+        if ((writeSize > stream->writeSize && stream->writeSize != 0) ||
+            (readSize > stream->readSize && stream->readSize != 0))
+        {
+            return INVALID_STREAM_ID;
+        }
+        mvLog(MVLOG_DEBUG,"%s(): streamName Exists %d\n", __func__, (int)stream->id);
+    }
+    else
+    {
+        int idx = getNextAvailableStreamIndex(link);
+
+        if (idx == -1)
+        {
+            return INVALID_STREAM_ID;
+        }
+        stream = &link->availableStreams[idx];
+        if (forcedId == INVALID_STREAM_ID)
+            stream->id = link->nextUniqueStreamId;
+        else
+            stream->id = forcedId;
+        link->nextUniqueStreamId++; //even if we didnt use a new one, we need to align with total number of  unique streams
+        int sem_initiated = strlen(stream->name) != 0;
+        strncpy(stream->name, name, MAX_NAME_LENGTH);
+        stream->readSize = 0;
+        stream->writeSize = 0;
+        stream->remoteFillLevel = 0;
+        stream->remoteFillPacketLevel = 0;
+
+        stream->localFillLevel = 0;
+        stream->closeStreamInitiated = 0;
+        if (!sem_initiated) //if sem_init is called for already initiated sem, behavior is undefined
+            sem_init(&stream->sem, 0, 0);
+    }
+    if (readSize && !stream->readSize)
+    {
+        stream->readSize = readSize;
+    }
+    if (writeSize && !stream->writeSize)
+    {
+        stream->writeSize = writeSize;
+    }
+    streamId = stream->id;
+    releaseStream(stream);
+    return streamId;
+}
+//this function should be called only for remote requests
+int dispatcherLocalEventGetResponse(xLinkEvent_t* event, xLinkEvent_t* response)
+{
+    streamDesc_t* stream;
+    response->header.id = event->header.id;
+    switch (event->header.type){
+    case USB_WRITE_REQ:
+        //in case local tries to write after it issues close (writeSize is zero)
+        stream = getStreamById(event->xLinkFD, event->header.streamId);
+        ASSERT_X_LINK(stream);
+        if (stream->writeSize == 0)
+        {
+            event->header.flags.bitField.nack = 1;
+            event->header.flags.bitField.ack = 0;
+            // return -1 to don't even send it to the remote
+            releaseStream(stream);
+            return -1;
+        }
+        event->header.flags.bitField.ack = 1;
+        event->header.flags.bitField.nack = 0;
+        event->header.flags.bitField.localServe = 0;
+
+        if(!isStreamSpaceEnoughFor(stream, ALIGN_UP(event->header.size, __CACHE_LINE_SIZE))){
+            mvLog(MVLOG_DEBUG,"local NACK RTS. stream is full\n");
+            event->header.flags.bitField.block = 1;
+            event->header.flags.bitField.localServe = 1;
+            // TODO: easy to implement non-blocking read here, just return nack
+        }else{
+            event->header.flags.bitField.block = 0;
+            stream->remoteFillLevel += event->header.size;
+            stream->remoteFillPacketLevel++;
+
+            mvLog(MVLOG_DEBUG,"Got local write of %ld , remote fill level %ld out of %ld %ld\n",
+                event->header.size, stream->remoteFillLevel, stream->writeSize, stream->readSize);
+        }
+        releaseStream(stream);
+        break;
+    case USB_READ_REQ:
+        stream = getStreamById(event->xLinkFD, event->header.streamId);
+        ASSERT_X_LINK(stream);
+        streamPacketDesc_t* packet = getPacketFromStream(stream);
+        if (packet){
+            //the read can be served with this packet
+            streamPacketDesc_t** pack = (streamPacketDesc_t**)event->data;
+            *pack = packet;
+            event->header.flags.bitField.ack = 1;
+            event->header.flags.bitField.nack = 0;
+            event->header.flags.bitField.block = 0;
+        }
+        else{
+            event->header.flags.bitField.block = 1;
+            // TODO: easy to implement non-blocking read here, just return nack
+        }
+        releaseStream(stream);
+        event->header.flags.bitField.localServe = 1;
+        break;
+    case USB_READ_REL_REQ:
+        stream = getStreamById(event->xLinkFD, event->header.streamId);
+        ASSERT_X_LINK(stream);
+        uint32_t releasedSize;
+        releasePacketFromStream(stream, &releasedSize);
+        event->header.size = releasedSize;
+        releaseStream(stream);
+        break;
+    case USB_CREATE_STREAM_REQ:
+        break;
+    case USB_CLOSE_STREAM_REQ:
+        stream = getStreamById(event->xLinkFD, event->header.streamId);
+
+        ASSERT_X_LINK(stream);
+        if (stream->remoteFillLevel != 0){
+            stream->closeStreamInitiated = 1;
+            event->header.flags.bitField.block = 1;
+            event->header.flags.bitField.localServe = 1;
+        }else{
+            event->header.flags.bitField.block = 0;
+            event->header.flags.bitField.localServe = 0;
+        }
+        releaseStream(stream);
+        break;
+    case USB_PING_REQ:
+    case USB_RESET_REQ:
+    case USB_WRITE_RESP:
+    case USB_READ_RESP:
+    case USB_READ_REL_RESP:
+    case USB_CREATE_STREAM_RESP:
+    case USB_CLOSE_STREAM_RESP:
+    case USB_PING_RESP:
+        break;
+    case USB_RESET_RESP:
+        //should not happen
+        event->header.flags.bitField.localServe = 1;
+        break;
+    default:
+        ASSERT_X_LINK(0);
+    }
+    return 0;
+}
+
+//this function should be called only for remote requests
+int dispatcherRemoteEventGetResponse(xLinkEvent_t* event, xLinkEvent_t* response)
+{
+    streamDesc_t* stream;
+    response->header.id = event->header.id;
+    response->header.flags.raw = 0;
+    switch (event->header.type)
+    {
+        case USB_WRITE_REQ:
+            //let remote write immediately as we have a local buffer for the data
+            response->header.type = USB_WRITE_RESP;
+            response->header.size = event->header.size;
+            response->header.streamId = event->header.streamId;
+            response->header.flags.bitField.ack = 1;
+            response->xLinkFD = event->xLinkFD;
+
+            // we got some data. We should unblock a blocked read
+            int xxx = dispatcherUnblockEvent(-1,
+                                             USB_READ_REQ,
+                                             response->header.streamId,
+                                             event->xLinkFD);
+            (void) xxx;
+            mvLog(MVLOG_DEBUG,"unblocked from stream %d %d\n",
+                  (int)response->header.streamId, (int)xxx);
+            break;
+        case USB_READ_REQ:
+            break;
+        case USB_READ_REL_REQ:
+            response->header.flags.bitField.ack = 1;
+            response->header.flags.bitField.nack = 0;
+            response->header.type = USB_READ_REL_RESP;
+            response->xLinkFD = event->xLinkFD;
+            stream = getStreamById(event->xLinkFD,
+                                   event->header.streamId);
+            ASSERT_X_LINK(stream);
+            stream->remoteFillLevel -= event->header.size;
+            stream->remoteFillPacketLevel--;
+
+            mvLog(MVLOG_DEBUG,"Got remote release of %ld, remote fill level %ld out of %ld %ld\n",
+                event->header.size, stream->remoteFillLevel, stream->writeSize, stream->readSize);
+            releaseStream(stream);
+
+            dispatcherUnblockEvent(-1, USB_WRITE_REQ, event->header.streamId,
+                                    event->xLinkFD);
+            //with every released packet check if the stream is already marked for close
+            if (stream->closeStreamInitiated && stream->localFillLevel == 0)
+            {
+                mvLog(MVLOG_DEBUG,"%s() Unblock close STREAM\n", __func__);
+                int xxx = dispatcherUnblockEvent(-1,
+                                                 USB_CLOSE_STREAM_REQ,
+                                                 event->header.streamId,
+                                                 event->xLinkFD);
+                (void) xxx;
+            }
+            break;
+        case USB_CREATE_STREAM_REQ:
+            response->header.flags.bitField.ack = 1;
+            response->header.type = USB_CREATE_STREAM_RESP;
+            //write size from remote means read size for this peer
+            response->header.streamId = allocateNewStream(event->xLinkFD,
+                                                          event->header.streamName,
+                                                          0, event->header.size,
+                                                          INVALID_STREAM_ID);
+            response->xLinkFD = event->xLinkFD;
+            strncpy(response->header.streamName, event->header.streamName, MAX_NAME_LENGTH);
+            response->header.size = event->header.size;
+            //TODO check streamid is valid
+            mvLog(MVLOG_DEBUG,"creating stream %x\n", (int)response->header.streamId);
+            break;
+        case USB_CLOSE_STREAM_REQ:
+            {
+                response->header.type = USB_CLOSE_STREAM_RESP;
+                response->header.streamId = event->header.streamId;
+                response->xLinkFD = event->xLinkFD;
+
+                streamDesc_t* stream = getStreamById(event->xLinkFD,
+                                                     event->header.streamId);
+                if (!stream) {
+                    //if we have sent a NACK before, when the event gets unblocked
+                    //the stream might already be unavailable
+                    response->header.flags.bitField.ack = 1; //All is good, we are done
+                    response->header.flags.bitField.nack = 0;
+                    mvLog(MVLOG_DEBUG,"%s() got a close stream on aready closed stream\n", __func__);
+                } else {
+                    if (stream->localFillLevel == 0)
+                    {
+                        response->header.flags.bitField.ack = 1;
+                        response->header.flags.bitField.nack = 0;
+
+                        deallocateStream(stream);
+                        if (!stream->writeSize) {
+                            stream->id = INVALID_STREAM_ID;
+                        }
+                    }
+                    else
+                    {
+                        mvLog(MVLOG_DEBUG,"%s():fifo is NOT empty returning NACK \n", __func__);
+                        response->header.flags.bitField.nack = 1;
+                        stream->closeStreamInitiated = 1;
+                    }
+
+                    releaseStream(stream);
+                }
+                break;
+            }
+        case USB_PING_REQ:
+            response->header.type = USB_PING_RESP;
+            response->header.flags.bitField.ack = 1;
+            response->xLinkFD = event->xLinkFD;
+            sem_post(&pingSem);
+            break;
+        case USB_RESET_REQ:
+            mvLog(MVLOG_DEBUG,"reset request\n");
+            response->header.flags.bitField.ack = 1;
+            response->header.flags.bitField.nack = 0;
+            response->header.type = USB_RESET_RESP;
+            response->xLinkFD = event->xLinkFD;
+            // need to send the response, serve the event and then reset
+            break;
+        case USB_WRITE_RESP:
+            break;
+        case USB_READ_RESP:
+            break;
+        case USB_READ_REL_RESP:
+            break;
+        case USB_CREATE_STREAM_RESP:
+        {
+            // write_size from the response the size of the buffer from the remote
+            response->header.streamId = allocateNewStream(event->xLinkFD,
+                                                          event->header.streamName,
+                                                          event->header.size,0,
+                                                          event->header.streamId);
+            response->xLinkFD = event->xLinkFD;
+            break;
+        }
+        case USB_CLOSE_STREAM_RESP:
+        {
+            streamDesc_t* stream = getStreamById(event->xLinkFD,
+                                                 event->header.streamId);
+
+            if (!stream){
+                response->header.flags.bitField.nack = 1;
+                response->header.flags.bitField.ack = 0;
+                break;
+            }
+            stream->writeSize = 0;
+            if (!stream->readSize) {
+                response->header.flags.bitField.nack = 1;
+                response->header.flags.bitField.ack = 0;
+                stream->id = INVALID_STREAM_ID;
+                break;
+            }
+            releaseStream(stream);
+            break;
+        }
+
+        case USB_PING_RESP:
+            break;
+        case USB_RESET_RESP:
+            break;
+        default:
+            ASSERT_X_LINK(0);
+    }
+    return 0;
+}
+//adds a new event with parameters and returns event id
+int dispatcherEventSend(xLinkEvent_t *event)
+{
+    mvLog(MVLOG_DEBUG,"sending %d %d\n", (int)event->header.type,  (int)event->header.id);
+    int rc = USBLinkWrite(event->xLinkFD, &event->header, sizeof(event->header), 0);
+    if(rc < 0)
+    {
+        mvLog(MVLOG_ERROR,"Write failed %d\n", rc);
+    }
+    if (event->header.type == USB_WRITE_REQ)
+    {
+        //write requested data
+        rc = USBLinkWrite(event->xLinkFD, event->data,
+                          event->header.size, USB_DATA_TIMEOUT);
+        if(rc < 0) {
+            mvLog(MVLOG_ERROR,"Write failed %d\n", rc);
+        }
+    }
+    // this function will send events to the remote node
+    return 0;
+}
+
+static xLinkState_t getXLinkState(xLinkDesc_t* link)
+{
+    ASSERT_X_LINK(link != NULL);
+    mvLog(MVLOG_DEBUG,"%s() link %p link->peerState %d\n", __func__,link, link->peerState);
+    return link->peerState;
+}
+
+void dispatcherCloseUsbLink(void*fd)
+{
+    xLinkDesc_t* link = getLink(fd);
+    ASSERT_X_LINK(link != NULL);
+    link->peerState = X_LINK_COMMUNICATION_NOT_OPEN;
+    link->id = INVALID_LINK_ID;
+    link->fd = NULL;
+    link->nextUniqueStreamId = 0;
+
+    int stream;
+    for (stream = 0; stream < USB_LINK_MAX_STREAMS; stream++)
+        link->availableStreams[stream].id = INVALID_STREAM_ID;
+}
+
+void dispatcherResetDevice(void* fd)
+{
+    USBLinkPlatformResetRemote(fd);
+}
+
+
+/*#################################################################################
+###################################### EXTERNAL ###################################
+##################################################################################*/
+//Called only from app - per device
+XLinkError_t XLinkConnect(XLinkHandler_t* handler)
+{
+    int index = getNextAvailableLinkIndex();
+    ASSERT_X_LINK(index != -1);
+
+    xLinkDesc_t* link = &availableXLinks[index];
+    mvLog(MVLOG_DEBUG,"%s() device name %s \n", __func__, handler->devicePath);
+
+    if (UsbLinkPlatformConnect(handler->devicePath2, handler->devicePath, &link->fd) == -1)
+    {
+        return X_LINK_ERROR;
+    }
+
+    dispatcherStart(link->fd);
+
+    xLinkEvent_t event = {0};
+    event.header.type = USB_PING_REQ;
+    event.xLinkFD = link->fd;
+    dispatcherAddEvent(EVENT_LOCAL, &event);
+    dispatcherWaitEventComplete(link->fd);
+
+    link->id = nextUniqueLinkId++;
+    link->peerState = USB_LINK_UP;
+    handler->linkId = link->id;
+
+    return 0;
+}
+
+XLinkError_t XLinkInitialize(XLinkGlobalHandler_t* handler)
+{
+    ASSERT_X_LINK(USB_LINK_MAX_STREAMS <= MAX_POOLS_ALLOC);
+    glHandler = handler;
+    sem_init(&pingSem,0,0);
+    int i;
+    int sc = UsbLinkPlatformInit(handler->loglevel);
+    if (sc)
+    {
+       return X_LINK_COMMUNICATION_NOT_OPEN;
+    }
+
+    //initialize availableStreams
+    xLinkDesc_t* link;
+    for (i = 0; i < MAX_LINKS; i++) {
+        link = &availableXLinks[i];
+        link->id = INVALID_LINK_ID;
+        link->fd = NULL;
+        link->peerState = USB_LINK_NOT_INIT;
+        int stream;
+        for (stream = 0; stream < USB_LINK_MAX_STREAMS; stream++)
+            link->availableStreams[stream].id = INVALID_STREAM_ID;
+    }
+
+    controlFunctionTbl.eventReceive = &dispatcherEventReceive;
+    controlFunctionTbl.eventSend = &dispatcherEventSend;
+    controlFunctionTbl.localGetResponse = &dispatcherLocalEventGetResponse;
+    controlFunctionTbl.remoteGetResponse = &dispatcherRemoteEventGetResponse;
+    controlFunctionTbl.closeLink = &dispatcherCloseUsbLink;
+    controlFunctionTbl.resetDevice = &dispatcherResetDevice;
+    dispatcherInitialize(&controlFunctionTbl);
+
+#ifndef __PC__
+    int index = getNextAvailableLinkIndex();
+    if (index == -1)
+        return X_LINK_COMMUNICATION_NOT_OPEN;
+
+    link = &availableXLinks[index];
+    link->fd = NULL;
+    link->id = nextUniqueLinkId++;
+    link->peerState = USB_LINK_UP;
+
+    sem_wait(&pingSem);
+#endif
+    return X_LINK_SUCCESS;
+}
+
+
+XLinkError_t XLinkGetFillLevel(streamId_t streamId, int isRemote, int* fillLevel)
+{
+    linkId_t id;
+    EXTRACT_IDS(streamId,id);
+    xLinkDesc_t* link = getLinkById(id);
+    streamDesc_t* stream;
+
+    ASSERT_X_LINK(link != NULL);
+    if (getXLinkState(link) != USB_LINK_UP)
+    {
+        return X_LINK_COMMUNICATION_NOT_OPEN;
+    }
+    stream = getStreamById(link->fd, streamId);
+    ASSERT_X_LINK(stream);
+
+    if (isRemote)
+        *fillLevel = stream->remoteFillLevel;
+    else
+        *fillLevel = stream->localFillLevel;
+    releaseStream(stream);
+    return X_LINK_SUCCESS;
+}
+
+streamId_t XLinkOpenStream(linkId_t id, const char* name, int stream_write_size)
+{
+    xLinkEvent_t event = {0};
+    xLinkDesc_t* link = getLinkById(id);
+    mvLog(MVLOG_DEBUG,"%s() id %d link %p\n", __func__, id, link);
+    ASSERT_X_LINK(link != NULL);
+    if (getXLinkState(link) != USB_LINK_UP)
+    {
+        /*no link*/
+        mvLog(MVLOG_DEBUG,"%s() no link up\n", __func__);
+        return INVALID_STREAM_ID;
+    }
+
+    if(strlen(name) > MAX_NAME_LENGTH)
+    {
+        mvLog(MVLOG_WARN,"name too long\n");
+        return INVALID_STREAM_ID;
+    }
+
+    if(stream_write_size > 0)
+    {
+        stream_write_size = ALIGN_UP(stream_write_size, __CACHE_LINE_SIZE);
+        event.header.type = USB_CREATE_STREAM_REQ;
+        strncpy(event.header.streamName, name, MAX_NAME_LENGTH);
+        event.header.size = stream_write_size;
+        event.header.streamId = INVALID_STREAM_ID;
+        event.xLinkFD = link->fd;
+
+        dispatcherAddEvent(EVENT_LOCAL, &event);
+        dispatcherWaitEventComplete(link->fd);
+
+    }
+    streamId_t streamId = getStreamIdByName(link, name);
+    if (streamId > 0xFFFFFFF) {
+        mvLog(MVLOG_ERROR,"Max streamId reached %x!", streamId);
+        return INVALID_STREAM_ID;
+    }
+    COMBIN_IDS(streamId, id);
+    return streamId;
+}
+
+
+// Just like open stream, when closeStream is called
+// on the local size we are resetting the writeSize
+// and on the remote side we are freeing the read buffer
+XLinkError_t XLinkCloseStream(streamId_t streamId)
+{
+    linkId_t id;
+    EXTRACT_IDS(streamId,id);
+    xLinkDesc_t* link = getLinkById(id);
+    ASSERT_X_LINK(link != NULL);
+
+    mvLog(MVLOG_DEBUG,"%s(): streamId %d\n", __func__, (int)streamId);
+    if (getXLinkState(link) != USB_LINK_UP)
+        return X_LINK_COMMUNICATION_NOT_OPEN;
+
+    xLinkEvent_t event = {0};
+    event.header.type = USB_CLOSE_STREAM_REQ;
+    event.header.streamId = streamId;
+    event.xLinkFD = link->fd;
+    xLinkEvent_t* ev = dispatcherAddEvent(EVENT_LOCAL, &event);
+    dispatcherWaitEventComplete(link->fd);
+
+    if (ev->header.flags.bitField.ack == 1)
+        return X_LINK_SUCCESS;
+    else
+        return X_LINK_COMMUNICATION_FAIL;
+
+    return X_LINK_SUCCESS;
+}
+
+
+XLinkError_t XLinkGetAvailableStreams(linkId_t id)
+{
+    xLinkDesc_t* link = getLinkById(id);
+    ASSERT_X_LINK(link != NULL);
+    if (getXLinkState(link) != USB_LINK_UP)
+    {
+        return X_LINK_COMMUNICATION_NOT_OPEN;
+    }
+    /*...get other statuses*/
+    return X_LINK_SUCCESS;
+}
+
+XLinkError_t XLinkGetDeviceName(int index, char* name, int nameSize)
+{
+    int rc = UsbLinkPlatformGetDeviceName(index, name, nameSize);
+    switch(rc) {
+        case USB_LINK_PLATFORM_SUCCESS:
+            return X_LINK_SUCCESS;
+        case USB_LINK_PLATFORM_DEVICE_NOT_FOUND:
+            return X_LINK_DEVICE_NOT_FOUND;
+        case USB_LINK_PLATFORM_TIMEOUT:
+            return X_LINK_TIMEOUT;
+        default:
+            return X_LINK_ERROR;
+
+    }
+}
+
+XLinkError_t XLinkWriteData(streamId_t streamId, const uint8_t* buffer,
+                            int size)
+{
+    linkId_t id;
+    EXTRACT_IDS(streamId,id);
+    xLinkDesc_t* link = getLinkById(id);
+    ASSERT_X_LINK(link != NULL);
+    if (getXLinkState(link) != USB_LINK_UP)
+    {
+        return X_LINK_COMMUNICATION_NOT_OPEN;
+    }
+    struct timespec start, end;
+    clock_gettime(CLOCK_REALTIME, &start);
+
+    xLinkEvent_t event = {0};
+    event.header.type = USB_WRITE_REQ;
+    event.header.size = size;
+    event.header.streamId = streamId;
+    event.xLinkFD = link->fd;
+    event.data = (void*)buffer;
+
+    xLinkEvent_t* ev = dispatcherAddEvent(EVENT_LOCAL, &event);
+    dispatcherWaitEventComplete(link->fd);
+    clock_gettime(CLOCK_REALTIME, &end);
+
+
+    if (ev->header.flags.bitField.ack == 1)
+    {
+         //profile only on success
+        if( glHandler->profEnable)
+        {
+            glHandler->profilingData.totalWriteBytes += size;
+            glHandler->profilingData.totalWriteTime += timespec_diff(&start, &end);
+        }
+        return X_LINK_SUCCESS;
+    }
+    else
+        return X_LINK_COMMUNICATION_FAIL;
+}
+
+XLinkError_t XLinkAsyncWriteData()
+{
+    if (getXLinkState(NULL) != USB_LINK_UP)
+    {
+        return X_LINK_COMMUNICATION_NOT_OPEN;
+    }
+    return X_LINK_SUCCESS;
+}
+
+XLinkError_t XLinkReadData(streamId_t streamId, streamPacketDesc_t** packet)
+{
+    linkId_t id;
+    EXTRACT_IDS(streamId,id);
+    xLinkDesc_t* link = getLinkById(id);
+    ASSERT_X_LINK(link != NULL);
+    if (getXLinkState(link) != USB_LINK_UP)
+    {
+        return X_LINK_COMMUNICATION_NOT_OPEN;
+    }
+
+    xLinkEvent_t event = {0};
+    struct timespec start, end;
+
+    event.header.type = USB_READ_REQ;
+    event.header.size = 0;
+    event.header.streamId = streamId;
+    event.xLinkFD = link->fd;
+    event.data = (void*)packet;
+
+    clock_gettime(CLOCK_REALTIME, &start);
+    xLinkEvent_t* ev = dispatcherAddEvent(EVENT_LOCAL, &event);
+    dispatcherWaitEventComplete(link->fd);
+    clock_gettime(CLOCK_REALTIME, &end);
+
+    if( glHandler->profEnable)
+    {
+        glHandler->profilingData.totalReadBytes += (*packet)->length;
+        glHandler->profilingData.totalReadTime += timespec_diff(&start, &end);
+    }
+
+    if (ev->header.flags.bitField.ack == 1)
+        return X_LINK_SUCCESS;
+    else
+        return X_LINK_COMMUNICATION_FAIL;
+}
+
+XLinkError_t XLinkReleaseData(streamId_t streamId)
+{
+    linkId_t id;
+    EXTRACT_IDS(streamId,id);
+    xLinkDesc_t* link = getLinkById(id);
+    ASSERT_X_LINK(link != NULL);
+    if (getXLinkState(link) != USB_LINK_UP)
+    {
+        return X_LINK_COMMUNICATION_NOT_OPEN;
+    }
+
+    xLinkEvent_t event = {0};
+    event.header.type = USB_READ_REL_REQ;
+    event.header.streamId = streamId;
+    event.xLinkFD = link->fd;
+
+    xLinkEvent_t* ev = dispatcherAddEvent(EVENT_LOCAL, &event);
+    dispatcherWaitEventComplete(link->fd);
+
+    if (ev->header.flags.bitField.ack == 1)
+        return X_LINK_SUCCESS;
+    else
+        return X_LINK_COMMUNICATION_FAIL;
+}
+
+XLinkError_t XLinkBootRemote(const char* deviceName, const char* binaryPath)
+{
+    if (UsbLinkPlatformBootRemote(deviceName, binaryPath) == 0)
+        return X_LINK_SUCCESS;
+    else
+        return X_LINK_COMMUNICATION_FAIL;
+}
+
+XLinkError_t XLinkResetRemote(linkId_t id)
+{
+    xLinkDesc_t* link = getLinkById(id);
+    ASSERT_X_LINK(link != NULL);
+    if (getXLinkState(link) != USB_LINK_UP)
+    {
+        USBLinkPlatformResetRemote(link->fd);
+        return X_LINK_COMMUNICATION_NOT_OPEN;
+    }
+    xLinkEvent_t event = {0};
+    event.header.type = USB_RESET_REQ;
+    event.xLinkFD = link->fd;
+    mvLog(MVLOG_DEBUG,"sending reset remote event\n");
+    dispatcherAddEvent(EVENT_LOCAL, &event);
+    dispatcherWaitEventComplete(link->fd);
+
+    return X_LINK_SUCCESS;
+}
+
+XLinkError_t XLinkResetAll()
+{
+    int i;
+    for (i = 0; i < MAX_LINKS; i++) {
+        if (availableXLinks[i].id != INVALID_LINK_ID) {
+            xLinkDesc_t* link = &availableXLinks[i];
+            int stream;
+            for (stream = 0; stream < USB_LINK_MAX_STREAMS; stream++) {
+                if (link->availableStreams[stream].id != INVALID_STREAM_ID) {
+                    streamId_t streamId = link->availableStreams[stream].id;
+                    mvLog(MVLOG_DEBUG,"%s() Closing stream (stream = %d) %d on link %d\n",
+                          __func__, stream, (int) streamId, (int) link->id);
+                    COMBIN_IDS(streamId, link->id);
+                    XLinkCloseStream(streamId);
+                }
+            }
+            XLinkResetRemote(link->id);
+        }
+    }
+    return X_LINK_SUCCESS;
+}
+
+XLinkError_t XLinkProfStart()
+{
+    glHandler->profEnable = 1;
+    glHandler->profilingData.totalReadBytes = 0;
+    glHandler->profilingData.totalWriteBytes = 0;
+    glHandler->profilingData.totalWriteTime = 0;
+    glHandler->profilingData.totalReadTime = 0;
+    glHandler->profilingData.totalBootCount = 0;
+    glHandler->profilingData.totalBootTime = 0;
+
+    return X_LINK_SUCCESS;
+}
+
+XLinkError_t XLinkProfStop()
+{
+    glHandler->profEnable = 0;
+    return X_LINK_SUCCESS;
+}
+
+XLinkError_t XLinkProfPrint()
+{
+    printf("XLink profiling results:\n");
+    if (glHandler->profilingData.totalWriteTime)
+    {
+        printf("Average write speed: %f MB/Sec\n",
+               glHandler->profilingData.totalWriteBytes /
+               glHandler->profilingData.totalWriteTime /
+               1024.0 /
+               1024.0 );
+    }
+    if (glHandler->profilingData.totalReadTime)
+    {
+        printf("Average read speed: %f MB/Sec\n",
+               glHandler->profilingData.totalReadBytes /
+               glHandler->profilingData.totalReadTime /
+               1024.0 /
+               1024.0);
+    }
+    if (glHandler->profilingData.totalBootCount)
+    {
+        printf("Average boot speed: %f sec\n",
+               glHandler->profilingData.totalBootTime /
+               glHandler->profilingData.totalBootCount);
+    }
+    return X_LINK_SUCCESS;
+}
+/* end of file */
diff --git a/api/src/common/components/XLink/shared/XLink.h b/api/src/common/components/XLink/shared/XLink.h
new file mode 100644 (file)
index 0000000..a521550
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @file
+/// @brief     Application configuration Leon header
+///
+#ifndef _XLINK_H
+#define _XLINK_H
+#include "XLinkPublicDefines.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+// Initializes XLink and scheduler, on myriad it starts the dispatcher
+XLinkError_t XLinkInitialize(XLinkGlobalHandler_t* handler);
+
+// Connects to specific device, starts dispatcher and pings remote
+XLinkError_t XLinkConnect(XLinkHandler_t* handler);
+
+
+// Opens a stream in the remote that can be written to by the local
+// Allocates stream_write_size (aligned up to 64 bytes) for that stream
+streamId_t XLinkOpenStream(linkId_t id, const char* name, int stream_write_size);
+
+// Close stream for any further data transfer
+// Stream will be deallocated when all pending data has been released
+XLinkError_t XLinkCloseStream(streamId_t streamId);
+
+// Currently useless
+XLinkError_t XLinkGetAvailableStreams(linkId_t id);
+
+XLinkError_t XLinkGetDeviceName(int index, char* name, int nameSize);
+
+// Send a package to initiate the writing of data to a remote stream
+// Note that the actual size of the written data is ALIGN_UP(size, 64)
+XLinkError_t XLinkWriteData(streamId_t streamId, const uint8_t* buffer, int size);
+
+// Currently useless
+XLinkError_t XLinkAsyncWriteData();
+
+// Read data from local stream. Will only have something if it was written
+// to by the remote
+XLinkError_t XLinkReadData(streamId_t streamId, streamPacketDesc_t** packet);
+
+// Release data from stream - This should be called after ReadData
+XLinkError_t XLinkReleaseData(streamId_t streamId);
+
+//Read fill level
+XLinkError_t XLinkGetFillLevel(streamId_t streamId, int isRemote, int* fillLevel);
+
+// Boot the remote (This is intended as an interface to boot the Myriad
+// from PC)
+XLinkError_t XLinkBootRemote(const char* deviceName, const char* binaryPath);
+
+// Reset the remote
+XLinkError_t XLinkResetRemote(linkId_t id);
+
+// Close all and release all memory
+XLinkError_t XLinkResetAll();
+
+// Profiling funcs - keeping them global for now
+XLinkError_t XLinkProfStart();
+XLinkError_t XLinkProfStop();
+XLinkError_t XLinkProfPrint();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/api/src/common/components/XLink/shared/XLinkDispatcher.c b/api/src/common/components/XLink/shared/XLinkDispatcher.c
new file mode 100644 (file)
index 0000000..23575f5
--- /dev/null
@@ -0,0 +1,716 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @file
+///
+/// @brief     Application configuration Leon header
+///
+#include "stdio.h"
+#include "stdint.h"
+#include "stdlib.h"
+#include "string.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include <pthread.h>
+#include <semaphore.h>
+
+#include "XLinkDispatcher.h"
+#include "XLinkPrivateDefines.h"
+
+#define MVLOG_UNIT_NAME xLink
+#include "mvLog.h"
+
+typedef enum {
+    EVENT_PENDING,
+    EVENT_BLOCKED,
+    EVENT_READY,
+    EVENT_SERVED,
+} xLinkEventState_t;
+
+typedef struct xLinkEventPriv_t {
+    xLinkEvent_t packet;
+    xLinkEventState_t isServed;
+    xLinkEventOrigin_t origin;
+    sem_t* sem;
+    void* data;
+    uint32_t pad;
+} xLinkEventPriv_t;
+
+typedef struct {
+    sem_t sem;
+    pthread_t threadId;
+    int refs;
+} localSem_t;
+
+typedef struct{
+    xLinkEventPriv_t* end;
+    xLinkEventPriv_t* base;
+
+    xLinkEventPriv_t* curProc;
+    xLinkEventPriv_t* cur;
+    __attribute__((aligned(8))) xLinkEventPriv_t q[MAX_EVENTS];
+
+}eventQueueHandler_t;
+typedef struct {
+    void* xLinkFD; //will be device handler
+    int schedulerId;
+
+    sem_t addEventSem;
+    sem_t notifyDispatcherSem;
+    uint32_t resetXLink;
+    uint32_t semaphores;
+    pthread_t xLinkThreadId;
+
+    eventQueueHandler_t lQueue; //local queue
+    eventQueueHandler_t rQueue; //remote queue
+    localSem_t eventSemaphores[MAXIMUM_SEMAPHORES];
+} xLinkSchedulerState_t;
+
+
+#define CIRCULAR_INCREMENT(x, maxVal, base) \
+    { \
+        x++; \
+        if (x == maxVal) \
+            x = base; \
+    }
+//avoid problems with unsigned. first compare and then give the nuw value
+#define CIRCULAR_DECREMENT(x, maxVal, base) \
+{ \
+    if (x == base) \
+        x = maxVal - 1; \
+    else \
+        x--; \
+}
+
+char* TypeToStr(int type)
+{
+    switch(type)
+    {
+        case USB_WRITE_REQ:     return "USB_WRITE_REQ";
+        case USB_READ_REQ:      return "USB_READ_REQ";
+        case USB_READ_REL_REQ:  return "USB_READ_REL_REQ";
+        case USB_CREATE_STREAM_REQ:return "USB_CREATE_STREAM_REQ";
+        case USB_CLOSE_STREAM_REQ: return "USB_CLOSE_STREAM_REQ";
+        case USB_PING_REQ:         return "USB_PING_REQ";
+        case USB_RESET_REQ:        return "USB_RESET_REQ";
+        case USB_REQUEST_LAST:     return "USB_REQUEST_LAST";
+        case USB_WRITE_RESP:   return "USB_WRITE_RESP";
+        case USB_READ_RESP:     return "USB_READ_RESP";
+        case USB_READ_REL_RESP: return "USB_READ_REL_RESP";
+        case USB_CREATE_STREAM_RESP: return "USB_CREATE_STREAM_RESP";
+        case USB_CLOSE_STREAM_RESP:  return "USB_CLOSE_STREAM_RESP";
+        case USB_PING_RESP:  return "USB_PING_RESP";
+        case USB_RESET_RESP: return "USB_RESET_RESP";
+        case USB_RESP_LAST:  return "USB_RESP_LAST";
+        default: break;
+    }
+    return "";
+}
+#if (defined(_WIN32) || defined(_WIN64))
+static void* __cdecl eventSchedulerRun(void* ctx);
+#else
+static void* eventSchedulerRun(void*);
+#endif
+//These will be common for all, Initialized only once
+struct dispatcherControlFunctions* glControlFunc;
+int numSchedulers;
+xLinkSchedulerState_t schedulerState[MAX_SCHEDULERS];
+sem_t addSchedulerSem;
+
+//below workaround for "C2088 '==': illegal for struct" error
+int pthread_t_compare(pthread_t a, pthread_t b)
+{
+#if (defined(_WIN32) || defined(_WIN64) )
+    return ((a.p == b.p) && (a.x == b.x));
+#else
+    return  (a == b);
+#endif
+}
+
+static int unrefSem(sem_t* sem,  xLinkSchedulerState_t* curr) {
+    ASSERT_X_LINK(curr != NULL);
+    localSem_t* temp = curr->eventSemaphores;
+    while (temp < curr->eventSemaphores + MAXIMUM_SEMAPHORES) {
+        if (&temp->sem == sem) {
+            temp->refs--;
+            //mvLog(MVLOG_WARN,"unrefSem : sem->threadId %x refs %d number of semaphors %d\n", temp->threadId, temp->refs, curr->semaphores);
+            if (temp->refs == 0) {
+                curr->semaphores--;
+                ASSERT_X_LINK(sem_destroy(&temp->sem) != -1);
+                temp->refs = -1;
+            }
+            return 1;
+        }
+        temp++;
+    }
+    mvLog(MVLOG_WARN,"unrefSem : sem wasn't found\n");
+    return 0;
+}
+static sem_t* getCurrentSem(pthread_t threadId, xLinkSchedulerState_t* curr, int inc_ref)
+{
+    ASSERT_X_LINK(curr != NULL);
+
+    localSem_t* sem = curr->eventSemaphores;
+    while (sem < curr->eventSemaphores + MAXIMUM_SEMAPHORES) {
+        if (pthread_t_compare(sem->threadId, threadId) && sem->refs > 0) {
+            sem->refs += inc_ref;
+            //mvLog(MVLOG_WARN,"getCurrentSem : sem->threadId %x refs %d inc_ref %d\n", sem->threadId, sem->refs, inc_ref);
+            return &sem->sem;
+        }
+        sem++;
+    }
+    return NULL;
+}
+
+static sem_t* createSem(xLinkSchedulerState_t* curr)
+{
+    ASSERT_X_LINK(curr != NULL);
+
+
+    sem_t* sem = getCurrentSem(pthread_self(), curr, 0);
+    if (sem) // it already exists, error
+        return NULL;
+    else
+    {
+        if (curr->semaphores < MAXIMUM_SEMAPHORES) {
+            localSem_t* temp = curr->eventSemaphores;
+            while (temp < curr->eventSemaphores + MAXIMUM_SEMAPHORES) {
+                if (temp->refs < 0) {
+                    sem = &temp->sem;
+                    if (temp->refs == -1) {
+                        if (sem_init(sem, 0, 0))
+                            perror("Can't create semaphore\n");
+                    }
+                    curr->semaphores++;
+                    temp->refs = 1;
+                    temp->threadId = pthread_self();
+
+                    break;
+                }
+                temp++;
+            }
+            if (!sem)
+                return NULL; //shouldn't happen
+            //mvLog(MVLOG_WARN,"createSem : sem->threadId %x refs %d  number of semaphors %d \n", temp->threadId, temp->refs, curr->semaphores);
+        }
+        else
+            return NULL;
+       return sem;
+    }
+}
+
+#if (defined(_WIN32) || defined(_WIN64))
+static void* __cdecl eventReader(void* ctx)
+#else
+static void* eventReader(void* ctx)
+#endif
+{
+    int schedulerId = *(int *)ctx;
+    ASSERT_X_LINK(schedulerId < MAX_SCHEDULERS);
+
+    xLinkEvent_t event = { 0 };// to fix error C4700 in win
+    event.header.id = -1;
+    event.xLinkFD = schedulerState[schedulerId].xLinkFD;
+
+    while (!schedulerState[schedulerId].resetXLink) {
+        mvLog(MVLOG_DEBUG,"Reading %s (scheduler Id %d, fd %p)\n", TypeToStr(event.header.type),
+            schedulerId, event.xLinkFD);
+        int sc = glControlFunc->eventReceive(&event);
+        if (sc) {
+            break;
+        }
+    }
+    return 0;
+}
+
+
+
+static int isEventTypeRequest(xLinkEventPriv_t* event)
+{
+    if (event->packet.header.type < USB_REQUEST_LAST)
+        return 1;
+    else
+        return 0;
+}
+
+static void markEventBlocked(xLinkEventPriv_t* event)
+{
+    event->isServed = EVENT_BLOCKED;
+}
+
+static void markEventReady(xLinkEventPriv_t* event)
+{
+    event->isServed = EVENT_READY;
+}
+
+static void markEventServed(xLinkEventPriv_t* event)
+{
+    if(event->sem){
+        if (sem_post(event->sem)) {
+            mvLog(MVLOG_ERROR,"can't post semaphore\n");
+        }
+    }
+    event->isServed = EVENT_SERVED;
+}
+
+
+static int dispatcherRequestServe(xLinkEventPriv_t * event, xLinkSchedulerState_t* curr){
+    ASSERT_X_LINK(curr != NULL);
+    ASSERT_X_LINK(isEventTypeRequest(event));
+    xLinkEventHeader_t *header = &event->packet.header;
+    if (header->flags.bitField.block){ //block is requested
+        markEventBlocked(event);
+    }else if(header->flags.bitField.localServe == 1 ||
+             (header->flags.bitField.ack == 0
+             && header->flags.bitField.nack == 1)){ //this event is served locally, or it is failed
+        markEventServed(event);
+    }else if (header->flags.bitField.ack == 1
+              && header->flags.bitField.nack == 0){
+        event->isServed = EVENT_PENDING;
+        mvLog(MVLOG_DEBUG,"------------------------UNserved %s\n",
+              TypeToStr(event->packet.header.type));
+    }else{
+        ASSERT_X_LINK(0);
+    }
+    return 0;
+}
+
+
+static int dispatcherResponseServe(xLinkEventPriv_t * event, xLinkSchedulerState_t* curr)
+{
+    int i = 0;
+    ASSERT_X_LINK(curr != NULL);
+    ASSERT_X_LINK(!isEventTypeRequest(event));
+    for (i = 0; i < MAX_EVENTS; i++)
+    {
+        xLinkEventHeader_t *header = &curr->lQueue.q[i].packet.header;
+        xLinkEventHeader_t *evHeader = &event->packet.header;
+
+        if (curr->lQueue.q[i].isServed == EVENT_PENDING &&
+                        header->id == evHeader->id &&
+                        header->type == evHeader->type - USB_REQUEST_LAST -1)
+        {
+            mvLog(MVLOG_DEBUG,"----------------------ISserved %s\n",
+                    TypeToStr(header->type));
+            //propagate back flags
+            header->flags = evHeader->flags;
+            markEventServed(&curr->lQueue.q[i]);
+            break;
+        }
+    }
+    if (i == MAX_EVENTS) {
+        mvLog(MVLOG_FATAL,"no request for this response: %s %d\n", TypeToStr(event->packet.header.type), event->origin);
+        ASSERT_X_LINK(0);
+    }
+    return 0;
+}
+
+static inline xLinkEventPriv_t* getNextElementWithState(xLinkEventPriv_t* base, xLinkEventPriv_t* end,
+                                                        xLinkEventPriv_t* start, xLinkEventState_t state){
+    xLinkEventPriv_t* tmp = start;
+    while (start->isServed != state){
+        CIRCULAR_INCREMENT(start, end, base);
+        if(tmp == start){
+            break;
+        }
+    }
+    if(start->isServed == state){
+        return start;
+    }else{
+        return NULL;
+    }
+}
+
+static xLinkEventPriv_t* searchForReadyEvent(xLinkSchedulerState_t* curr)
+{
+    ASSERT_X_LINK(curr != NULL);
+    xLinkEventPriv_t* ev = NULL;
+
+    ev = getNextElementWithState(curr->lQueue.base, curr->lQueue.end, curr->lQueue.base, EVENT_READY);
+    if(ev){
+        mvLog(MVLOG_DEBUG,"ready %s %d \n",
+              TypeToStr((int)ev->packet.header.type),
+              (int)ev->packet.header.id);
+    }
+    return ev;
+}
+
+static xLinkEventPriv_t* getNextQueueElemToProc(eventQueueHandler_t *q ){
+    xLinkEventPriv_t* event = NULL;
+    if (q->cur != q->curProc) {
+        event = getNextElementWithState(q->base, q->end, q->curProc, EVENT_SERVED);
+        q->curProc = event;
+        CIRCULAR_INCREMENT(q->curProc, q->end, q->base);
+    }
+    return event;
+}
+
+
+static xLinkEvent_t* addNextQueueElemToProc(xLinkSchedulerState_t* curr,
+                                            eventQueueHandler_t *q, xLinkEvent_t* event,
+                                            sem_t* sem, xLinkEventOrigin_t o){
+    xLinkEvent_t* ev;
+    xLinkEventPriv_t* eventP = getNextElementWithState(q->base, q->end, q->cur, EVENT_SERVED);
+    mvLog(MVLOG_DEBUG,"received event %s %d\n",TypeToStr(event->header.type), o);
+    ev = &eventP->packet;
+    if (eventP->sem)
+        unrefSem(eventP->sem,  curr);
+    eventP->sem = sem;
+    eventP->packet = *event;
+    eventP->origin = o;
+    q->cur = eventP;
+    CIRCULAR_INCREMENT(q->cur, q->end, q->base);
+    return ev;
+}
+
+static xLinkEventPriv_t* dispatcherGetNextEvent(xLinkSchedulerState_t* curr)
+{
+    ASSERT_X_LINK(curr != NULL);
+
+    xLinkEventPriv_t* event = NULL;
+    event = searchForReadyEvent(curr);
+    if (event) {
+        return event;
+    }
+    if (sem_wait(&curr->notifyDispatcherSem)) {
+        mvLog(MVLOG_ERROR,"can't post semaphore\n");
+    }
+    event = getNextQueueElemToProc(&curr->lQueue);
+    if (event) {
+        return event;
+    }
+    event = getNextQueueElemToProc(&curr->rQueue);
+    return event;
+}
+
+static void dispatcherReset(xLinkSchedulerState_t* curr)
+{
+    ASSERT_X_LINK(curr != NULL);
+
+    glControlFunc->closeLink(curr->xLinkFD);
+    if (sem_post(&curr->notifyDispatcherSem)) {
+        mvLog(MVLOG_ERROR,"can't post semaphore\n"); //to allow us to get a NULL event
+    }
+    xLinkEventPriv_t* event = dispatcherGetNextEvent(curr);
+    while (event != NULL) {
+       event = dispatcherGetNextEvent(curr);
+    }
+    event = getNextElementWithState(curr->lQueue.base, curr->lQueue.end, curr->lQueue.base, EVENT_PENDING);
+    while (event != NULL) {
+        markEventServed(event);
+        event = getNextElementWithState(curr->lQueue.base, curr->lQueue.end, curr->lQueue.base, EVENT_PENDING);
+    }
+    glControlFunc->resetDevice(curr->xLinkFD);
+    curr->schedulerId = -1;
+    numSchedulers--;
+    mvLog(MVLOG_INFO,"Reset Successfully\n");
+}
+#if (defined(_WIN32) || defined(_WIN64))
+static void* __cdecl eventSchedulerRun(void* ctx)
+#else
+static void* eventSchedulerRun(void* ctx)
+#endif
+{
+    int schedulerId = *((int*) ctx);
+    mvLog(MVLOG_DEBUG,"%s() schedulerId %d\n", __func__, schedulerId);
+    ASSERT_X_LINK(schedulerId < MAX_SCHEDULERS);
+
+    xLinkSchedulerState_t* curr = &schedulerState[schedulerId];
+    pthread_t readerThreadId;        /* Create thread for reader.
+                        This thread will notify the dispatcher of any incoming packets*/
+    pthread_attr_t attr;
+    int sc;
+    int res;
+    if (pthread_attr_init(&attr) !=0) {
+        mvLog(MVLOG_ERROR,"pthread_attr_init error");
+    }
+#ifndef __PC__
+    if (pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) != 0) {
+        mvLog(MVLOG_ERROR,"pthread_attr_setinheritsched error");
+    }
+    if (pthread_attr_setschedpolicy(&attr, SCHED_RR) != 0) {
+        mvLog(MVLOG_ERROR,"pthread_attr_setschedpolicy error");
+    }
+#endif
+    sc = pthread_create(&readerThreadId, &attr, eventReader, &schedulerId);
+    if (sc) {
+        perror("Thread creation failed");
+    }
+    xLinkEventPriv_t* event;
+    xLinkEventPriv_t response;
+
+    while (!curr->resetXLink) {
+        event = dispatcherGetNextEvent(curr);
+        ASSERT_X_LINK(event->packet.xLinkFD == curr->xLinkFD);
+        getRespFunction getResp;
+        xLinkEvent_t* toSend;
+
+        if (event->origin == EVENT_LOCAL){
+            getResp = glControlFunc->localGetResponse;
+            toSend = &event->packet;
+        }else{
+            getResp = glControlFunc->remoteGetResponse;
+            toSend = &response.packet;
+        }
+
+        res = getResp(&event->packet, &response.packet);
+        if (isEventTypeRequest(event)){
+            if (event->origin == EVENT_LOCAL){ //we need to do this for locals only
+                dispatcherRequestServe(event, curr);
+            }
+            if (res == 0 && event->packet.header.flags.bitField.localServe == 0){
+                glControlFunc->eventSend(toSend);
+            }
+        }else{
+            if (event->origin == EVENT_REMOTE){ // match remote response with the local request
+                dispatcherResponseServe(event, curr);
+            }
+        }
+
+        //TODO: dispatcher shouldn't know about this packet. Seems to be easily move-able to protocol
+        if (event->origin == EVENT_REMOTE){
+            if (event->packet.header.type == USB_RESET_REQ) {
+                curr->resetXLink = 1;
+            }
+        }
+    }
+    pthread_join(readerThreadId, NULL);
+    dispatcherReset(curr);
+    return NULL;
+}
+
+static int createUniqueID()
+{
+    static int id = 0xa;
+    return id++;
+}
+
+static xLinkSchedulerState_t* findCorrespondingScheduler(void* xLinkFD)
+{
+    int i;
+    if (xLinkFD == NULL) { //in case of myriad there should be one scheduler
+        if (numSchedulers == 1)
+            return &schedulerState[0];
+        else
+            NULL;
+    }
+    for (i=0; i < MAX_SCHEDULERS; i++)
+        if (schedulerState[i].schedulerId != -1 &&
+            schedulerState[i].xLinkFD == xLinkFD)
+            return &schedulerState[i];
+
+    return NULL;
+}
+///////////////// External Interface //////////////////////////
+/*Adds a new event with parameters and returns event id*/
+xLinkEvent_t* dispatcherAddEvent(xLinkEventOrigin_t origin, xLinkEvent_t *event)
+{
+    xLinkSchedulerState_t* curr = findCorrespondingScheduler(event->xLinkFD);
+    ASSERT_X_LINK(curr != NULL);
+
+    if(curr->resetXLink) {
+        return NULL;
+    }
+    mvLog(MVLOG_DEBUG,"receiving event %s %d\n",TypeToStr(event->header.type), origin);
+    if (sem_wait(&curr->addEventSem)) {
+        mvLog(MVLOG_ERROR,"can't wait semaphore\n");
+    }
+    sem_t *sem = NULL;
+    xLinkEvent_t* ev;
+    if (origin == EVENT_LOCAL) {
+        event->header.id = createUniqueID();
+        sem = getCurrentSem(pthread_self(), curr, 1);
+        if (!sem) {
+
+            sem = createSem(curr);
+        }
+        if (!sem) {
+            mvLog(MVLOG_WARN,"No more semaphores. Increase XLink or OS resources\n");
+            return NULL;
+        }
+        event->header.flags.raw = 0;
+        event->header.flags.bitField.ack = 1;
+        ev = addNextQueueElemToProc(curr, &curr->lQueue, event, sem, origin);
+    } else {
+        ev = addNextQueueElemToProc(curr, &curr->rQueue, event, NULL, origin);
+    }
+    if (sem_post(&curr->addEventSem)) {
+        mvLog(MVLOG_ERROR,"can't post semaphore\n");
+    }
+    if (sem_post(&curr->notifyDispatcherSem)) {
+        mvLog(MVLOG_ERROR, "can't post semaphore\n");
+    }
+    return ev;
+}
+
+int dispatcherWaitEventComplete(void* xLinkFD)
+{
+    xLinkSchedulerState_t* curr = findCorrespondingScheduler(xLinkFD);
+    ASSERT_X_LINK(curr != NULL);
+
+    sem_t* id = getCurrentSem(pthread_self(), curr, 0);
+    if (id == NULL) {
+        return -1;
+    }
+
+    return sem_wait(id);
+}
+
+int dispatcherUnblockEvent(eventId_t id, xLinkEventType_t type, streamId_t stream, void* xLinkFD)
+{
+    xLinkSchedulerState_t* curr = findCorrespondingScheduler(xLinkFD);
+    ASSERT_X_LINK(curr != NULL);
+
+    mvLog(MVLOG_DEBUG,"unblock\n");
+    xLinkEventPriv_t* blockedEvent;
+    for (blockedEvent = curr->lQueue.q;
+         blockedEvent < curr->lQueue.q + MAX_EVENTS;
+         blockedEvent++)
+    {
+        if (blockedEvent->isServed == EVENT_BLOCKED &&
+            ((blockedEvent->packet.header.id == id || id == -1)
+            && blockedEvent->packet.header.type == type
+            && blockedEvent->packet.header.streamId == stream))
+        {
+            mvLog(MVLOG_DEBUG,"unblocked**************** %d %s\n",
+                  (int)blockedEvent->packet.header.id,
+                  TypeToStr((int)blockedEvent->packet.header.type));
+            markEventReady(blockedEvent);
+            return 1;
+        } else {
+            mvLog(MVLOG_DEBUG,"%d %s\n",
+                  (int)blockedEvent->packet.header.id,
+                  TypeToStr((int)blockedEvent->packet.header.type));
+        }
+    }
+    return 0;
+}
+
+int findAvailableScheduler()
+{
+    int i;
+    for (i = 0; i < MAX_SCHEDULERS; i++)
+        if (schedulerState[i].schedulerId == -1)
+            return i;
+    return -1;
+}
+
+int dispatcherStart(void* fd)
+{
+    pthread_attr_t attr;
+    int eventIdx;
+    if (numSchedulers >= MAX_SCHEDULERS)
+    {
+        mvLog(MVLOG_ERROR,"Max number Schedulers reached!\n");
+        return -1;
+    }
+    int idx = findAvailableScheduler();
+
+    schedulerState[idx].semaphores = 0;
+
+    schedulerState[idx].resetXLink = 0;
+    schedulerState[idx].xLinkFD = fd;
+    schedulerState[idx].schedulerId = idx;
+
+    schedulerState[idx].lQueue.cur = schedulerState[idx].lQueue.q;
+    schedulerState[idx].lQueue.curProc = schedulerState[idx].lQueue.q;
+    schedulerState[idx].lQueue.base = schedulerState[idx].lQueue.q;
+    schedulerState[idx].lQueue.end = &schedulerState[idx].lQueue.q[MAX_EVENTS];
+
+    schedulerState[idx].rQueue.cur = schedulerState[idx].rQueue.q;
+    schedulerState[idx].rQueue.curProc = schedulerState[idx].rQueue.q;
+    schedulerState[idx].rQueue.base = schedulerState[idx].rQueue.q;
+    schedulerState[idx].rQueue.end = &schedulerState[idx].rQueue.q[MAX_EVENTS];
+
+    for (eventIdx = 0 ; eventIdx < MAX_EVENTS; eventIdx++)
+    {
+        schedulerState[idx].rQueue.q[eventIdx].isServed = EVENT_SERVED;
+        schedulerState[idx].lQueue.q[eventIdx].isServed = EVENT_SERVED;
+    }
+
+    if (sem_init(&schedulerState[idx].addEventSem, 0, 1)) {
+        perror("Can't create semaphore\n");
+        return -1;
+    }
+    if (sem_init(&schedulerState[idx].notifyDispatcherSem, 0, 0)) {
+        perror("Can't create semaphore\n");
+    }
+    localSem_t* temp = schedulerState[idx].eventSemaphores;
+    while (temp < schedulerState[idx].eventSemaphores + MAXIMUM_SEMAPHORES) {
+        temp->refs = -1;
+        temp++;
+    }
+    if (pthread_attr_init(&attr) != 0) {
+        mvLog(MVLOG_ERROR,"pthread_attr_init error");
+    }
+#ifndef __PC__
+    if (pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) != 0) {
+        mvLog(MVLOG_ERROR,"pthread_attr_setinheritsched error");
+    }
+    if (pthread_attr_setschedpolicy(&attr, SCHED_RR) != 0) {
+        mvLog(MVLOG_ERROR,"pthread_attr_setschedpolicy error");
+    }
+
+#endif
+    sem_wait(&addSchedulerSem);
+    mvLog(MVLOG_DEBUG,"%s() starting a new thread - schedulerId %d \n", __func__, idx);
+    int sc = pthread_create(&schedulerState[idx].xLinkThreadId,
+                            &attr,
+                            eventSchedulerRun,
+                            (void*)&schedulerState[idx].schedulerId);
+    if (sc) {
+        perror("Thread creation failed");
+    }
+    numSchedulers++;
+    sem_post(&addSchedulerSem);
+
+    return 0;
+}
+
+int dispatcherInitialize(struct dispatcherControlFunctions* controlFunc) {
+    // create thread which will communicate with the pc
+
+    int i;
+    if (!controlFunc ||
+        !controlFunc->eventReceive ||
+        !controlFunc->eventSend ||
+        !controlFunc->localGetResponse ||
+        !controlFunc->remoteGetResponse)
+    {
+        return -1;
+    }
+
+    glControlFunc = controlFunc;
+    if (sem_init(&addSchedulerSem, 0, 1)) {
+        perror("Can't create semaphore\n");
+    }
+    numSchedulers = 0;
+    for (i = 0; i < MAX_SCHEDULERS; i++){
+        schedulerState[i].schedulerId = -1;
+    }
+#ifndef __PC__
+    return dispatcherStart(NULL); //myriad has one
+#else
+    return 0;
+#endif
+}
+
+/* end of file */
diff --git a/api/src/common/components/XLink/shared/XLinkDispatcher.h b/api/src/common/components/XLink/shared/XLinkDispatcher.h
new file mode 100644 (file)
index 0000000..cac032f
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @file
+///
+/// @brief     Application configuration Leon header
+///
+#ifndef _XLINKDISPATCHER_H
+#define _XLINKDISPATCHER_H
+#define _USBLINK_ENABLE_PRIVATE_INCLUDE_
+#include "XLinkPrivateDefines.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+typedef int (*getRespFunction) (xLinkEvent_t*,
+                xLinkEvent_t*);
+///Adds a new event with parameters and returns event.header.id
+xLinkEvent_t* dispatcherAddEvent(xLinkEventOrigin_t origin,
+                                    xLinkEvent_t *event);
+
+int dispatcherWaitEventComplete(void* xlinkFD);
+int dispatcherUnblockEvent(eventId_t id,
+                            xLinkEventType_t type,
+                            streamId_t stream,
+                            void* xlinkFD);
+
+struct dispatcherControlFunctions {
+                                int (*eventSend) (xLinkEvent_t*);
+                                int (*eventReceive) (xLinkEvent_t*);
+                                getRespFunction localGetResponse;
+                                getRespFunction remoteGetResponse;
+                                void (*closeLink) (void* fd);
+                                void (*resetDevice) (void* fd);
+                                };
+
+int dispatcherInitialize(struct dispatcherControlFunctions* controlFunc);
+int dispatcherStart(void* fd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/api/src/common/components/XLink/shared/XLinkPrivateDefines.h b/api/src/common/components/XLink/shared/XLinkPrivateDefines.h
new file mode 100644 (file)
index 0000000..2ef4be5
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @file
+///
+/// @brief     Application configuration Leon header
+///
+#ifndef _XLINKPRIVATEDEFINES_H
+#define _XLINKPRIVATEDEFINES_H
+
+#ifdef _USBLINK_ENABLE_PRIVATE_INCLUDE_
+
+#include <stdint.h>
+#include <semaphore.h>
+#include <XLinkPublicDefines.h>
+#include "UsbLinkPlatform.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#define MAX_NAME_LENGTH 16
+
+#ifdef USE_USB_VSC
+#define HEADER_SIZE (64-12 -8)
+#else
+#define HEADER_SIZE (64-12 -8)
+#endif
+
+#define MAXIMUM_SEMAPHORES 32
+#define __CACHE_LINE_SIZE 64
+
+#define ASSERT_X_LINK(x)   if(!(x)) { fprintf(stderr, "info: %s:%d: ", __FILE__, __LINE__); abort(); }
+
+typedef int32_t eventId_t;
+
+typedef enum {
+    USB_LINK_NOT_INIT,
+    USB_LINK_UP,
+    USB_LINK_DOWN,
+}xLinkState_t;
+
+typedef struct{
+    char name[MAX_NAME_LENGTH];
+    streamId_t id;
+    void* fd;
+    uint32_t writeSize;
+    uint32_t readSize;  /*No need of read buffer. It's on remote,
+    will read it directly to the requested buffer*/
+    streamPacketDesc_t packets[USB_LINK_MAX_PACKETS_PER_STREAM];
+    uint32_t availablePackets;
+    uint32_t blockedPackets;
+
+    uint32_t firstPacket;
+    uint32_t firstPacketUnused;
+    uint32_t firstPacketFree;
+    uint32_t remoteFillLevel;
+    uint32_t localFillLevel;
+    uint32_t remoteFillPacketLevel;
+
+    uint32_t closeStreamInitiated;
+
+    sem_t sem;
+}streamDesc_t;
+
+//events which are coming from remote
+typedef enum
+{
+    USB_WRITE_REQ,
+    USB_READ_REQ,
+    USB_READ_REL_REQ,
+    USB_CREATE_STREAM_REQ,
+    USB_CLOSE_STREAM_REQ,
+    USB_PING_REQ,
+    USB_RESET_REQ,
+    USB_REQUEST_LAST,
+
+    //note that is important to separate request and response
+    USB_WRITE_RESP,
+    USB_READ_RESP,
+    USB_READ_REL_RESP,
+    USB_CREATE_STREAM_RESP,
+    USB_CLOSE_STREAM_RESP,
+    USB_PING_RESP,
+    USB_RESET_RESP,
+    USB_RESP_LAST,
+    /*Add PCI-E related events at tail*/
+
+} xLinkEventType_t;
+
+typedef enum
+{
+    EVENT_LOCAL,
+    EVENT_REMOTE,
+} xLinkEventOrigin_t;
+
+#define MAX_EVENTS 64
+
+#define MAX_SCHEDULERS MAX_LINKS
+//static int eventCount;
+//static dispEventType_t eventQueue[MAX_EVENTS];
+
+typedef struct xLinkEventHeader_t{
+    eventId_t           id;
+    xLinkEventType_t    type;
+    char                streamName[MAX_NAME_LENGTH];
+    streamId_t          streamId;
+    uint32_t            size;
+    union{
+        uint32_t raw;
+        struct{
+            uint32_t ack : 1;
+            uint32_t nack : 1;
+            uint32_t block : 1;
+            uint32_t localServe : 1;
+            uint32_t terminate : 1;
+            uint32_t bufferFull : 1;
+            uint32_t sizeTooBig : 1;
+            uint32_t noSuchStream : 1;
+        }bitField;
+    }flags;
+}xLinkEventHeader_t;
+
+typedef struct xLinkEvent_t {
+    xLinkEventHeader_t header;
+    void* xLinkFD;
+    void* data;
+}xLinkEvent_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /*_USBLINK_ENABLE_PRIVATE_INCLUDE_ end*/
+#endif
+
+/* end of include file */
diff --git a/api/src/common/components/XLink/shared/XLinkPublicDefines.h b/api/src/common/components/XLink/shared/XLinkPublicDefines.h
new file mode 100644 (file)
index 0000000..19ab13d
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @file
+///
+/// @brief     Application configuration Leon header
+///
+#ifndef _XLINKPUBLICDEFINES_H
+#define _XLINKPUBLICDEFINES_H
+#include <stdint.h>
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define USB_LINK_MAX_STREAMS 32
+#define USB_LINK_MAX_PACKETS_PER_STREAM 64
+
+typedef enum{
+    X_LINK_SUCCESS = 0,
+    X_LINK_ALREADY_OPEN,
+    X_LINK_COMMUNICATION_NOT_OPEN,
+    X_LINK_COMMUNICATION_FAIL,
+    X_LINK_COMMUNICATION_UNKNOWN_ERROR,
+    X_LINK_DEVICE_NOT_FOUND,
+    X_LINK_TIMEOUT,
+    X_LINK_ERROR
+} XLinkError_t;
+
+#define USB_LINK_INVALID_FD  (-314)
+
+#define INVALID_STREAM_ID 0xDEADDEAD
+#define INVALID_LINK_ID   0xFF
+
+typedef uint32_t streamId_t;
+typedef uint8_t linkId_t;
+
+
+typedef struct streamPacketDesc_t
+{
+    uint8_t* data;
+    uint32_t length;
+
+} streamPacketDesc_t;
+
+typedef struct XLinkProf_t
+{
+    float totalReadTime;
+    float totalWriteTime;
+    unsigned long totalReadBytes;
+    unsigned long totalWriteBytes;
+    unsigned long totalBootCount;
+    float totalBootTime;
+} XLinkProf_t;
+
+typedef struct XLinkGlobalHandler_t
+{
+    int loglevel;
+    int profEnable;
+    XLinkProf_t profilingData;
+} XLinkGlobalHandler_t;
+
+typedef struct
+{
+    char* devicePath;
+    char* devicePath2;
+    int linkId;
+} XLinkHandler_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* end of include file */
diff --git a/api/src/common/components/XLink/shared/XLinkVersion.h b/api/src/common/components/XLink/shared/XLinkVersion.h
new file mode 100644 (file)
index 0000000..d6d5a69
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+* Copyright 2018 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @file
+///
+/// @brief     Application configuration Leon header
+///
+
+#define X_LINK_VERSION_MAJOR 1
+#define X_LINK_VERSION_MINOR 0
+#define X_LINK_VERSION_PATCH 0
diff --git a/api/src/common/components/XLink/shared/subdir.mk b/api/src/common/components/XLink/shared/subdir.mk
new file mode 100644 (file)
index 0000000..248561c
--- /dev/null
@@ -0,0 +1,8 @@
+
+srcs-xlink-shared += \
+       XLink.c \
+       XLinkDispatcher.c
+
+srcs-los-y += $(srcs-xlink-shared)
+srcs-lrt-y += $(srcs-xlink-shared)
+
diff --git a/api/src/common/components/XLinkConsole/pc/XLinkConsole.c b/api/src/common/components/XLinkConsole/pc/XLinkConsole.c
new file mode 100644 (file)
index 0000000..f15cefd
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+* Copyright 2017 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+#include <XLink.h>
+#include <XLinkConsole.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <arpa/inet.h>
+#define MVLOG_UNIT_NAME xLinkConsole
+#include "mvLog.h"
+
+
+void* shellThreadWriter(void* ctx){
+
+    int* context = ctx;
+    streamId_t cId = (streamId_t)context[0];
+    int connfd = (streamId_t)context[1];
+    while(1){
+
+        char str[100];
+        int bytes = read(connfd,str, 100);
+        if (bytes > 0){
+            XLinkWriteData(cId, str, bytes);
+        }else
+            perror("read");
+    }
+}
+
+void* shellThreadReader(void* ctx){
+
+    int* context = ctx;
+    streamId_t cId = (streamId_t)context[1];
+    int portNum = (streamId_t)context[0];
+    if(portNum < 5000){
+        mvLog(MVLOG_WARN, "Port number <5000. using port number 5000");
+        portNum = 5000;
+    }
+
+    pthread_t shellWriter;
+    int listenfd = 0, connfd = 0;
+    struct sockaddr_in serv_addr;
+
+    listenfd = socket(AF_INET, SOCK_STREAM, 0);
+    memset(&serv_addr, '0', sizeof(serv_addr));
+
+    serv_addr.sin_family = AF_INET;
+    serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
+    serv_addr.sin_port = htons(portNum);
+
+    bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
+
+    mvLog(MVLOG_INFO, "Device console open. Please open a telnet session on port %d to connect:", portNum);
+    mvLog(MVLOG_INFO, "telnet localhost %d", portNum);
+    listen(listenfd, 10);
+    connfd = accept(listenfd, (struct sockaddr*)NULL, NULL);
+    //reuse context allocated before starting this thread
+    context[0] = cId;
+    context[1] = connfd;
+    streamPacketDesc_t *packet;
+    pthread_create(&shellWriter, NULL, shellThreadWriter, (void*) context);
+
+    while(1){
+        XLinkReadData(cId, &packet);
+        write(connfd, packet->data, packet->length);
+        XLinkReleaseData(cId);
+    }
+}
+void initXlinkShell(XLinkHandler_t* handler, int portNum){
+    pthread_t shellReader;
+    streamId_t cId = XLinkOpenStream(handler->linkId, "console", 10*1024);
+    int* context = malloc(2* sizeof(int));
+    context[0] = portNum;
+    context[1] = cId;
+    pthread_create(&shellReader, NULL, shellThreadReader, (void*) context);
+}
diff --git a/api/src/common/components/XLinkConsole/pc/XLinkConsole.h b/api/src/common/components/XLinkConsole/pc/XLinkConsole.h
new file mode 100644 (file)
index 0000000..d5f54fa
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+* Copyright 2017 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+/*
+ * XLinkConsole.h
+ *
+ *  Created on: Nov 20, 2017
+ *      Author: zbiro
+ */
+#ifndef _XLINKCONSOLE_H_
+#define _XLINKCONSOLE_H_
+#include <XLink.h>
+
+void initXlinkShell(XLinkHandler_t* handler, int portNum);
+#endif /* _XLINKCONSOLE_H_ */
diff --git a/api/src/common/shared/include/mvLog.h b/api/src/common/shared/include/mvLog.h
new file mode 100644 (file)
index 0000000..dcf82e2
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+* Copyright 2017 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+/*
+ * Add logging capabilities over simple printf.
+ * Allows 5 different logging levels:
+ *
+ * MVLOG_DEBUG = 0
+ * MVLOG_INFO = 1
+ * MVLOG_WARN = 2
+ * MVLOG_ERROR = 3
+ * MVLOG_FATAL = 4
+ * Before including header, a unit name can be set, otherwise defaults to global. eg:
+ *
+ * #define MVLOG_UNIT_NAME unitname
+ * #include <mvLog.h>
+ * Setting log level through debugger can be done in the following way:
+ * mset mvLogLevel_unitname 2
+ * Will set log level to warnings and above
+ */
+#ifndef MVLOG_H__
+#define MVLOG_H__
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <inttypes.h>
+
+#ifdef __RTEMS__
+#include <rtems.h>
+#include <rtems/bspIo.h>
+#endif
+
+ // Windows-only
+#if (defined (WINNT) || defined(_WIN32) || defined(_WIN64) )
+#define __attribute__(x)
+#endif
+
+#ifndef MVLOG_UNIT_NAME
+#define MVLOG_UNIT_NAME global
+#endif
+
+#define _MVLOGLEVEL(UNIT_NAME)  mvLogLevel_ ## UNIT_NAME
+#define  MVLOGLEVEL(UNIT_NAME) _MVLOGLEVEL(UNIT_NAME)
+
+#define ANSI_COLOR_RED     "\x1b[31m"
+#define ANSI_COLOR_GREEN   "\x1b[32m"
+#define ANSI_COLOR_YELLOW  "\x1b[33m"
+#define ANSI_COLOR_BLUE    "\x1b[34m"
+#define ANSI_COLOR_MAGENTA "\x1b[35m"
+#define ANSI_COLOR_CYAN    "\x1b[36m"
+#define ANSI_COLOR_WHITE   "\x1b[37m"
+#define ANSI_COLOR_RESET   "\x1b[0m"
+
+#ifndef MVLOG_DEBUG_COLOR
+#define MVLOG_DEBUG_COLOR ANSI_COLOR_WHITE
+#endif
+
+#ifndef MVLOG_INFO_COLOR
+#define MVLOG_INFO_COLOR ANSI_COLOR_CYAN
+#endif
+
+#ifndef MVLOG_WARN_COLOR
+#define MVLOG_WARN_COLOR ANSI_COLOR_YELLOW
+#endif
+
+#ifndef MVLOG_ERROR_COLOR
+#define MVLOG_ERROR_COLOR ANSI_COLOR_MAGENTA
+#endif
+
+#ifndef MVLOG_FATAL_COLOR
+#define MVLOG_FATAL_COLOR ANSI_COLOR_RED
+#endif
+
+typedef enum mvLog_t{
+    MVLOG_DEBUG = 0,
+    MVLOG_INFO,
+    MVLOG_WARN,
+    MVLOG_ERROR,
+    MVLOG_FATAL,
+    MVLOG_LAST,
+} mvLog_t;
+
+static const char mvLogHeader[MVLOG_LAST][30] =
+{
+    MVLOG_DEBUG_COLOR "D:",
+    MVLOG_INFO_COLOR  "I:",
+    MVLOG_WARN_COLOR  "W:",
+    MVLOG_ERROR_COLOR "E:",
+    MVLOG_FATAL_COLOR "F:"
+};
+
+unsigned int __attribute__ ((weak)) MVLOGLEVEL(MVLOG_UNIT_NAME) = MVLOG_INFO;
+
+static unsigned int MVLOGLEVEL(default) = MVLOG_INFO;
+
+static int __attribute__ ((unused))
+logprintf(enum mvLog_t lvl, const char * func, const int line,
+                     const char * format, ...)
+{
+    if(lvl < MVLOGLEVEL(MVLOG_UNIT_NAME) &&
+       lvl < MVLOGLEVEL(default))
+        return 0;
+
+    const char headerFormat[] = "%s [%10" PRId64 "] %s:%d\t";
+#ifdef __RTEMS__
+    uint64_t timestamp = rtems_clock_get_uptime_nanoseconds() / 1000;
+#else
+    uint64_t timestamp = 0;
+#endif
+    va_list args;
+    va_start (args, format);
+
+#ifdef __RTEMS__
+    if(!rtems_interrupt_is_in_progress())
+    {
+#endif
+        fprintf(stdout, headerFormat, mvLogHeader[lvl], timestamp, func, line);
+        vfprintf(stdout, format, args);
+        fprintf(stdout, "%s\n", ANSI_COLOR_RESET);
+#ifdef __RTEMS__
+    }
+    else
+    {
+        printk(headerFormat, mvLogHeader[lvl], timestamp, func, line);
+        vprintk(format, args);
+        printk("%s\n", ANSI_COLOR_RESET);
+    }
+#endif
+    va_end (args);
+    return 0;
+}
+
+#define mvLog(lvl, format, ...)                                 \
+    logprintf(lvl, __func__, __LINE__, format, ##__VA_ARGS__)
+
+// Set log level for the current unit. Note that the level must be smaller than the global default
+#define mvLogLevelSet(lvl) if(lvl < MVLOG_LAST){ MVLOGLEVEL(MVLOG_UNIT_NAME) = lvl; }
+// Set the global log level. Can be used to prevent modules from hiding messages (enable all of them with a single change)
+// This should be an application setting, not a per module one
+#define mvLogDefaultLevelSet(lvl) if(lvl < MVLOG_LAST){ MVLOGLEVEL(default) = lvl; }
+
+#endif
diff --git a/api/src/common/shared/include/mvMacros.h b/api/src/common/shared/include/mvMacros.h
new file mode 100644 (file)
index 0000000..a7e05a1
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+* Copyright 2017 Intel Corporation.
+* The source code, information and material ("Material") contained herein is
+* owned by Intel Corporation or its suppliers or licensors, and title to such
+* Material remains with Intel Corporation or its suppliers or licensors.
+* The Material contains proprietary information of Intel or its suppliers and
+* licensors. The Material is protected by worldwide copyright laws and treaty
+* provisions.
+* No part of the Material may be used, copied, reproduced, modified, published,
+* uploaded, posted, transmitted, distributed or disclosed in any way without
+* Intel's prior express written permission. No license under any patent,
+* copyright or other intellectual property rights in the Material is granted to
+* or conferred upon you, either expressly, by implication, inducement, estoppel
+* or otherwise.
+* Any license under such intellectual property rights must be express and
+* approved by Intel in writing.
+*/
+
+///
+/// @file
+/// @copyright All code copyright Movidius Ltd 2012, all rights reserved
+///            For License Warranty see: common/license.txt
+///
+/// @brief     Basic macros
+///
+
+#ifndef MVMACROS_H__
+#define MVMACROS_H__
+
+#define COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((!(sizeof(x) % sizeof(0[x])))))
+#ifndef MIN
+#define MIN(a,b)                                \
+    ({ __typeof__ (a) _a = (a);                 \
+        __typeof__ (b) _b = (b);                \
+        _a < _b ? _a : _b; })
+#endif
+#ifndef MAX
+#define MAX(a,b)                                \
+    ({ __typeof__ (a) _a = (a);                 \
+        __typeof__ (b) _b = (b);                \
+        _a > _b ? _a : _b; })
+#endif
+/// @brief Aligns a pointer or number to a power of 2 value given
+/// @param[in] x number or pointer to be aligned
+/// @param[in] a value to align to (must be power of 2)
+/// @returns the aligned value
+#if (defined(_WIN32) || defined(_WIN64) )
+#define ALIGN_UP_UINT32(x, a)   ((uint32_t)(((uint32_t)(x) + a - 1) & (~(a-1))))
+#define ALIGN_UP_INT32(x, a)   ((int32_t)(((uint32_t)(x) + a - 1) & (~(a-1))))
+#define ALIGN_UP(x, a) ALIGN_UP_UINT32(x,a)
+#else
+#define ALIGN_UP(x, a)   ((typeof(x))(((uint32_t)(x) + a - 1) & (~(a-1))))
+#define ALIGN_DOWN(x, a) ((typeof(x))(((uint32_t)(x)) & (~(a-1))) )
+#define ALIGN_UP_UINT32(_x, _a)   ALIGN_UP(_x, _a)
+#define ALIGN_UP_INT32(_x, _a)   ALIGN_UP(_x, _a)
+#endif
+/// @brief Aligns a integernumber to any value given
+/// @param[in] x integer number to be aligned
+/// @param[in] a value to align to
+/// @returns the aligned value
+#ifndef ROUND_UP
+#define ROUND_UP(x, a)   ((__typeof__(x))((((uint32_t)(x) + a - 1) / a) * a))
+#endif
+#define ROUND_DOWN(x, a) ((__typeof__(x))(((uint32_t)(x) / a + 0) * a))
+
+#if defined(__GNUC__) || defined(__sparc_v8__)
+#define ATTR_UNUSED __attribute__((unused))
+#else
+#define ATTR_UNUSED
+#endif
+
+#endif
+
diff --git a/api/src/fp16.c b/api/src/fp16.c
new file mode 100644 (file)
index 0000000..dab1738
--- /dev/null
@@ -0,0 +1,171 @@
+#include "fp16.h"
+
+// Copied from Numpy
+
+unsigned half2float(unsigned short h)
+{
+    unsigned short h_exp, h_sig;
+    unsigned f_sgn, f_exp, f_sig;
+
+    h_exp = (h&0x7c00u);
+    f_sgn = ((unsigned)h&0x8000u) << 16;
+    switch (h_exp) {
+        case 0x0000u: /* 0 or subnormal */
+            h_sig = (h&0x03ffu);
+            /* Signed zero */
+            if (h_sig == 0) {
+                return f_sgn;
+            }
+            /* Subnormal */
+            h_sig <<= 1;
+            while ((h_sig&0x0400u) == 0) {
+                h_sig <<= 1;
+                h_exp++;
+            }
+            f_exp = ((unsigned)(127 - 15 - h_exp)) << 23;
+            f_sig = ((unsigned)(h_sig&0x03ffu)) << 13;
+            return f_sgn + f_exp + f_sig;
+        case 0x7c00u: /* inf or NaN */
+            /* All-ones exponent and a copy of the significand */
+            return f_sgn + 0x7f800000u + (((unsigned)(h&0x03ffu)) << 13);
+        default: /* normalized */
+            /* Just need to adjust the exponent and shift */
+            return f_sgn + (((unsigned)(h&0x7fffu) + 0x1c000u) << 13);
+    }
+}
+
+unsigned short float2half(unsigned f)
+{
+    unsigned f_exp, f_sig;
+    unsigned short h_sgn, h_exp, h_sig;
+
+    h_sgn = (unsigned short) ((f&0x80000000u) >> 16);
+    f_exp = (f&0x7f800000u);
+
+    /* Exponent overflow/NaN converts to signed inf/NaN */
+    if (f_exp >= 0x47800000u) {
+        if (f_exp == 0x7f800000u) {
+            /* Inf or NaN */
+            f_sig = (f&0x007fffffu);
+            if (f_sig != 0) {
+                /* NaN - propagate the flag in the significand... */
+                unsigned short ret = (unsigned short) (0x7c00u + (f_sig >> 13));
+                /* ...but make sure it stays a NaN */
+                if (ret == 0x7c00u) {
+                    ret++;
+                }
+                return h_sgn + ret;
+            } else {
+                /* signed inf */
+                return (unsigned short) (h_sgn + 0x7c00u);
+            }
+        } else {
+            /* overflow to signed inf */
+#if NPY_HALF_GENERATE_OVERFLOW
+            npy_set_floatstatus_overflow();
+#endif
+            return (unsigned short) (h_sgn + 0x7c00u);
+        }
+    }
+
+    /* Exponent underflow converts to a subnormal half or signed zero */
+    if (f_exp <= 0x38000000u) {
+        /*
+         * Signed zeros, subnormal floats, and floats with small
+         * exponents all convert to signed zero halfs.
+         */
+        if (f_exp < 0x33000000u) {
+#if NPY_HALF_GENERATE_UNDERFLOW
+            /* If f != 0, it underflowed to 0 */
+            if ((f&0x7fffffff) != 0) {
+                npy_set_floatstatus_underflow();
+            }
+#endif
+            return h_sgn;
+        }
+        /* Make the subnormal significand */
+        f_exp >>= 23;
+        f_sig = (0x00800000u + (f&0x007fffffu));
+#if NPY_HALF_GENERATE_UNDERFLOW
+        /* If it's not exactly represented, it underflowed */
+        if ((f_sig&(((unsigned)1 << (126 - f_exp)) - 1)) != 0) {
+            npy_set_floatstatus_underflow();
+        }
+#endif
+        f_sig >>= (113 - f_exp);
+        /* Handle rounding by adding 1 to the bit beyond half precision */
+#if NPY_HALF_ROUND_TIES_TO_EVEN
+        /*
+         * If the last bit in the half significand is 0 (already even), and
+         * the remaining bit pattern is 1000...0, then we do not add one
+         * to the bit after the half significand.  In all other cases, we do.
+         */
+        if ((f_sig&0x00003fffu) != 0x00001000u) {
+            f_sig += 0x00001000u;
+        }
+#else
+        f_sig += 0x00001000u;
+#endif
+        h_sig = (unsigned short) (f_sig >> 13);
+        /*
+         * If the rounding causes a bit to spill into h_exp, it will
+         * increment h_exp from zero to one and h_sig will be zero.
+         * This is the correct result.
+         */
+        return (unsigned short) (h_sgn + h_sig);
+    }
+
+    /* Regular case with no overflow or underflow */
+    h_exp = (unsigned short) ((f_exp - 0x38000000u) >> 13);
+    /* Handle rounding by adding 1 to the bit beyond half precision */
+    f_sig = (f&0x007fffffu);
+#if NPY_HALF_ROUND_TIES_TO_EVEN
+    /*
+     * If the last bit in the half significand is 0 (already even), and
+     * the remaining bit pattern is 1000...0, then we do not add one
+     * to the bit after the half significand.  In all other cases, we do.
+     */
+    if ((f_sig&0x00003fffu) != 0x00001000u) {
+        f_sig += 0x00001000u;
+    }
+#else
+    f_sig += 0x00001000u;
+#endif
+    h_sig = (unsigned short) (f_sig >> 13);
+    /*
+     * If the rounding causes a bit to spill into h_exp, it will
+     * increment h_exp by one and h_sig will be zero.  This is the
+     * correct result.  h_exp may increment to 15, at greatest, in
+     * which case the result overflows to a signed inf.
+     */
+#if NPY_HALF_GENERATE_OVERFLOW
+    h_sig += h_exp;
+    if (h_sig == 0x7c00u) {
+        npy_set_floatstatus_overflow();
+    }
+    return h_sgn + h_sig;
+#else
+    return h_sgn + h_exp + h_sig;
+#endif
+}
+
+void floattofp16(unsigned char *dst, float *src, unsigned nelem)
+{
+    unsigned i;
+    unsigned short *_dst = (unsigned short *)dst;
+    unsigned *_src = (unsigned *)src;
+
+    for(i = 0; i < nelem; i++)
+        _dst[i] = float2half(_src[i]);
+}
+
+void fp16tofloat(float *dst, unsigned char *src, unsigned nelem)
+{
+    unsigned i;
+    unsigned *_dst = (unsigned *)dst;
+    unsigned short *_src = (unsigned short *)src;
+
+    for(i = 0; i < nelem; i++)
+        _dst[i] = half2float(_src[i]);
+}
+
index 2975836cdd8ae2408fae510dcf00ae00530e5e17..8228a161b19b4ed73664122a14a2969abf24aa38 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright 2017 Intel Corporation.
+* Copyright 2018 Intel Corporation.
 * The source code, information and material ("Material") contained herein is
 * owned by Intel Corporation or its suppliers or licensors, and title to such
 * Material remains with Intel Corporation or its suppliers or licensors.
 */
 
 #define _GNU_SOURCE
-#include <dlfcn.h>             // For dladdr
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <fcntl.h>
+#include <time.h>
 #include <sys/types.h>
+#if (defined(_WIN32) || defined(_WIN64) )
+#include "gettime.h"
+#else
+#include <dlfcn.h>  // For dladdr
+#include <unistd.h>
 #include <dirent.h>
-#include <time.h>
-#include <pthread.h>
+#endif
+
 #include "mvnc.h"
-#include "usb_link.h"
-#include "usb_boot.h"
-#include "common.h"
-
-// Graph file structure
-#define HEADER_LENGTH  264
-#define STAGE_LENGTH   227
-#define VERSION_OFFSET         36
-#define GRAPH_VERSION  2
-#define N_STAGES_OFFSET 240
-#define FIRST_SHAVE_OFFSET 248
-#define N_OUTPUTS_OFFSET (HEADER_LENGTH + 136)
-#define X_OUT_STRIDE_OFFSET (HEADER_LENGTH + 172)
-
-#define THERMAL_BUFFER_SIZE 100
-#define DEBUG_BUFFER_SIZE      120
-
-#define MAX_OPTIMISATIONS              40
-#define OPTIMISATION_NAME_LEN  50
-#define OPTIMISATION_LIST_BUFFER_SIZE (MAX_OPTIMISATIONS * OPTIMISATION_NAME_LEN)
-
-#define MAX_PATH_LENGTH                255
+#include "fp16.h"
+
+#include "XLink.h"
+#include "ncCommPrivate.h"
+#include "ncPrivateTypes.h"
+
+#define MVLOG_UNIT_NAME ncAPI
+#include "mvLog.h"
+
+#define BLOB_STREAM_SIZE 4096
+#define NC_MAX_OPTIMISATIONS       40
+#define NC_OPTIMISATION_NAME_LEN   50
+#define NC_OPTIMISATION_LIST_BUFFER_SIZE (NC_MAX_OPTIMISATIONS * NC_OPTIMISATION_NAME_LEN)
+
+#define CONFIG_STREAM_SIZE NC_OPTIMISATION_LIST_BUFFER_SIZE
+
+#define MAX_PATH_LENGTH         255
 #define STATUS_WAIT_TIMEOUT     15
 
+#define SLEEP_MS        250
+#define MAX_ITERATIONS  20
+
+#define GRAPH_CLASS0_BASE   1000
+#define DEVICE_CLASS0_BASE  2000
+#define OPTION_CLASS_SIZE   100
+
 static int initialized = 0;
-static pthread_mutex_t mm = PTHREAD_MUTEX_INITIALIZER;
-
-int mvnc_loglevel = 0;
-
-/////////////////////////// Structs /////////////////////////////
-struct Graph;
-
-struct Device {
-       int backoff_time_normal, backoff_time_high, backoff_time_critical;
-       int temperature_debug, throttle_happened;
-       float temp_lim_upper, temp_lim_lower;
-       float *thermal_stats;
-       char *dev_addr;         // Device USB address as returned by usb_
-       char *dev_file;         // Device filename in /dev directory
-       char *optimisation_list;
-       void *usb_link;
-       struct Device *next;    // Next device in chain
-       struct Graph *graphs;   // List of associated graphs
-       pthread_mutex_t mm;
-} *devices;
-
-struct Graph {
-       int started;
-       int have_data;
-       int dont_block;
-       int input_idx;
-       int output_idx;
-       int failed;
-       int iterations;
-       int network_throttle;
-       unsigned noutputs;
-       unsigned nstages;
-       struct Device *dev;
-       struct Graph *next;
-       char *aux_buffer;
-       char *debug_buffer;
-       float *time_taken;
-       void *user_param[2];
-       void *output_data;
-};
-
-static double time_in_seconds()
-{
-       static double s;
-       struct timespec ts;
-
-       clock_gettime(CLOCK_MONOTONIC, &ts);
-       if (!s)
-               s = ts.tv_sec + ts.tv_nsec * 1e-9;
-       return ts.tv_sec + ts.tv_nsec * 1e-9 - s;
+static int loglevel_initialized = 0;
+static unsigned int api_version[4] = { 0 };
+
+static pthread_mutex_t globalMutex = PTHREAD_MUTEX_INITIALIZER;
+static XLinkGlobalHandler_t ghandler;
+
+
+extern ncStatus_t setDeviceOptionClass2(struct _devicePrivate_t *d,
+                                        int option, const void *data,
+                                        unsigned int dataLength);
+
+extern ncStatus_t setDeviceOptionClass3(struct _devicePrivate_t *d,
+                                        int option, const void *data,
+                                        unsigned int dataLength);
+
+extern ncStatus_t getDeviceOptionClass2(struct _devicePrivate_t *d,
+                                        int option, void *data,
+                                        unsigned int *dataLength);
+
+extern ncStatus_t getDeviceOptionClass3(struct _devicePrivate_t *d,
+                                        int option, void *data,
+                                        unsigned int *dataLength);
+
+extern ncStatus_t getGraphOptionClass2(struct _graphPrivate_t *g,
+                                       int option, void *data,
+                                       unsigned int *dataLength);
+
+extern ncStatus_t getGraphOptionClass3(struct _graphPrivate_t *g,
+                                       int option, void *data,
+                                       unsigned int *dataLength);
+
+extern ncStatus_t setGraphOptionClass2(struct _graphPrivate_t *g,
+                                       int option, const void *data,
+                                       unsigned int dataLength);
+
+extern ncStatus_t setGraphOptionClass3(struct _graphPrivate_t *g,
+                                       int option, const void *data,
+                                       unsigned int dataLength);
+
+
+static double timeInSeconds()
+{
+    static double s;
+    struct timespec ts;
+
+    clock_gettime(CLOCK_MONOTONIC, &ts);
+    if (!s)
+        s = ts.tv_sec + ts.tv_nsec * 1e-9;
+    return ts.tv_sec + ts.tv_nsec * 1e-9 - s;
+}
+
+static char *getProductName(const char *name)
+{
+    char *p = strchr(name, '-');
+    if (p == NULL)
+        return "";
+    return p;
+}
+
+static ncOptionClass_t getOptionClass(int option, int base)
+{
+    return (int) ((option - base) / OPTION_CLASS_SIZE);
+}
+
+static void resetAll()
+{
+    int index = 0;
+    int stalled_count = 0;
+    int iters = 0;
+    int bootrom_count = 0;
+    int after_reset_count = 0;
+    char name[NC_MAX_NAME_SIZE] = "";
+    XLinkError_t rc;
+
+    while (1) {
+        rc = XLinkGetDeviceName(index, name, NC_MAX_NAME_SIZE);
+        if (rc != X_LINK_SUCCESS)
+            break;  //no more devices found
+
+        if (strlen(getProductName(name)) == 1) {    //name doesn't have product number
+            //device is already booted, need to reset
+            mvLog(MVLOG_DEBUG, "Found stalled device %s\n", name);
+            XLinkHandler_t *handler = calloc(1, sizeof(XLinkHandler_t));
+
+            if (!handler) {
+                mvLog(MVLOG_ERROR, "Memory allocation failed");
+                break;
+            }
+            handler->devicePath = (char *) name;
+            if (XLinkConnect(handler) != X_LINK_SUCCESS) {
+                mvLog(MVLOG_ERROR, "Failed to connect to stalled device\n");
+            }
+            stalled_count++;
+            free(handler);
+
+        } else {
+            bootrom_count++;
+        }
+        index++;
+    }
+
+    if (stalled_count) {
+        mvLog(MVLOG_INFO, "Stalled devices found, Reseting...");
+        XLinkResetAll();
+#if (!defined(_WIN32) && !defined(_WIN64) )
+        usleep(500000); //device takes some time to re-enumrate, wait till it's back
+#endif
+        iters = 0;
+
+        while ((after_reset_count < bootrom_count + stalled_count) &&
+               iters < MAX_ITERATIONS) {
+            usleep(SLEEP_MS * 1000);
+            after_reset_count = 0;
+            index = 0;
+            while (1) {
+                XLinkError_t rc = XLinkGetDeviceName(index, name,
+                                                     NC_MAX_NAME_SIZE);
+                if (rc != X_LINK_SUCCESS)
+                    break;  //no more devices found
+
+                if (strlen(getProductName(name)) > 1) { //name has product number
+                    after_reset_count++;
+                }
+                index++;
+            }
+            iters++;
+            mvLog(MVLOG_INFO, "...");
+        }
+        usleep(SLEEP_MS * 1000);
+    }
+}
+
+static void initialize_loglevel()
+{
+    if (!loglevel_initialized) {
+        mvLogLevelSet(MVLOG_WARN);
+        mvLogDefaultLevelSet(MVLOG_WARN);   //Allow turning off warnings and errors
+    }
+    loglevel_initialized = 1;
 }
 
 static void initialize()
 {
-       // We sanitize the situation by trying to reset the devices that have been left open
-       initialized = 1;
-       usblink_resetall();
-}
-
-mvncStatus mvncGetDeviceName(int index, char *name, unsigned int nameSize)
-{
-       if (index < 0 || !name || nameSize < MVNC_MAX_NAME_SIZE)
-               return MVNC_INVALID_PARAMETERS;
-
-       pthread_mutex_lock(&mm);
-       if (!initialized)
-               initialize();
-       int rc = usb_find_device(index, name, nameSize, 0, 0, 0);
-       pthread_mutex_unlock(&mm);
-
-       return rc;
-}
-
-static int is_device_opened(const char *name)
-{
-       struct Device *d = devices;
-       while (d) {
-               if (strcmp(d->dev_addr, name) == 0)
-                       return 0;
-               d = d->next;
-       }
-       return -1;
-}
-
-static mvncStatus load_fw_file(const char *name)
-{
-       int rc;
-       FILE *fp;
-       char *tx_buf;
-       unsigned file_size;
-       char mv_cmd_file[MAX_PATH_LENGTH], *p;
-
-       // Search the mvnc executable in the same directory of this library, under mvnc
-       Dl_info info;
-       dladdr(mvncOpenDevice, &info);
-       strncpy(mv_cmd_file, info.dli_fname, sizeof(mv_cmd_file) - 40);
-       p = strrchr(mv_cmd_file, '/');
-       if (p)
-               strcpy(p + 1, "mvnc/MvNCAPI.mvcmd");
-       else
-               strcpy(mv_cmd_file, "mvnc/MvNCAPI.mvcmd");
-
-       // Load the mvnc executable
-       fp = fopen(mv_cmd_file, "rb");
-       if (fp == NULL) {
-               if (mvnc_loglevel)
-                       perror(mv_cmd_file);
-               pthread_mutex_unlock(&mm);
-               return MVNC_MVCMD_NOT_FOUND;
-       }
-
-       fseek(fp, 0, SEEK_END);
-       file_size = ftell(fp);
-       rewind(fp);
-       if (!(tx_buf = malloc(file_size))) {
-               if (mvnc_loglevel)
-                       perror("buffer");
-               fclose(fp);
-               pthread_mutex_unlock(&mm);
-               return MVNC_OUT_OF_MEMORY;
-       }
-
-       if (fread(tx_buf, 1, file_size, fp) != file_size) {
-               if (mvnc_loglevel)
-                       perror(mv_cmd_file);
-               fclose(fp);
-               free(tx_buf);
-               pthread_mutex_unlock(&mm);
-               return MVNC_MVCMD_NOT_FOUND;
-       }
-       fclose(fp);
-
-       // Boot it
-       rc = usb_boot(name, tx_buf, file_size);
-       free(tx_buf);
-       if (rc) {
-               pthread_mutex_unlock(&mm);
-               return rc;
-       }
-
-       PRINT_DEBUG(stderr, "Boot successful, device address %s\n", name);
-       return MVNC_OK;
-}
-
-static void allocate_device(const char* name, void **deviceHandle, void* f)
-{
-       struct Device *d = calloc(1, sizeof(*d));
-       d->dev_addr = strdup(name);
-       d->usb_link = f;
-       d->next = devices;
-       d->temp_lim_upper = 95;
-       d->temp_lim_lower = 85;
-       d->backoff_time_normal = 0;
-       d->backoff_time_high = 100;
-       d->backoff_time_critical = 10000;
-       d->temperature_debug = 0;
-       pthread_mutex_init(&d->mm, 0);
-       devices = d;
-       *deviceHandle = d;
-
-       PRINT_DEBUG(stderr, "done\n");
-       PRINT_INFO(stderr, "Booted %s -> %s\n",
-                  d->dev_addr,
-                  d->dev_file ? d->dev_file : "VSC");
-}
-
-mvncStatus mvncOpenDevice(const char *name, void **deviceHandle)
-{
-       int rc;
-       char name2[MVNC_MAX_NAME_SIZE] = "";
-       char* device_name;
-       char* saved_name = NULL;
-       char* temp = NULL; //save to be able to free memory
-       int second_name_available = 0;
-
-       if (!name || !deviceHandle)
-               return MVNC_INVALID_PARAMETERS;
-
-       temp = saved_name = strdup(name);
-
-       device_name = strtok_r(saved_name, ":", &saved_name);
-       if (device_name == NULL) {
-               free(temp);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       pthread_mutex_lock(&mm);
-       if (!initialized)
-               initialize();
-
-
-       rc = load_fw_file(device_name);
-       if (rc != MVNC_OK) {
-               free(temp);
-               return rc;
-       }
-       if (saved_name && strlen(saved_name) > 0) {
-               device_name = strtok_r(NULL, ":", &saved_name);
-               second_name_available = 1;
-       }
-
-       // Now we should have a new /dev/ttyACM, try to open it
-       double waittm = time_in_seconds() + STATUS_WAIT_TIMEOUT;
-       while (time_in_seconds() < waittm) {
-               void *f = usblink_open(device_name);
-
-               //we might fail in case name changed after boot and we don't have it
-               if (f == NULL && !second_name_available) {
-                       int count = 0;
-                       while (1) {
-                               name2[0] = '\0';
-                               rc = usb_find_device(count, name2,
-                                                    sizeof(name2), NULL,
-                                                    DEFAULT_OPEN_VID,
-                                                    DEFAULT_OPEN_PID);
-                               if (rc < 0)     //Error or no more devices found
-                                       break;
-
-                               //check if we already have name2 open
-                               // if not, check if it's not already busy
-                               if (is_device_opened(name2) < 0 &&
-                                   (f = usblink_open(name2)))
-                                       break;
-                               count++;
-                       }
-               }
-
-               if (f) {
-                       myriadStatus_t status;
-
-                       if (!usblink_getmyriadstatus(f, &status) && status == MYRIAD_WAITING) {
-                               allocate_device(strlen(name2) > 0 ? name2 : device_name, deviceHandle, f);
-                               free(temp);
-                               pthread_mutex_unlock(&mm);
-                               return MVNC_OK;
-                       } else {
-                               PRINT_DEBUG(stderr,
-                                           "found, but cannot get status\n");
-                               usblink_close(f);
-                       }
-               }
-               // Error opening it, continue searching
-               usleep(10000);
-       }
-       free(temp);
-       pthread_mutex_unlock(&mm);
-       return MVNC_ERROR;
-}
-
-static int find_device(void *deviceHandle)
-{
-       struct Device *d = devices;
-
-       while (d) {
-               if (d == deviceHandle)
-                       return 0;
-               d = d->next;
-       }
-
-       return -1;
-}
-
-static int find_graph(void *graphHandle)
-{
-       struct Device *d = devices;
-
-       while (d) {
-               struct Graph *g = d->graphs;
-               while (g) {
-                       if (g == graphHandle)
-                               return 0;
-                       g = g->next;
-               }
-               d = d->next;
-       }
-
-       return -1;
+    if (!loglevel_initialized)
+        initialize_loglevel();
+
+    initialized = 1;
+    int sc = XLinkInitialize(&ghandler);    //need to be called once
+    if (sc != X_LINK_SUCCESS) {
+        mvLog(MVLOG_ERROR, "Initialization failed\n");
+    }
+#ifndef XLINK_NO_BOOT
+    resetAll();
+#endif
+}
+
+ncStatus_t ncDeviceCreate(int index, struct ncDeviceHandle_t **deviceHandle)
+{
+    mvLog(MVLOG_DEBUG, "ncDeviceCreate index %d\n", index);
+    if (index < 0) {
+        mvLog(MVLOG_ERROR, "Invalid index");
+        return NC_INVALID_PARAMETERS;
+    }
+    if (!deviceHandle) {
+        mvLog(MVLOG_ERROR, "Device Handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+
+    char name[NC_MAX_NAME_SIZE] = "";
+
+    pthread_mutex_lock(&globalMutex);
+    if (!initialized)
+        initialize();
+
+    XLinkError_t rc = XLinkGetDeviceName(index, name, NC_MAX_NAME_SIZE);
+    pthread_mutex_unlock(&globalMutex);
+
+    if (rc == X_LINK_SUCCESS) {
+        struct ncDeviceHandle_t *dH = calloc(1, sizeof(*dH));
+        struct _devicePrivate_t *d = calloc(1, sizeof(*d));
+        dH->private_data = d;
+        d->state = NC_DEVICE_CREATED;
+        d->dev_addr = strdup(name);
+        d->dev_addr2 = NULL;
+        d->device_mon_stream_id = INVALID_LINK_ID;
+        d->graph_monitor_stream_id = INVALID_LINK_ID;
+        *deviceHandle = dH;
+    }
+    switch (rc) {
+    case X_LINK_SUCCESS:
+        return NC_OK;
+    case X_LINK_DEVICE_NOT_FOUND:
+        return NC_DEVICE_NOT_FOUND;
+    case X_LINK_TIMEOUT:
+        return NC_TIMEOUT;
+    default:
+        return NC_ERROR;
+    }
+}
+
+static ncStatus_t getDevAttributes(struct _devicePrivate_t *d)
+{
+    pthread_mutex_lock(&d->dev_stream_m);
+    deviceCommand_t config;
+    config.type.c0 = CLASS0_DEVICE_CAPABILITIES;
+    config.optionClass = NC_OPTION_CLASS0;
+    if (XLinkWriteData(d->device_mon_stream_id, (const uint8_t *) &config,
+                       sizeof(config)) != 0) {
+        pthread_mutex_unlock(&d->dev_stream_m);
+        return NC_ERROR;
+    }
+    streamPacketDesc_t *packet;
+    if (XLinkReadData(d->device_mon_stream_id, &packet) != 0) {
+        pthread_mutex_unlock(&d->dev_stream_m);
+        return NC_ERROR;
+    }
+    pthread_mutex_unlock(&d->dev_stream_m);
+    if (packet->length != sizeof(d->dev_attr)) {
+        mvLog(MVLOG_WARN, "Broken protocol. DevData can't be read\n");
+        XLinkReleaseData(d->device_mon_stream_id);
+        return NC_ERROR;
+    }
+    d->dev_attr = *(deviceCapabilities_t *) packet->data;
+    XLinkReleaseData(d->device_mon_stream_id);
+    mvLog(MVLOG_INFO, "Device attributes\n");
+    mvLog(MVLOG_INFO, "Device FW version: %x.%x.%x.%x\n",
+          d->dev_attr.fw_version[0], d->dev_attr.fw_version[1],
+          d->dev_attr.fw_version[2], d->dev_attr.fw_version[3]);
+    mvLog(MVLOG_INFO, "mvTensorVersion %d.%d \n",
+          d->dev_attr.mv_tensor_version[0], d->dev_attr.mv_tensor_version[1]);
+    mvLog(MVLOG_INFO, "Maximum graphs: %d\n", d->dev_attr.max_graphs);
+    mvLog(MVLOG_INFO, "Maximum fifos: %d\n", d->dev_attr.max_fifos);
+    mvLog(MVLOG_INFO, "Maximum graph option class: %d\n",
+          d->dev_attr.max_graph_opt_class);
+    mvLog(MVLOG_INFO, "Maximum device option class: %d\n",
+          d->dev_attr.max_device_opt_class);
+    mvLog(MVLOG_INFO, "Device memory capacity: %d\n", d->dev_attr.max_memory);
+    return NC_OK;
+}
+
+
+static ncStatus_t getThermalStats(struct _devicePrivate_t *d)
+{
+    if (!d->thermal_stats) {
+        d->thermal_stats = calloc(NC_THERMAL_BUFFER_SIZE + sizeof(float), 1);   //extra space for throttling level
+        if (!d->thermal_stats)
+            return NC_OUT_OF_MEMORY;
+    }
+    deviceCommand_t config;
+    config.type.c0 = CLASS0_THERMAL_STATS;
+    config.optionClass = NC_OPTION_CLASS0;
+    pthread_mutex_lock(&d->dev_stream_m);
+    if (XLinkWriteData(d->device_mon_stream_id, (const uint8_t *) &config,
+                       sizeof(config)) != 0) {
+        pthread_mutex_unlock(&d->dev_stream_m);
+        return NC_ERROR;
+    }
+    streamPacketDesc_t *packet;
+
+    if (XLinkReadData(d->device_mon_stream_id, &packet) != 0) {
+        pthread_mutex_unlock(&d->dev_stream_m);
+        return NC_ERROR;
+    }
+    pthread_mutex_unlock(&d->dev_stream_m);
+    if (packet->length != (NC_THERMAL_BUFFER_SIZE + sizeof(float))) {
+        return NC_ERROR;
+    }
+    memcpy(d->thermal_stats, packet->data, packet->length);
+    XLinkReleaseData(d->device_mon_stream_id);
+    return NC_OK;
+}
+
+static ncStatus_t deviceGetDeviceMemory(struct _devicePrivate_t *d,
+                                        uint32_t * mem)
+{
+    deviceCommand_t config;
+    config.type.c0 = CLASS0_DEVICE_USED_MEMORY;
+    config.optionClass = NC_OPTION_CLASS0;
+    pthread_mutex_lock(&d->dev_stream_m);
+    if (XLinkWriteData(d->device_mon_stream_id, (const uint8_t *) &config,
+                       sizeof(config)) != 0) {
+        pthread_mutex_unlock(&d->dev_stream_m);
+        return NC_ERROR;
+    }
+    streamPacketDesc_t *packet;
+
+    if (XLinkReadData(d->device_mon_stream_id, &packet) != 0) {
+        pthread_mutex_unlock(&d->dev_stream_m);
+        return NC_ERROR;
+    }
+    pthread_mutex_unlock(&d->dev_stream_m);
+    if (packet->length != (sizeof(uint32_t))) {
+        return NC_ERROR;
+    }
+    memcpy(mem, packet->data, packet->length);
+    XLinkReleaseData(d->device_mon_stream_id);
+    return NC_OK;
+}
+
+static int isDeviceOpened(const char *name)
+{
+    struct _devicePrivate_t *d = devices;
+    while (d) {
+        if (strcmp(d->dev_addr, name) == 0 ||
+            (d->dev_addr2 != NULL && strcmp(d->dev_addr2, name) == 0))
+            return 0;
+        d = d->next;
+    }
+    return -1;
+}
+
+ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t * deviceHandle)
+{
+    char mv_cmd_file_path[MAX_PATH_LENGTH], *p;
+    char mv_cmd_file_name[40] = "mvnc/MvNCAPI-maXXXX.mvcmd";
+    char name2[NC_MAX_NAME_SIZE] = "";
+
+    if (!deviceHandle || !deviceHandle->private_data) {
+        mvLog(MVLOG_ERROR, "Handle is NULL or has been destroyed");
+        return NC_INVALID_HANDLE;
+    }
+    struct _devicePrivate_t *d = deviceHandle->private_data;
+
+    pthread_mutex_lock(&globalMutex);
+    if (!initialized)
+        initialize();
+
+    // Search the mvnc executable in the same directory of this library, under mvnc
+    // in the future there will ideally be one FW file for all, for now they are seperate
+    sprintf(mv_cmd_file_name, "mvnc/MvNCAPI%s.mvcmd",
+            getProductName(d->dev_addr));
+#if (defined(_WIN32) || defined(_WIN64) )
+    HMODULE hm = NULL;
+    if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+                            GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
+                            (LPCSTR) "ncDeviceOpen", &hm)) {
+        int ret = GetLastError();
+        fprintf(stderr, "GetModuleHandle returned %d", ret);
+    }
+    GetModuleFileNameA(hm, mv_cmd_file_path, sizeof(mv_cmd_file_path));
+    p = strrchr(mv_cmd_file_path, '\\');
+#else
+    Dl_info info;
+    dladdr(ncDeviceOpen, &info);
+    strncpy(mv_cmd_file_path, info.dli_fname, sizeof(mv_cmd_file_path) - 40);
+    p = strrchr(mv_cmd_file_path, '/');
+#endif
+    if (p)
+        strcpy(p + 1, mv_cmd_file_name);
+    else
+        strcpy(mv_cmd_file_path, mv_cmd_file_name);
+
+    mvLog(MVLOG_DEBUG, "File path %s\n", mv_cmd_file_path);
+
+    int rc = XLinkBootRemote(d->dev_addr, mv_cmd_file_path);
+    if (rc)
+        mvLog(MVLOG_WARN, "%s() XLinkBootRemote returned error %d\n", __func__, rc);
+    else
+        mvLog(MVLOG_INFO, "%s() XLinkBootRemote returned success %d\n", __func__, rc);
+
+    double waittm = timeInSeconds() + STATUS_WAIT_TIMEOUT;
+    while (timeInSeconds() < waittm && rc == 0) {
+        XLinkHandler_t *handler = calloc(1, sizeof(XLinkHandler_t));
+
+        handler->devicePath = (char *) d->dev_addr;
+        rc = XLinkConnect(handler);
+        if (rc != X_LINK_SUCCESS) {
+            //we might fail in case name changed after boot
+            int count = 0;
+            while (1) {
+                name2[0] = '\0';
+                rc = XLinkGetDeviceName(count, name2, NC_MAX_NAME_SIZE);
+                if (rc != X_LINK_SUCCESS)
+                    break;
+                handler->devicePath = (char *) name2;
+                rc = XLinkConnect(handler);
+                if (isDeviceOpened(name2) < 0 && rc == X_LINK_SUCCESS) {
+                    break;
+                }
+                count++;
+            }
+        }
+
+        if (rc != X_LINK_SUCCESS) {
+            mvLog(MVLOG_WARN, "failed to find device\n");
+            return NC_ERROR;
+        }
+        mvLog(MVLOG_INFO, "XLinkConnect done - link Id %d\n", handler->linkId);
+
+        if (strlen(name2) > 0) {
+            d->dev_addr2 = strdup(name2);
+        }
+
+        d->usb_link = handler;
+        d->next = devices;
+        pthread_mutex_init(&d->dev_data_m, 0);
+        pthread_mutex_init(&d->dev_stream_m, 0);
+        pthread_mutex_init(&d->graph_streamm, 0);
+
+        devices = d;
+
+        mvLog(MVLOG_DEBUG, "done\n");
+        mvLog(MVLOG_INFO, "Booted %s -> %s\n",
+              d->dev_addr, d->dev_file ? d->dev_file : "VSC");
+        pthread_mutex_unlock(&globalMutex);
+        sleep(1);   //Allow device to initialize the XLink
+        streamId_t streamId = XLinkOpenStream(d->usb_link->linkId, "deviceMonitor",
+                                                CONFIG_STREAM_SIZE);
+        if (streamId == INVALID_STREAM_ID) {
+            mvLog(MVLOG_WARN, "can't open stream\n");
+            return NC_ERROR;
+        }
+        d->device_mon_stream_id = streamId;
+        getDevAttributes(d);
+
+
+        streamId = XLinkOpenStream(d->usb_link->linkId, "graphMonitor",
+                                    BLOB_STREAM_SIZE);
+        if (streamId == INVALID_STREAM_ID) {
+            mvLog(MVLOG_WARN, "can't open stream\n");
+            return NC_ERROR;
+        }
+        d->graph_monitor_stream_id = streamId;
+        d->state = NC_DEVICE_OPENED;
+        return NC_OK;
+    }
+
+    pthread_mutex_unlock(&globalMutex);
+    return NC_ERROR;
+}
+
+static int findDevice(struct _devicePrivate_t *deviceHandle)
+{
+
+    struct _devicePrivate_t *d = devices;
+
+    while (d) {
+        if (d == deviceHandle)
+            return 0;
+        d = d->next;
+    }
+
+    return -1;
+}
+
+static int deviceGetNumberOfGraphs(struct _devicePrivate_t *deviceHandle)
+{
+    if (deviceHandle == NULL)
+        return 0;
+    int num = 0;
+    struct _graphPrivate_t *g = deviceHandle->graphs;
+    while (g) {
+        num++;
+        g = g->next;
+    }
+    return num;
+}
+
+static int deviceGetNumberOfFifos(struct _devicePrivate_t *deviceHandle)
+{
+    if (deviceHandle == NULL)
+        return 0;
+    int num = 0;
+    struct _fifoPrivate_t *f = deviceHandle->fifos;
+    while (f) {
+        num++;
+        f = f->next;
+    }
+    return num;
+}
+
+static int findGraph(struct _graphPrivate_t *graphHandle)
+{
+    struct _devicePrivate_t *d = devices;
+
+    while (d) {
+        struct _graphPrivate_t *g = d->graphs;
+        while (g) {
+            if (g == graphHandle)
+                return 0;
+            g = g->next;
+        }
+        d = d->next;
+    }
+
+    return -1;
 }
 
 // Defined here as it will be used twice
-static int deallocate_graph(struct Graph *g)
-{
-       int found = 0;
-
-       // Remove it from the list of the associated device
-       if (g->dev->graphs == g) {
-               g->dev->graphs = g->next;
-               found = 1;
-       } else {
-               struct Graph *gp = g->dev->graphs;
-               while (gp->next) {
-                       if (gp->next == g) {
-                               found = 1;
-                               gp->next = gp->next->next;
-                               break;
-                       }
-                       gp = gp->next;
-               }
-       }
-
-       // Free it with all its data
-       if (found) {
-               free(g->aux_buffer);
-               free(g->output_data);
-               g->dev->thermal_stats = 0;
-               free(g);
-       }
-
-       return -!found;
-}
-
-mvncStatus mvncCloseDevice(void *deviceHandle)
-{
-       int found = 0;
-
-       if (!deviceHandle)
-               return MVNC_INVALID_PARAMETERS;
-
-       pthread_mutex_lock(&mm);
-       if (find_device(deviceHandle)) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       struct Device *d = (struct Device *) deviceHandle;
-       // Remove it from our list
-       if (devices == d) {
-               devices = d->next;
-               found = 1;
-       } else {
-               struct Device *dp = devices;
-               while (dp->next) {
-                       if (dp->next == d) {
-                               found = 1;
-                               dp->next = dp->next->next;
-                               break;
-                       }
-                       dp = dp->next;
-               }
-       }
-
-       if (!found) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-       // Deallocate all associated graphs
-       pthread_mutex_lock(&d->mm);
-       while (d->graphs)
-               deallocate_graph(d->graphs);
-
-       // Reset
-       usblink_resetmyriad(d->usb_link);
-       usblink_close(d->usb_link);
-       if (d->optimisation_list)
-               free(d->optimisation_list);
-
-       free(d->dev_addr);
-       free(d->dev_file);
-       pthread_mutex_unlock(&d->mm);
-       pthread_mutex_destroy(&d->mm);
-       free(d);
-       pthread_mutex_unlock(&mm);
-
-       usleep(500000);
-       return MVNC_OK;
-}
-
-static unsigned read_32bits(const unsigned char *ptr)
-{
-       return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
-}
-
-
-mvncStatus mvncAllocateGraph(void *deviceHandle, void **graphHandle,
-                              const void *graphFile, unsigned int graphFileLength)
-{
-       if (!deviceHandle || !graphHandle || !graphFile)
-               return MVNC_INVALID_PARAMETERS;
-
-       if (graphFileLength < HEADER_LENGTH + STAGE_LENGTH ||
-           graphFileLength > 512 * 1024 * 1024)
-               return MVNC_UNSUPPORTED_GRAPH_FILE;
-
-       unsigned char *graph = (unsigned char *) graphFile;
-       if (graph[VERSION_OFFSET] != GRAPH_VERSION)
-               return MVNC_UNSUPPORTED_GRAPH_FILE;
-
-       unsigned nstages = graph[N_STAGES_OFFSET] + (graph[N_STAGES_OFFSET + 1] << 8);
-       unsigned noutputs = read_32bits(graph + N_OUTPUTS_OFFSET +
-                                    (nstages - 1) * STAGE_LENGTH) *
-                                               read_32bits(graph + N_OUTPUTS_OFFSET +
-                                    (nstages - 1) * STAGE_LENGTH + 4) *
-                                               read_32bits(graph + X_OUT_STRIDE_OFFSET +
-                                    (nstages - 1) * STAGE_LENGTH) / 2;
-
-       // A reasonable check on graph correctness
-       if (noutputs > 64 * 1024 * 1024)
-               return MVNC_UNSUPPORTED_GRAPH_FILE;
-
-       pthread_mutex_lock(&mm);
-       struct Device *d = devices;
-       while (d) {
-               if (d == deviceHandle)
-                       break;
-               d = d->next;
-       }
-
-       if (!d) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       if (d->graphs) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_BUSY;
-       }
-
-       myriadStatus_t status;
-       double timeout = time_in_seconds() + 10;
-       do {
-               if (usblink_getmyriadstatus(d->usb_link, &status)) {
-                       pthread_mutex_unlock(&mm);
-                       return MVNC_ERROR;
-               }
-               usleep(10000);
-       } while (status != MYRIAD_WAITING && time_in_seconds() < timeout);
-
-       if (status != MYRIAD_WAITING) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_ERROR;
-       }
-
-       if (usblink_setdata(d->usb_link, "blobFile", graphFile, graphFileLength, 0)) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_ERROR;
-       }
-
-       struct Graph *g = calloc(1, sizeof(*g));
-       g->dev = d;
-       g->nstages = nstages;
-       g->noutputs = noutputs;
-
-       // aux_buffer
-       g->aux_buffer = calloc(1, 224 + nstages * sizeof(*g->time_taken));
-       if (!g->aux_buffer) {
-               free(g);
-               pthread_mutex_unlock(&mm);
-               return MVNC_OUT_OF_MEMORY;
-       }
-
-       if (usblink_setdata(g->dev->usb_link, "auxBuffer", g->aux_buffer,
-                           224 + nstages * sizeof(*g->time_taken), 0)) {
-               free(g->aux_buffer);
-               free(g);
-               pthread_mutex_unlock(&mm);
-               return MVNC_ERROR;
-       }
-
-       g->debug_buffer = g->aux_buffer;
-       g->time_taken = (float *) (g->aux_buffer + 224);
-
-       // output_data
-       g->output_data = calloc(noutputs, 2);
-       if (!g->output_data) {
-               free(g->aux_buffer);
-               free(g);
-               pthread_mutex_unlock(&mm);
-               return MVNC_OUT_OF_MEMORY;
-       }
-
-       g->dev->thermal_stats = (float *) (g->aux_buffer + DEBUG_BUFFER_SIZE);
-
-       g->iterations = 1;
-       g->network_throttle = 1;
-       if (d->graphs)
-               g->next = d->graphs;
-       d->graphs = g;
-       *graphHandle = g;
-       pthread_mutex_unlock(&mm);
-       return MVNC_OK;
-}
-
-mvncStatus mvncDeallocateGraph(void *graphHandle)
-{
-       if (!graphHandle)
-               return MVNC_INVALID_PARAMETERS;
-
-       pthread_mutex_lock(&mm);
-       if (find_graph(graphHandle)) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       struct Device *d = ((struct Graph *) graphHandle)->dev;
-
-       pthread_mutex_lock(&d->mm);
-       if (deallocate_graph((struct Graph *) graphHandle)) {
-               pthread_mutex_unlock(&d->mm);
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       pthread_mutex_unlock(&d->mm);
-       pthread_mutex_unlock(&mm);
-       return MVNC_OK;
-}
-
-mvncStatus mvncSetGraphOption(void *graphHandle, int option, const void *data,
-                             unsigned int dataLength)
-{
-       if (!graphHandle || !data || dataLength != 4)
-               return MVNC_INVALID_PARAMETERS;
-
-       struct Graph *g = (struct Graph *) graphHandle;
-       pthread_mutex_lock(&mm);
-       if (find_graph(graphHandle)) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       pthread_mutex_lock(&g->dev->mm);
-       pthread_mutex_unlock(&mm);
-       switch (option) {
-       case MVNC_ITERATIONS:
-               g->iterations = *(int *) data;
-               break;
-       case MVNC_NETWORK_THROTTLE:
-               g->network_throttle = *(int *) data;
-               break;
-       case MVNC_DONT_BLOCK:
-               g->dont_block = *(int *) data;
-               break;
-       default:
-               pthread_mutex_unlock(&g->dev->mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       pthread_mutex_unlock(&g->dev->mm);
-       return MVNC_OK;
-}
-
-mvncStatus mvncGetGraphOption(void *graphHandle, int option, void *data,
-                             unsigned int *dataLength)
-{
-       if (!graphHandle || !data || !dataLength)
-               return MVNC_INVALID_PARAMETERS;
-
-       struct Graph *g = (struct Graph *) graphHandle;
-       pthread_mutex_lock(&mm);
-       if (find_graph(graphHandle)) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       pthread_mutex_lock(&g->dev->mm);
-       pthread_mutex_unlock(&mm);
-       switch (option) {
-       case MVNC_ITERATIONS:
-               *(int *) data = g->iterations;
-               *dataLength = sizeof(int);
-               break;
-       case MVNC_NETWORK_THROTTLE:
-               *(int *) data = g->network_throttle;
-               *dataLength = sizeof(int);
-               break;
-       case MVNC_DONT_BLOCK:
-               *(int *) data = g->dont_block;
-
-               *dataLength = sizeof(int);
-               break;
-       case MVNC_TIME_TAKEN:
-               *(float **) data = g->time_taken;
-               *dataLength = sizeof(*g->time_taken) * g->nstages;
-               break;
-       case MVNC_DEBUG_INFO:
-               *(char **) data = g->debug_buffer;
-               *dataLength = DEBUG_BUFFER_SIZE;
-               break;
-       default:
-               pthread_mutex_unlock(&g->dev->mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       pthread_mutex_unlock(&g->dev->mm);
-       return MVNC_OK;
-}
-
-mvncStatus mvncSetGlobalOption(int option, const void *data,
-                              unsigned int dataLength)
-{
-       if (!data || dataLength != 4)
-               return MVNC_INVALID_PARAMETERS;
-
-       switch (option) {
-       case MVNC_LOG_LEVEL:
-               mvnc_loglevel = *(int *) data;
-               break;
-       default:
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       return MVNC_OK;
-}
-
-mvncStatus mvncGetGlobalOption(int option, void *data, unsigned int *dataLength)
-{
-       if (!data || !dataLength)
-               return MVNC_INVALID_PARAMETERS;
-
-       switch (option) {
-       case MVNC_LOG_LEVEL:
-               *(int *) data = mvnc_loglevel;
-               *dataLength = sizeof(mvnc_loglevel);
-               break;
-       default:
-               return MVNC_INVALID_PARAMETERS;
-       }
-       return MVNC_OK;
-}
-
-mvncStatus mvncSetDeviceOption(void *deviceHandle, int option, const void *data,
-                              unsigned int dataLength)
-{
-       if (deviceHandle == 0 && option == MVNC_LOG_LEVEL) {
-               PRINT("Warning: MVNC_LOG_LEVEL is not a Device Option, \
-                please use mvncSetGlobalOption()!\n");
-               return mvncSetGlobalOption(option, data, dataLength);
-       }
-
-       if (!deviceHandle || !data || dataLength != 4)
-               return MVNC_INVALID_PARAMETERS;
-
-       struct Device *d = (struct Device *) deviceHandle;
-       pthread_mutex_lock(&mm);
-       if (find_device(d)) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       pthread_mutex_lock(&d->mm);
-       pthread_mutex_unlock(&mm);
-       switch (option) {
-       case MVNC_TEMP_LIM_LOWER:
-               d->temp_lim_lower = *(float *) data;
-               break;
-       case MVNC_TEMP_LIM_HIGHER:
-               d->temp_lim_upper = *(float *) data;
-               break;
-       case MVNC_BACKOFF_TIME_NORMAL:
-               d->backoff_time_normal = *(int *) data;
-               break;
-       case MVNC_BACKOFF_TIME_HIGH:
-               d->backoff_time_high = *(int *) data;
-               break;
-       case MVNC_BACKOFF_TIME_CRITICAL:
-               d->backoff_time_critical = *(int *) data;
-               break;
-       case MVNC_TEMPERATURE_DEBUG:
-               d->temperature_debug = *(int *) data;
-               break;
-       default:
-               pthread_mutex_unlock(&d->mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-       pthread_mutex_unlock(&d->mm);
-
-       return MVNC_OK;
-}
-
-static mvncStatus get_optimisation_list(struct Device *d)
-{
-       int i, config[10];
-       double timeout;
-       myriadStatus_t status;
-       char *p;
-
-       if (d->optimisation_list)
-               return MVNC_OK;
-
-       d->optimisation_list = calloc(OPTIMISATION_LIST_BUFFER_SIZE, 1);
-       if (!d->optimisation_list)
-               return MVNC_OUT_OF_MEMORY;
-
-       memset(config, 0, sizeof(config));
-       config[0] = 1;
-       config[1] = 1;
-       if (usblink_setdata(d->usb_link, "config", config, sizeof(config), 1))
-               return MVNC_ERROR;
-
-       timeout = time_in_seconds() + STATUS_WAIT_TIMEOUT;
-       do {
-               if (usblink_getmyriadstatus(d->usb_link, &status))
-                       return MVNC_ERROR;
-               usleep(10000);
-       } while (status != MYRIAD_WAITING &&
-                status != MYRIAD_FINISHED && time_in_seconds() < timeout);
-
-       if (status != MYRIAD_WAITING && status != MYRIAD_FINISHED)
-               return MVNC_TIMEOUT;
-
-       if (usblink_getdata(d->usb_link, "optimizationList",
-                           d->optimisation_list, OPTIMISATION_LIST_BUFFER_SIZE, 0, 0))
-               return MVNC_ERROR;
-
-       for (i = 0; i < MAX_OPTIMISATIONS; i++) {
-               p = strchr(d->optimisation_list + i * OPTIMISATION_NAME_LEN, '~');
-               if (p)
-                       *p = 0;
-       }
-
-       config[1] = 0;
-       if (usblink_setdata(d->usb_link, "config", config, sizeof(config), 0))
-               return MVNC_ERROR;
-       return MVNC_OK;
-}
-
-mvncStatus mvncGetDeviceOption(void *deviceHandle, int option, void *data,
-                              unsigned int *dataLength)
-{
-       mvncStatus rc;
-
-       if (deviceHandle == 0 && option == MVNC_LOG_LEVEL) {
-               PRINT("Warning: MVNC_LOG_LEVEL is not a Device Option, \
-                 please use mvncGetGlobalOption()!\n");
-               return mvncGetGlobalOption(option, data, dataLength);
-       }
-
-       if (!deviceHandle || !data || !dataLength)
-               return MVNC_INVALID_PARAMETERS;
-
-       struct Device *d = (struct Device *) deviceHandle;
-       pthread_mutex_lock(&mm);
-       if (find_device(d)) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       pthread_mutex_lock(&d->mm);
-       pthread_mutex_unlock(&mm);
-       switch (option) {
-       case MVNC_TEMP_LIM_LOWER:
-               *(float *) data = d->temp_lim_lower;
-               *dataLength = sizeof(int);
-               break;
-       case MVNC_TEMP_LIM_HIGHER:
-               *(float *) data = d->temp_lim_upper;
-               *dataLength = sizeof(int);
-               break;
-       case MVNC_BACKOFF_TIME_NORMAL:
-               *(int *) data = d->backoff_time_normal;
-               *dataLength = sizeof(int);
-               break;
-       case MVNC_BACKOFF_TIME_HIGH:
-               *(int *) data = d->backoff_time_high;
-               *dataLength = sizeof(int);
-               break;
-       case MVNC_BACKOFF_TIME_CRITICAL:
-               *(int *) data = d->backoff_time_critical;
-               *dataLength = sizeof(int);
-               break;
-       case MVNC_TEMPERATURE_DEBUG:
-               *(int *) data = d->temperature_debug;
-               *dataLength = sizeof(int);
-               break;
-       case MVNC_THERMAL_STATS:
-               if (!d->thermal_stats) {
-                       pthread_mutex_unlock(&d->mm);
-                       return MVNC_NO_DATA;
-               }
-               *(float **) data = d->thermal_stats;
-               *dataLength = THERMAL_BUFFER_SIZE;
-               break;
-       case MVNC_OPTIMISATION_LIST:
-               rc = get_optimisation_list(d);
-               if (rc) {
-                       pthread_mutex_unlock(&d->mm);
-                       return rc;
-               }
-               *(char **) data = d->optimisation_list;
-               *dataLength = OPTIMISATION_LIST_BUFFER_SIZE;
-               break;
-       case MVNC_THERMAL_THROTTLING_LEVEL:
-               *(int *) data = d->throttle_happened;
-               *dataLength = sizeof(int);
-               break;
-       default:
-               pthread_mutex_unlock(&d->mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-       pthread_mutex_unlock(&d->mm);
-
-       return MVNC_OK;
-}
-
-static int send_opt_data(struct Graph *g)
-{
-       int config[10];
-
-       config[0] = 1;          // Version
-       config[1] = 0;          // Query disable
-       config[2] = g->iterations;
-       config[3] = g->dev->temp_lim_upper;
-       config[4] = g->dev->temp_lim_lower;
-       config[5] = g->dev->backoff_time_normal;
-       config[6] = g->dev->backoff_time_high;
-       config[7] = g->dev->backoff_time_critical;
-       config[8] = g->dev->temperature_debug;
-       config[9] = g->network_throttle;
-
-       if (usblink_setdata(g->dev->usb_link, "config", config, sizeof(config), 0))
-               return MVNC_ERROR;
-
-       return MVNC_OK;
-}
-
-mvncStatus mvncLoadTensor(void *graphHandle, const void *inputTensor,
-                         unsigned int inputTensorLength, void *userParam)
-{
-       if (!graphHandle || !inputTensor || inputTensorLength < 2)
-               return MVNC_INVALID_PARAMETERS;
-
-       struct Graph *g = (struct Graph *) graphHandle;
-       pthread_mutex_lock(&mm);
-       if (find_graph(graphHandle)) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       if (!g->started) {
-               if (send_opt_data(g)) {
-                       pthread_mutex_unlock(&mm);
-                       return MVNC_ERROR;
-               }
-               g->started = 1;
-       }
-
-       while (g->have_data == 2) {
-               if (g->dont_block) {
-                       pthread_mutex_unlock(&mm);
-                       return MVNC_BUSY;
-               }
-               if (g->failed) {
-                       pthread_mutex_unlock(&mm);
-                       return MVNC_ERROR;
-               }
-               pthread_mutex_unlock(&mm);
-               usleep(1000);
-               pthread_mutex_lock(&mm);
-               if (find_graph(g)) {
-                       pthread_mutex_unlock(&mm);
-                       return MVNC_GONE;
-               }
-       }
-       pthread_mutex_lock(&g->dev->mm);
-       pthread_mutex_unlock(&mm);
-
-       if (usblink_setdata(g->dev->usb_link, g->input_idx ? "input2" : "input1",
-            inputTensor, inputTensorLength, g->have_data == 0)) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_ERROR;
-       }
-
-       g->user_param[g->input_idx] = userParam;
-       g->input_idx = !g->input_idx;
-       g->have_data++;
-       pthread_mutex_unlock(&g->dev->mm);
-       return MVNC_OK;
-}
-
-mvncStatus mvncGetResult(void *graphHandle, void **outputData,
-                        unsigned int *outputDataLength, void **userParam)
-{
-       int rc, unlock_own = 0;
-
-       if (!graphHandle || !outputData || !outputDataLength)
-               return MVNC_INVALID_PARAMETERS;
-
-       struct Graph *g = (struct Graph *) graphHandle;
-       pthread_mutex_lock(&mm);
-       if (find_graph(graphHandle)) {
-               pthread_mutex_unlock(&mm);
-               return MVNC_INVALID_PARAMETERS;
-       }
-
-       while (!g->have_data) {
-               if (g->dont_block) {
-                       pthread_mutex_unlock(&mm);
-                       return MVNC_NO_DATA;
-               }
-               pthread_mutex_unlock(&mm);
-               usleep(1000);
-               pthread_mutex_lock(&mm);
-               if (find_graph(g)) {
-                       pthread_mutex_unlock(&mm);
-                       return MVNC_GONE;
-               }
-       }
-
-       double timeout = time_in_seconds() + STATUS_WAIT_TIMEOUT;
-       do {
-               pthread_mutex_lock(&g->dev->mm);
-               pthread_mutex_unlock(&mm);
-               if (!usblink_getdata(g->dev->usb_link, "output", g->output_data,
-                                    2 * g->noutputs, 0, 0)) {
-                       unsigned int length = DEBUG_BUFFER_SIZE + THERMAL_BUFFER_SIZE +
-                            sizeof(int) + sizeof(*g->time_taken) * g->nstages;
-
-                       if (usblink_getdata(g->dev->usb_link, "auxBuffer", g->aux_buffer,
-                            length, 0, g->have_data == 2)) {
-                               g->failed = 1;
-                               pthread_mutex_unlock(&g->dev->mm);
-                               return MVNC_ERROR;
-                       }
-                       unlock_own = 1;
-                       break;
-               }
-               pthread_mutex_unlock(&g->dev->mm);
-               usleep(1000);
-               pthread_mutex_lock(&mm);
-               if (find_graph(g)) {
-                       pthread_mutex_unlock(&mm);
-                       return MVNC_GONE;
-               }
-       } while (time_in_seconds() < timeout);
-
-       g->dev->throttle_happened = *(int *) (g->aux_buffer + DEBUG_BUFFER_SIZE
-                                               + THERMAL_BUFFER_SIZE);
-       *outputData = g->output_data;
-       *outputDataLength = 2 * g->noutputs;
-       *userParam = g->user_param[g->output_idx];
-       g->output_idx = !g->output_idx;
-       g->have_data--;
-
-       if (unlock_own) {
-               rc = *g->debug_buffer ? MVNC_MYRIAD_ERROR : MVNC_OK;
-               if (rc)
-                       g->failed = 1;
-               pthread_mutex_unlock(&g->dev->mm);
-       } else {
-               rc = MVNC_TIMEOUT;
-               g->failed = 1;
-               pthread_mutex_unlock(&mm);
-       }
-
-       return rc;
+static int deallocateGraph(struct _graphPrivate_t *g)
+{
+    int found = 0;
+
+    // Remove it from the list of the associated device
+    if (g->dev->graphs == g) {
+        g->dev->graphs = g->next;
+        found = 1;
+    } else {
+        struct _graphPrivate_t *gp = g->dev->graphs;
+        while (gp->next) {
+            if (gp->next == g) {
+                found = 1;
+                gp->next = gp->next->next;
+                break;
+            }
+            gp = gp->next;
+        }
+    }
+
+    // Free it with all its data
+    if (found) {
+        if (g->dev->thermal_stats)
+            free(g->dev->thermal_stats);
+        g->dev->thermal_stats = 0;
+        free(g);
+    }
+
+    return -!found;
+}
+
+static int findFifo(struct _fifoPrivate_t *f)
+{
+    if (!f || !f->dev)
+        return 0;
+
+    if (f->dev->fifos == f) {
+        return 1;
+    } else {
+        struct _fifoPrivate_t *fp = f->dev->fifos;
+        while (fp->next) {
+            if (fp->next == f) {
+                return 1;
+            }
+            fp = fp->next;
+        }
+    }
+    return 0;
+}
+
+static int deallocateFifo(struct _fifoPrivate_t *f)
+{
+    int found = 0;
+    // Remove it from the list of the associated device
+    if (f->dev->fifos == f) {
+        f->dev->fifos = f->next;
+        found = 1;
+    } else {
+        struct _fifoPrivate_t *fp = f->dev->fifos;
+        while (fp->next) {
+            if (fp->next == f) {
+                found = 1;
+                fp->next = fp->next->next;
+                break;
+            }
+            fp = fp->next;
+        }
+    }
+
+    // Free it with all its data
+    if (found) {
+        //deallocate on device
+        XLinkCloseStream(f->streamId);
+        struct _userParamPrivate_t *temp;
+        while (f->user_param_in) {
+            temp = f->user_param_in;
+            f->user_param_in = f->user_param_in->next;
+            free(temp);
+        }
+        while (f->user_param_out) {
+            temp = f->user_param_out;
+            f->user_param_out = f->user_param_out->next;
+            free(temp);
+        }
+    }
+
+    return -!found;
+}
+
+ncStatus_t ncDeviceClose(struct ncDeviceHandle_t * deviceHandle)
+{
+    int found = 0;
+
+    if (!deviceHandle) {
+        mvLog(MVLOG_ERROR, "handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+
+    pthread_mutex_lock(&globalMutex);
+    if (findDevice(deviceHandle->private_data)) {
+        mvLog(MVLOG_ERROR, "handle is corrupt or has been destroyed");
+        pthread_mutex_unlock(&globalMutex);
+        return NC_INVALID_HANDLE;
+    }
+    mvLog(MVLOG_INFO, "closing device\n");
+
+    struct _devicePrivate_t *d = deviceHandle->private_data;
+    // Remove it from our list
+    if (devices == d) {
+        devices = d->next;
+        found = 1;
+    } else {
+        struct _devicePrivate_t *dp = devices;
+        while (dp->next) {
+            if (dp->next == d) {
+                found = 1;
+                dp->next = dp->next->next;
+                break;
+            }
+            dp = dp->next;
+        }
+    }
+
+    if (!found) {
+        pthread_mutex_unlock(&globalMutex);
+        return NC_INVALID_PARAMETERS;
+    }
+    // Deallocate all associated graphs
+    pthread_mutex_lock(&d->dev_data_m);
+    if (d->graphs) {
+        mvLog(MVLOG_WARN,
+              "Graphs on the device hasn't been destroyed! Graphs will be deallocated");
+        while (d->graphs) {
+            deallocateGraph(d->graphs);
+        }
+    }
+    // Deallocate all associated fifos
+    if (d->fifos) {
+        mvLog(MVLOG_WARN,
+              "Fifos on the device hasn't been destroyed! Fifos will be deallocated");
+        while (d->fifos) {
+            deallocateFifo(d->fifos);
+        }
+    }
+    if (d->device_mon_stream_id != INVALID_LINK_ID)
+        XLinkCloseStream(d->device_mon_stream_id);
+    if (d->graph_monitor_stream_id != INVALID_LINK_ID)
+        XLinkCloseStream(d->graph_monitor_stream_id);
+    d->device_mon_stream_id = INVALID_LINK_ID;
+    d->graph_monitor_stream_id = INVALID_LINK_ID;
+
+    // Reset
+    XLinkResetRemote(d->usb_link->linkId);
+
+//  usblink_resetmyriad(d->usb_link);
+//  usblink_close(d->usb_link);
+
+    pthread_mutex_destroy(&d->dev_stream_m);
+    pthread_mutex_destroy(&d->graph_streamm);
+    pthread_mutex_destroy(&d->dev_data_m);
+    if (d->optimisation_list)
+        free(d->optimisation_list);
+    d->state = NC_DEVICE_CLOSED;
+    free(d->dev_file);
+    free(d->dev_addr2);
+    d->dev_addr2 = NULL;
+    pthread_mutex_unlock(&globalMutex);
+
+#if (!defined(_WIN32) && !defined(_WIN64) )
+    usleep(500000); //device takes some time to re-enumrate, wait till it's back
+#endif
+    return NC_OK;
+}
+
+ncStatus_t ncDeviceDestroy(struct ncDeviceHandle_t ** deviceHandle)
+{
+    if (!deviceHandle) {
+        mvLog(MVLOG_ERROR, "handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (!(*deviceHandle)) {
+        mvLog(MVLOG_INFO, "handle already destroyed");
+        return NC_OK;
+    }
+
+    struct _devicePrivate_t *d = (*deviceHandle)->private_data;
+    if (!d) {
+        mvLog(MVLOG_ERROR, "device has been destroyed");
+        return NC_INVALID_HANDLE;
+    }
+    //If only created we still delete everything below
+    mvLog(MVLOG_INFO, "Destroying Device\n");
+    if (d->state == NC_DEVICE_OPENED) {
+        ncStatus_t rc = ncDeviceClose((*deviceHandle));
+        if (rc)
+            return rc;
+    }
+    pthread_mutex_lock(&globalMutex);
+    free(d->dev_addr);
+    free(d);
+    (*deviceHandle)->private_data = NULL;
+    free((*deviceHandle));
+    *deviceHandle = NULL;
+    pthread_mutex_unlock(&globalMutex);
+    return NC_OK;
+}
+
+ncStatus_t ncGraphCreate(const char *name,
+                         struct ncGraphHandle_t ** graphHandle)
+{
+    if (!loglevel_initialized)
+        initialize_loglevel();
+
+    if (!graphHandle) {
+        mvLog(MVLOG_ERROR, "Graph handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (!name) {
+        mvLog(MVLOG_ERROR, "name is NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+    struct ncGraphHandle_t *gH = calloc(1, sizeof(*gH));
+    struct _graphPrivate_t *g = calloc(1, sizeof(*g));
+    gH->private_data = g;
+    strncpy(g->name, name, NC_MAX_NAME_SIZE);
+    g->batch_size = 1;
+    g->dev = NULL;
+    g->executors_number = 1;
+    g->started = 0;
+    g->state = NC_GRAPH_CREATED;
+    *graphHandle = gH;
+    return NC_OK;
+}
+
+ncStatus_t sendGraphMonitorRequest(streamId_t graphMonStream,
+                                   graphMonCommand_t * cmd)
+{
+    if (XLinkWriteData(graphMonStream, (uint8_t *) cmd, sizeof(*cmd)) != 0) {
+        return NC_ERROR;
+    }
+    return NC_OK;
+}
+
+ncStatus_t checkGraphMonitorResponse(streamId_t graphMonStream)
+{
+    streamPacketDesc_t *ack;
+    if (XLinkReadData(graphMonStream, &ack) != 0) {
+        mvLog(MVLOG_ERROR, "XLink error");
+        return NC_ERROR;
+    }
+    int value = *((int *) ack->data);
+    if (XLinkReleaseData(graphMonStream) != 0) {
+        mvLog(MVLOG_ERROR, "XLink error");
+        return NC_ERROR;
+    }
+    if (value != 0) {
+        mvLog(MVLOG_WARN, "Graph monitor request returned error");
+
+        return NC_MYRIAD_ERROR;
+    }
+
+    return NC_OK;
+}
+
+ncStatus_t ncGraphAllocate(struct ncDeviceHandle_t * deviceHandle,
+                           struct ncGraphHandle_t * graphHandle,
+                           const void *graphBuffer,
+                           unsigned int graphBufferLength)
+{
+    ncStatus_t rc = NC_OK;
+    mvLog(MVLOG_INFO, "Starting Graph allocation sequence\n");
+    if (!graphHandle || !deviceHandle) {
+        mvLog(MVLOG_ERROR, "Graph or device handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (!graphBuffer) {
+        mvLog(MVLOG_ERROR, "graphBuffer is NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+    static int graphIdCount = 0;
+    struct _graphPrivate_t *g = graphHandle->private_data;
+
+    struct _devicePrivate_t *d = devices;
+    if (graphBufferLength > d->dev_attr.max_memory) {
+        mvLog(MVLOG_ERROR, "The graph file is bigger than the device memory");
+        return NC_OUT_OF_MEMORY;
+    }
+
+    pthread_mutex_lock(&globalMutex);
+    while (d) {
+        if (d == deviceHandle->private_data)
+            break;
+        d = d->next;
+    }
+
+    if (!d) {
+        pthread_mutex_unlock(&globalMutex);
+        mvLog(MVLOG_ERROR, "Device not found!");
+        return NC_INVALID_PARAMETERS;
+    }
+    pthread_mutex_unlock(&globalMutex);
+
+    g->id = graphIdCount++;
+    streamId_t streamId;
+
+    if (g->executors_number > d->dev_attr.max_executors) {
+        mvLog(MVLOG_ERROR, "Executors number is greater than max allowed!");
+        return NC_INVALID_PARAMETERS;
+    }
+
+    graphMonCommand_t cmd;
+    cmd.cmdClass = GRAPH_MON_CLASS_GRAPH_CMD;
+    cmd.cmd.graphCmd.type = GRAPH_ALLOCATE_CMD;
+    snprintf(cmd.cmd.graphCmd.streamName, 16, "graphBuffer%d", g->id);
+    streamId = XLinkOpenStream(d->usb_link->linkId, cmd.cmd.graphCmd.streamName,
+                                graphBufferLength);
+    if (streamId == INVALID_STREAM_ID) {
+        mvLog(MVLOG_WARN, "can't open stream for graphBuffer transmission");
+        return NC_ERROR;
+    }
+    cmd.cmd.graphCmd.id = g->id;
+    cmd.cmd.graphCmd.executors_number = g->executors_number;
+
+    pthread_mutex_lock(&d->graph_streamm);
+
+    if (sendGraphMonitorRequest(d->graph_monitor_stream_id, &cmd)) {
+        mvLog(MVLOG_WARN, "can't send graph allocation command");
+        pthread_mutex_lock(&d->graph_streamm);
+        return NC_ERROR;
+    }
+    if (XLinkWriteData(streamId, graphBuffer, graphBufferLength) != 0) {
+        mvLog(MVLOG_WARN, "can't send graph data to device");
+        pthread_mutex_unlock(&d->graph_streamm);
+        return NC_ERROR;
+    }
+    mvLog(MVLOG_INFO, "Sent graph");
+    streamPacketDesc_t *tensorDescIn;
+    streamPacketDesc_t *tensorDescOut;
+    streamPacketDesc_t *nstages;
+    streamPacketDesc_t *blob_version;
+
+    streamPacketDesc_t *status;
+    int graphStatus = -1;
+    //Check for graph error
+    if (XLinkReadData(streamId, &status) != 0) {
+        mvLog(MVLOG_WARN, "can't read graph status");
+        pthread_mutex_unlock(&d->graph_streamm);
+        return NC_ERROR;
+    }
+    if (!status) {
+        mvLog(MVLOG_ERROR, "Couldn't read graph status!\n");
+        rc = NC_MYRIAD_ERROR;
+    } else {
+        graphStatus = *(unsigned int *) status->data;
+        if (graphStatus != NC_GRAPH_OK) {
+            rc = NC_MYRIAD_ERROR;
+        }
+    }
+
+    XLinkReleaseData(streamId);
+    mvLog(MVLOG_DEBUG, "Graph Status %d rc %d \n", graphStatus, rc);
+
+    if (!rc) {
+        XLinkReadData(streamId, &tensorDescIn);
+        XLinkReadData(streamId, &tensorDescOut);
+        XLinkReadData(streamId, &nstages);
+        XLinkReadData(streamId, &blob_version);
+
+
+        //for now, supoprt only count 1
+        if (!tensorDescIn ||
+            tensorDescIn->length % sizeof(struct tensorDescriptor_t) ||
+            tensorDescIn->length / sizeof(struct tensorDescriptor_t) > 1) {
+            mvLog(MVLOG_ERROR,
+                  "Input tensor descriptors of the graph are invalid\n");
+            mvLog(MVLOG_ERROR, "Received data from graph %d\n",
+                  *(int *) tensorDescIn->data);
+            rc = NC_MYRIAD_ERROR;
+        }
+        //for now, supoprt only count 1
+        if (!tensorDescOut ||
+            tensorDescOut->length % sizeof(struct tensorDescriptor_t) ||
+            tensorDescOut->length / sizeof(struct tensorDescriptor_t) > 1) {
+            mvLog(MVLOG_ERROR,
+                  "Output tensor descriptors of the graph are invalid\n");
+            rc = NC_MYRIAD_ERROR;
+        }
+        if (!blob_version || blob_version->length != sizeof(g->blob_version)) {
+            mvLog(MVLOG_ERROR, "graph version is invalid blob_version \n");
+            if (blob_version)
+                mvLog(MVLOG_ERROR, "blob_version->length %d expecting %d\n",
+                      blob_version->length, sizeof(g->blob_version));
+
+            rc = NC_MYRIAD_ERROR;
+        }
+        if (rc == NC_OK) {
+            g->input_count =
+                tensorDescIn->length / sizeof(struct tensorDescriptor_t);
+            memcpy(&g->input_tensor_desc, tensorDescIn->data,
+                   sizeof(struct tensorDescriptor_t));
+            g->output_count =
+                tensorDescOut->length / sizeof(struct tensorDescriptor_t);
+            memcpy(&g->output_tensor_desc, tensorDescOut->data,
+                   sizeof(struct tensorDescriptor_t));
+            g->nstages = *(uint32_t *) nstages->data;
+            memcpy(&g->blob_version, blob_version->data,
+                   sizeof(g->blob_version));
+        }
+
+        XLinkReleaseData(streamId);
+        XLinkReleaseData(streamId);
+        XLinkReleaseData(streamId);
+        XLinkReleaseData(streamId);
+
+        g->graph_stream_id = streamId;
+    }
+    if (checkGraphMonitorResponse(d->graph_monitor_stream_id)) {
+        mvLog(MVLOG_WARN, "The device didn't accept the graph\n");
+        if (graphStatus != NC_GRAPH_OK) {
+            if (graphStatus == NC_GRAPH_WRONG_INPUT_FORMAT) {
+                mvLog(MVLOG_WARN, "graph file version is incompatible\n");
+                pthread_mutex_unlock(&d->graph_streamm);
+                return NC_UNSUPPORTED_GRAPH_FILE;
+            } else {
+                rc = NC_MYRIAD_ERROR;
+            }
+        }
+        uint32_t memory_used;
+        uint32_t length;
+        ncDeviceGetOption(deviceHandle, NC_RO_DEVICE_CURRENT_MEMORY_USED,
+                          &memory_used, &length);
+        uint32_t remaining_memory = d->dev_attr.max_memory - memory_used;
+        mvLog(MVLOG_INFO, "Remaining device memory %d\n", remaining_memory);
+
+        if (remaining_memory < 2 * graphBufferLength) {
+            mvLog(MVLOG_WARN,
+                  "Remaining device memory (%d) is not enough for graph file (%d)\n",
+                  remaining_memory, graphBufferLength);
+        }
+        pthread_mutex_unlock(&d->graph_streamm);
+        return NC_ERROR;
+    }
+    if (rc) {
+        return rc;
+    }
+
+    pthread_mutex_unlock(&d->graph_streamm);
+
+    pthread_mutex_lock(&globalMutex);
+    g->dev = d;
+
+    if (d->graphs)
+        g->next = d->graphs;
+    d->graphs = g;
+    g->state = NC_GRAPH_ALLOCATED;
+    pthread_mutex_unlock(&globalMutex);
+    mvLog(MVLOG_INFO, "Graph allocation completed successfully\n");
+
+    return NC_OK;
+}
+
+ncStatus_t ncGraphDestroy(struct ncGraphHandle_t ** graphHandle)
+{
+    if (!graphHandle) {
+        mvLog(MVLOG_ERROR, "graph handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    struct ncGraphHandle_t *gh = *graphHandle;
+    if (!gh) {
+        mvLog(MVLOG_INFO, "handle is already destroyed");
+        return NC_OK;
+    }
+    struct _graphPrivate_t *g = gh->private_data;
+    if (!g) {
+        mvLog(MVLOG_ERROR, "graph handle is corrupt or has been destroyed");
+        return NC_INVALID_HANDLE;
+    }
+    if (g->state == NC_GRAPH_CREATED) {
+        free(g);
+        gh->private_data = NULL;
+        free(gh);
+        *graphHandle = NULL;
+        return NC_OK;
+    }
+    pthread_mutex_lock(&globalMutex);
+    if (findGraph(g)) {
+        pthread_mutex_unlock(&globalMutex);
+        mvLog(MVLOG_ERROR, "This graph is corrupt or has been destroyed");
+        return NC_INVALID_HANDLE;
+    }
+
+    pthread_mutex_unlock(&globalMutex);
+    struct _devicePrivate_t *d = (gh->private_data)->dev;
+
+    graphMonCommand_t cmd;
+    cmd.cmdClass = GRAPH_MON_CLASS_GRAPH_CMD;
+    cmd.cmd.graphCmd.type = GRAPH_DEALLOCATE_CMD;
+    cmd.cmd.graphCmd.id = g->id;
+    pthread_mutex_lock(&d->graph_streamm);
+    if (sendGraphMonitorRequest(d->graph_monitor_stream_id, &cmd)) {
+        return NC_ERROR;
+    }
+    if (checkGraphMonitorResponse(d->graph_monitor_stream_id)) {
+        return NC_ERROR;
+    }
+    XLinkCloseStream(g->graph_stream_id);
+    pthread_mutex_unlock(&d->graph_streamm);
+    pthread_mutex_lock(&d->dev_data_m);
+    if (deallocateGraph(gh->private_data)) {
+        mvLog(MVLOG_ERROR, "This graph has already been destroyed");
+        pthread_mutex_unlock(&d->dev_data_m);
+        return NC_INVALID_PARAMETERS;
+    }
+    pthread_mutex_unlock(&d->dev_data_m);
+    gh->private_data = NULL;
+    free(gh);
+    *graphHandle = NULL;
+    return NC_OK;
+}
+
+static ncStatus_t setGraphOptionClass1(struct _graphPrivate_t *g,
+                                       ncGraphOption_t option,
+                                       const void *data,
+                                       unsigned int dataLength)
+{
+    if (dataLength < sizeof(int)) {
+        mvLog(MVLOG_ERROR, "The dataLength is smaller that required %d",
+              sizeof(int));
+        return NC_INVALID_DATA_LENGTH;
+    }
+    switch (option) {
+    case NC_RW_GRAPH_EXECUTORS_NUM:
+        if (g->state != NC_GRAPH_CREATED) {
+            mvLog(MVLOG_ERROR, "Can't set NCE number after graph allocation");
+            return NC_UNAUTHORIZED;
+        }
+        g->executors_number = *(int *) data;;
+        break;
+    default:
+        mvLog(MVLOG_ERROR, "There is no such option in class 1");
+        return NC_INVALID_PARAMETERS;
+    }
+    return NC_OK;
+}
+
+static int isGraphPreAllocateOption(int option)
+{
+    switch (option) {
+    case NC_RO_GRAPH_NAME:
+    case NC_RO_GRAPH_STATE:
+    case NC_RW_GRAPH_EXECUTORS_NUM:
+        return 1;
+    default:
+        return 0;
+    }
+}
+
+ncStatus_t ncGraphSetOption(struct ncGraphHandle_t * graphHandle,
+                            int option, const void *data,
+                            unsigned int dataLength)
+{
+    if (!data) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+    if (!graphHandle || !graphHandle->private_data) {
+        mvLog(MVLOG_ERROR, "graph handle is NULL or has been destroyed");
+        return NC_INVALID_HANDLE;
+    }
+    if (option < GRAPH_CLASS0_BASE ||
+        option > (GRAPH_CLASS0_BASE + OPTION_CLASS_SIZE * NC_OPTION_CLASS3)) {
+        mvLog(MVLOG_ERROR, "Option %d is invalid", option);
+        return NC_INVALID_PARAMETERS;
+    }
+    if (option >= GRAPH_CLASS0_BASE &&
+        option <= (GRAPH_CLASS0_BASE + OPTION_CLASS_SIZE)) {
+        mvLog(MVLOG_ERROR, "Option %d is read only", option);
+        return NC_UNAUTHORIZED;
+    }
+    struct _graphPrivate_t *g = graphHandle->private_data;
+    pthread_mutex_lock(&globalMutex);
+    if (isGraphPreAllocateOption(option) && g->state != NC_GRAPH_CREATED) {
+        mvLog(MVLOG_ERROR,
+              "This graph has already been alocated - cannot set option");
+        pthread_mutex_unlock(&globalMutex);
+        return NC_UNAUTHORIZED;
+    }
+    if (!isGraphPreAllocateOption(option) && g->state == NC_GRAPH_CREATED) {
+        mvLog(MVLOG_ERROR,
+              "This graph hasn't been allocated - cannot set option");
+        pthread_mutex_unlock(&globalMutex);
+        return NC_UNAUTHORIZED;
+    }
+    if (!isGraphPreAllocateOption(option) && findGraph(g)) {
+        mvLog(MVLOG_ERROR, "This graph is corrupt or has been destroyed");
+        pthread_mutex_unlock(&globalMutex);
+        return NC_INVALID_HANDLE;
+    }
+    pthread_mutex_unlock(&globalMutex);
+    //we check what we can at this point, later we might fail if
+    //user set a class that was not permitted
+    ncOptionClass_t opClass = getOptionClass(option, GRAPH_CLASS0_BASE);
+    if (g->dev != NULL && opClass > g->dev->dev_attr.max_graph_opt_class) {
+        mvLog(MVLOG_ERROR, "This device FW does not support NC_OPTION_CLASS%d",
+              opClass);
+        return NC_UNAUTHORIZED;
+    }
+    ncStatus_t rc;
+    switch (opClass) {
+    case NC_OPTION_CLASS0:
+        mvLog(MVLOG_ERROR, "Option is read-only");
+        rc = NC_UNAUTHORIZED;   // option class 0 consists of read-only value
+        break;
+    case NC_OPTION_CLASS1:
+        rc = setGraphOptionClass1(g, option, data, dataLength);
+        break;
+    case NC_OPTION_CLASS2:
+        rc = setGraphOptionClass2(g, option, data, dataLength);
+        break;
+    case NC_OPTION_CLASS3:
+        rc = setGraphOptionClass3(g, option, data, dataLength);
+        break;
+    default:
+        mvLog(MVLOG_ERROR, "There is no such option class");
+        rc = NC_INVALID_PARAMETERS;
+        break;
+    }
+    return rc;
+}
+
+static ncStatus_t getGraphOptionClass0(struct _graphPrivate_t *g,
+                                       ncGraphOption_t option,
+                                       void *data, unsigned int *dataLength)
+{
+    if ((option == NC_RO_GRAPH_STATE ||
+         option == NC_RO_GRAPH_INPUT_COUNT ||
+         option == NC_RO_GRAPH_OUTPUT_COUNT ||
+         option == NC_RO_GRAPH_OPTION_CLASS_LIMIT ||
+         option == NC_RW_GRAPH_EXECUTORS_NUM) && *dataLength < sizeof(int)) {
+        mvLog(MVLOG_ERROR,
+              "data length of data (%d) is smaller that required (%d)!\n",
+              *dataLength, sizeof(int));
+        *dataLength = sizeof(int);
+        return NC_INVALID_DATA_LENGTH;
+    }
+
+    graphMonCommand_t cmd;
+    streamPacketDesc_t *pack;
+    cmd.cmdClass = GRAPH_MON_CLASS_GET_CLASS0;
+
+    switch (option) {
+    case NC_RO_GRAPH_STATE:
+        if (g->state == NC_GRAPH_CREATED ||
+            (g->state == NC_GRAPH_ALLOCATED && !g->started)) {
+            *(int *) data = g->state;
+        } else {
+            //it has been started we must read from graph
+            cmd.cmd.optionCmd.type.c0 = CLASS0_STATE;
+            cmd.cmd.optionCmd.id = g->id;
+            pthread_mutex_lock(&g->dev->graph_streamm);
+            if (XLinkWriteData(g->dev->graph_monitor_stream_id,
+                               (const uint8_t *) &cmd, sizeof(cmd)) != 0) {
+                pthread_mutex_unlock(&g->dev->graph_streamm);
+                return NC_ERROR;
+            }
+
+            if (XLinkReadData(g->dev->graph_monitor_stream_id, &pack)) {
+                pthread_mutex_unlock(&g->dev->graph_streamm);
+                return NC_ERROR;
+            }
+
+            if (pack->length != sizeof(graphState_t)) {
+                pthread_mutex_unlock(&g->dev->graph_streamm);
+                XLinkReleaseData(g->dev->graph_monitor_stream_id);
+                return NC_ERROR;
+            }
+            int state = *(int *) pack->data;
+            XLinkReleaseData(g->dev->graph_monitor_stream_id);
+            if (checkGraphMonitorResponse(g->dev->graph_monitor_stream_id)) {
+                pthread_mutex_unlock(&g->dev->graph_streamm);
+                return NC_ERROR;
+            }
+            pthread_mutex_unlock(&g->dev->graph_streamm);
+            if (state == GRAPH_RUNNING)
+                g->state = NC_GRAPH_RUNNING;
+            else
+                g->state = NC_GRAPH_WAITING_FOR_BUFFERS;
+            *(int *) data = g->state;
+        }
+        *dataLength = sizeof(ncGraphState_t);
+        break;
+    case NC_RO_GRAPH_INPUT_COUNT:
+        *(int *) data = g->input_count;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_GRAPH_OUTPUT_COUNT:
+        *(int *) data = g->output_count;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_GRAPH_TIME_TAKEN_ARRAY_SIZE:
+        *(int *) data = sizeof(float) * g->nstages;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_GRAPH_TIME_TAKEN:
+        if (*dataLength < sizeof(float) * g->nstages) {
+            mvLog(MVLOG_ERROR,
+                  "data length of output buffer (%d) is smaller that required (%d)!\n",
+                  *dataLength, sizeof(float) * g->nstages);
+            *dataLength = sizeof(float) * g->nstages;
+            return NC_INVALID_DATA_LENGTH;
+        }
+        cmd.cmd.optionCmd.id = g->id;
+        cmd.cmd.optionCmd.type.c0 = CLASS0_TIMING_DATA;
+        pthread_mutex_lock(&g->dev->graph_streamm);
+        if (sendGraphMonitorRequest(g->dev->graph_monitor_stream_id, &cmd)) {
+            pthread_mutex_unlock(&g->dev->graph_streamm);
+            return NC_ERROR;
+        }
+        if (XLinkReadData(g->dev->graph_monitor_stream_id, &pack)) {
+            pthread_mutex_unlock(&g->dev->graph_streamm);
+            return NC_ERROR;
+        }
+        if (pack->length != sizeof(float) * g->nstages) {
+            pthread_mutex_unlock(&g->dev->graph_streamm);
+
+            XLinkReleaseData(g->dev->graph_monitor_stream_id);
+            return NC_ERROR;
+        }
+        //Need to copy data before we check the response, since checkGraphMonitorResponse
+        //calls releaseData
+        memcpy((float *) data, pack->data, pack->length);
+        XLinkReleaseData(g->dev->graph_monitor_stream_id);
+
+        if (checkGraphMonitorResponse(g->dev->graph_monitor_stream_id)) {
+            pthread_mutex_unlock(&g->dev->graph_streamm);
+            return NC_ERROR;
+        }
+
+        pthread_mutex_unlock(&g->dev->graph_streamm);
+        *dataLength = sizeof(float) * g->nstages;
+        break;
+    case NC_RO_GRAPH_DEBUG_INFO:
+        if (*dataLength < NC_DEBUG_BUFFER_SIZE) {
+            mvLog(MVLOG_ERROR,
+                  "data length of output buffer (%d) is smaller that required (%d)!\n",
+                  *dataLength, NC_DEBUG_BUFFER_SIZE);
+            *dataLength = NC_DEBUG_BUFFER_SIZE;
+            return NC_INVALID_DATA_LENGTH;
+        }
+
+        cmd.cmd.optionCmd.type.c0 = CLASS0_DEBUG_DATA;
+        cmd.cmd.optionCmd.id = g->id;
+        pthread_mutex_lock(&g->dev->graph_streamm);
+        if (XLinkWriteData(g->dev->graph_monitor_stream_id, (const uint8_t *) &cmd,
+             sizeof(cmd)) != 0) {
+            pthread_mutex_unlock(&g->dev->graph_streamm);
+            return NC_ERROR;
+        }
+
+        if (XLinkReadData(g->dev->graph_monitor_stream_id, &pack)) {
+            pthread_mutex_unlock(&g->dev->graph_streamm);
+            return NC_ERROR;
+        }
+
+        if (pack->length != NC_DEBUG_BUFFER_SIZE) {
+            pthread_mutex_unlock(&g->dev->graph_streamm);
+            XLinkReleaseData(g->dev->graph_monitor_stream_id);
+            return NC_ERROR;
+        }
+
+        memcpy((char *) data, pack->data, pack->length);
+        XLinkReleaseData(g->dev->graph_monitor_stream_id);
+        if (checkGraphMonitorResponse(g->dev->graph_monitor_stream_id)) {
+            pthread_mutex_unlock(&g->dev->graph_streamm);
+            return NC_ERROR;
+        }
+        pthread_mutex_unlock(&g->dev->graph_streamm);
+
+        *dataLength = NC_DEBUG_BUFFER_SIZE;
+        break;
+    case NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS:{
+            unsigned int size =
+                sizeof(struct ncTensorDescriptor_t) * g->input_count;
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            memcpy((struct ncTensorDescriptor_t *) data, &g->input_tensor_desc,
+                   size);
+            *dataLength = size;
+            break;
+        }
+    case NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS:{
+            unsigned int size =
+                sizeof(struct ncTensorDescriptor_t) * g->output_count;
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            memcpy((struct ncTensorDescriptor_t *) data, &g->output_tensor_desc,
+                   size);
+            *dataLength = size;
+            break;
+        }
+    case NC_RO_GRAPH_NAME:
+        if (*dataLength < strlen(g->name) + 1) {
+            mvLog(MVLOG_ERROR,
+                  "data length of output buffer (%d) is smaller that required (%d)!\n",
+                  *dataLength, strlen(g->name) + 1);
+            *dataLength = strlen(g->name) + 1;
+            return NC_INVALID_DATA_LENGTH;
+        }
+        *dataLength = strlen(g->name) + 1;
+        strncpy((char *) data, g->name, *dataLength);
+        break;
+    case NC_RO_GRAPH_OPTION_CLASS_LIMIT:
+        *(int *) data = g->dev->dev_attr.max_graph_opt_class;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_GRAPH_VERSION:{
+            unsigned int size = sizeof(g->blob_version);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            memcpy((int *) data, g->blob_version, size);
+            *dataLength = size;
+            break;
+        }
+    default:
+        mvLog(MVLOG_ERROR, "There is no such option in class 0");
+        return NC_INVALID_PARAMETERS;
+    }
+    return NC_OK;
+}
+
+static ncStatus_t getGraphOptionClass1(struct _graphPrivate_t *g,
+                                       ncGraphOption_t option,
+                                       void *data, unsigned int *dataLength)
+{
+    switch (option) {
+    case NC_RW_GRAPH_EXECUTORS_NUM:{
+            int size = sizeof(int);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of data (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            *(int *) data = g->executors_number;
+            *dataLength = size;
+            break;
+        }
+    default:
+        mvLog(MVLOG_ERROR, "There is no such option in class 1");
+        return NC_INVALID_PARAMETERS;
+    }
+    return NC_OK;
+}
+
+ncStatus_t ncGraphGetOption(struct ncGraphHandle_t * graphHandle,
+                            int option, void *data, unsigned int *dataLength)
+{
+    if (!graphHandle || !graphHandle->private_data) {
+        mvLog(MVLOG_ERROR, "The graph handle is NULL or have been destroyed");
+        return NC_INVALID_HANDLE;
+    }
+    if (!dataLength || (*dataLength != 0 && !data)) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+
+    if (option < GRAPH_CLASS0_BASE ||
+        option > (GRAPH_CLASS0_BASE + OPTION_CLASS_SIZE * NC_OPTION_CLASS3)) {
+        mvLog(MVLOG_ERROR, "Option %d is invalid", option);
+        return NC_INVALID_PARAMETERS;
+    }
+
+    struct _graphPrivate_t *g = graphHandle->private_data;
+
+    pthread_mutex_lock(&globalMutex);
+    if (!isGraphPreAllocateOption(option) && g->state == NC_GRAPH_CREATED) {
+        mvLog(MVLOG_ERROR, "This graph hasn't been allocated");
+        pthread_mutex_unlock(&globalMutex);
+        return NC_NOT_ALLOCATED;
+    }
+    ncOptionClass_t class = getOptionClass(option, GRAPH_CLASS0_BASE);
+    if (g->dev != NULL && class > g->dev->dev_attr.max_graph_opt_class) {
+        mvLog(MVLOG_ERROR, "This device FW does not support NC_OPTION_CLASS%d",
+              class);
+        return NC_UNAUTHORIZED;
+    }
+    pthread_mutex_unlock(&globalMutex);
+    ncStatus_t rc;
+    switch (class) {
+    case NC_OPTION_CLASS0:
+        rc = getGraphOptionClass0(g, option, data, dataLength);
+        break;
+    case NC_OPTION_CLASS1:
+        rc = getGraphOptionClass1(g, option, data, dataLength);
+        break;
+    case NC_OPTION_CLASS2:
+        rc = getGraphOptionClass2(g, option, data, dataLength);
+        break;
+    case NC_OPTION_CLASS3:
+        rc = getGraphOptionClass3(g, option, data, dataLength);
+        break;
+    default:
+        mvLog(MVLOG_ERROR, "There is no such option class");
+        rc = NC_INVALID_PARAMETERS;
+        break;
+    }
+    return rc;
+}
+
+ncStatus_t ncGraphAllocateWithFifos(struct ncDeviceHandle_t * deviceHandle,
+                                    struct ncGraphHandle_t * graphHandle,
+                                    const void *graphBuffer,
+                                    unsigned int graphBufferLength,
+                                    struct ncFifoHandle_t ** inFifoHandle,
+                                    struct ncFifoHandle_t ** outFifoHandle)
+{
+    return ncGraphAllocateWithFifosEx(deviceHandle,
+                                      graphHandle, graphBuffer,
+                                      graphBufferLength, inFifoHandle,
+                                      NC_FIFO_HOST_WO, 2, NC_FIFO_FP32,
+                                      outFifoHandle, NC_FIFO_HOST_RO, 2,
+                                      NC_FIFO_FP32);
+}
+
+ncStatus_t ncGraphAllocateWithFifosEx(struct ncDeviceHandle_t * deviceHandle,
+                                      struct ncGraphHandle_t * graphHandle,
+                                      const void *graphBuffer,
+                                      unsigned int graphBufferLength,
+                                      struct ncFifoHandle_t ** inFifoHandle,
+                                      ncFifoType_t inFifoType, int inNumElem,
+                                      ncFifoDataType_t inDataType,
+                                      struct ncFifoHandle_t ** outFifoHandle,
+                                      ncFifoType_t outFifoType, int outNumElem,
+                                      ncFifoDataType_t outDataType)
+{
+    if (!inFifoHandle || !inNumElem || !outFifoHandle || !outNumElem ||
+        !graphHandle || !deviceHandle || !graphBuffer) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL or Zero!");
+        return NC_INVALID_PARAMETERS;
+    }
+    ncStatus_t rc = ncGraphAllocate(deviceHandle, graphHandle, graphBuffer,
+                                    graphBufferLength);
+    if (rc != NC_OK)
+        return rc;
+
+    if (inFifoType == NC_FIFO_HOST_RO) {
+        mvLog(MVLOG_ERROR, "input fifo cannot be read-only");
+        return NC_INVALID_PARAMETERS;
+    }
+    if (outFifoType == NC_FIFO_HOST_WO) {
+        mvLog(MVLOG_ERROR, "output fifo cannot be write-only");
+        return NC_INVALID_PARAMETERS;
+    }
+    // Read tensor descriptors
+    struct ncTensorDescriptor_t inputTensorDesc;
+    struct ncTensorDescriptor_t outputTensorDesc;
+    unsigned int length = sizeof(struct ncTensorDescriptor_t);
+    rc = ncGraphGetOption(graphHandle,
+                          NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS,
+                          &inputTensorDesc, &length);
+    if (rc != NC_OK) {
+        return rc;
+    }
+    rc = ncGraphGetOption(graphHandle,
+                          NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS,
+                          &outputTensorDesc, &length);
+    if (rc != NC_OK) {
+        return rc;
+    }
+    rc = ncFifoCreate("fifoIn0", inFifoType, inFifoHandle);
+    if (rc != NC_OK) {
+        return rc;
+    }
+    rc = ncFifoSetOption(*inFifoHandle, NC_RW_FIFO_DATA_TYPE, &inDataType,
+                         sizeof(inDataType));
+    if (rc != NC_OK) {
+        return rc;
+    }
+    rc = ncFifoAllocate(*inFifoHandle, deviceHandle, &inputTensorDesc,
+                        inNumElem);
+    if (rc != NC_OK) {
+        return rc;
+    }
+    rc = ncFifoCreate("fifoOut0", outFifoType, outFifoHandle);
+    if (rc != NC_OK) {
+        ncFifoDestroy(inFifoHandle);
+        return rc;
+    }
+    rc = ncFifoSetOption(*outFifoHandle, NC_RW_FIFO_DATA_TYPE, &outDataType,
+                         sizeof(outDataType));
+    if (rc != NC_OK) {
+        ncFifoDestroy(inFifoHandle);
+        ncFifoDestroy(outFifoHandle);
+        return rc;
+    }
+    rc = ncFifoAllocate(*outFifoHandle, deviceHandle, &outputTensorDesc,
+                        outNumElem);
+    if (rc != NC_OK) {
+        ncFifoDestroy(inFifoHandle);
+        ncFifoDestroy(outFifoHandle);
+        return rc;
+    }
+    return rc;
+}
+
+ncStatus_t ncGlobalSetOption(int option, const void *data,
+                             unsigned int dataLength)
+{
+    if (!data) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+    if (option == NC_RW_LOG_LEVEL && dataLength < sizeof(int)) {
+        mvLog(MVLOG_ERROR, "The dataLength is smaller that required %d",
+              sizeof(int));
+        return NC_INVALID_PARAMETERS;
+    }
+    switch (option) {
+    case NC_RW_LOG_LEVEL:
+        {
+            mvLog_t log_level = *(mvLog_t *) data;
+            if (log_level >= MVLOG_LAST || log_level < 0) {
+                mvLog(MVLOG_ERROR, "log_level value is invalid %d\n",
+                      log_level);
+                return NC_INVALID_PARAMETERS;
+            }
+            mvLogLevelSet(*(mvLog_t *) data);
+            mvLogDefaultLevelSet(*(mvLog_t *) data);    //Allow turning off warnings and errors
+            loglevel_initialized = 1;
+        }
+        break;
+    case NC_RO_API_VERSION:
+        return NC_UNAUTHORIZED;
+        break;
+    default:
+        mvLog(MVLOG_ERROR, "No such option");
+        return NC_INVALID_PARAMETERS;
+    }
+
+    return NC_OK;
+}
+
+ncStatus_t ncGlobalGetOption(int option, void *data, unsigned int *dataLength)
+{
+    if (!loglevel_initialized)
+        initialize_loglevel();
+
+    if (!dataLength || (*dataLength != 0 && !data)) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+    if (option == NC_RW_LOG_LEVEL && *dataLength < sizeof(int)) {
+        mvLog(MVLOG_ERROR, "The dataLength is smaller that required %d",
+              sizeof(int));
+        *dataLength = sizeof(int);
+        return NC_INVALID_DATA_LENGTH;
+    }
+    switch (option) {
+    case NC_RW_LOG_LEVEL:
+        *(int *) data = mvLogLevel_ncAPI;
+        *dataLength = sizeof(mvLogLevel_ncAPI);
+        break;
+    case NC_RO_API_VERSION:{
+            // We sanitize the situation by trying to reset the devices that have been left open
+            if (api_version[0] == 0 && strlen(VERSION_NAME) != 0) {
+                int res =
+                    sscanf(VERSION_NAME, "%2d.%2d.%2d.%2d", &api_version[0],
+                           &api_version[1], &api_version[2], &api_version[3]);
+                if (res != 4)
+                    mvLog(MVLOG_WARN, "Error parsing api version\n");
+                else
+                    mvLog(MVLOG_DEBUG, "api version %d.%d.%d.%d\n",
+                          api_version[0], api_version[1], api_version[2],
+                          api_version[3]);
+            }
+            unsigned int size = sizeof(api_version);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            memcpy((int *) data, api_version, size);
+            *dataLength = size;
+            break;
+        }
+    default:
+        mvLog(MVLOG_ERROR, "No such option");
+        return NC_INVALID_PARAMETERS;
+    }
+    return NC_OK;
+}
+
+
+static ncStatus_t getDeviceOptionClass0(struct _devicePrivate_t *d,
+                                        ncDeviceOption_t option,
+                                        void *data, unsigned int *dataLength)
+{
+    ncStatus_t rc = NC_OK;
+
+    //*dataLength check
+    switch (option) {
+    case NC_RO_DEVICE_STATE:
+    case NC_RO_DEVICE_ALLOCATED_GRAPH_NUM:
+    case NC_RO_DEVICE_ALLOCATED_FIFO_NUM:
+    case NC_RO_DEVICE_MEMORY_SIZE:
+    case NC_RO_DEVICE_MAX_FIFO_NUM:
+    case NC_RO_DEVICE_MAX_GRAPH_NUM:
+    case NC_RO_DEVICE_OPTION_CLASS_LIMIT:
+    case NC_RO_DEVICE_THERMAL_THROTTLING_LEVEL:
+    case NC_RO_DEVICE_CURRENT_MEMORY_USED:
+    case NC_RO_DEVICE_MAX_EXECUTORS_NUM:
+        {
+            unsigned int size = sizeof(int);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+        }
+        break;
+    default:
+        break;
+    }
+    switch (option) {
+    case NC_RO_DEVICE_THERMAL_STATS:
+        if (*dataLength < NC_THERMAL_BUFFER_SIZE) {
+            mvLog(MVLOG_ERROR,
+                  "data length of output buffer (%d) is smaller that required (%d)!\n",
+                  *dataLength, NC_THERMAL_BUFFER_SIZE);
+            *dataLength = NC_THERMAL_BUFFER_SIZE;
+            return NC_INVALID_DATA_LENGTH;
+        }
+        rc = getThermalStats(d);
+        if (rc) {
+            return rc;
+        }
+        memcpy((float *) data, &d->thermal_stats[1], NC_THERMAL_BUFFER_SIZE);
+        *dataLength = NC_THERMAL_BUFFER_SIZE;
+        break;
+    case NC_RO_DEVICE_THERMAL_THROTTLING_LEVEL:
+        rc = getThermalStats(d);
+        if (rc) {
+            return rc;
+        }
+        d->throttle_happened = d->thermal_stats[0];
+        *(int *) data = d->throttle_happened;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_DEVICE_STATE:
+        *(int *) data = d->state;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_DEVICE_ALLOCATED_GRAPH_NUM:
+        *(int *) data = deviceGetNumberOfGraphs(d);
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_DEVICE_ALLOCATED_FIFO_NUM:
+        *(int *) data = deviceGetNumberOfFifos(d);
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_DEVICE_MEMORY_SIZE:
+        *(int *) data = d->dev_attr.max_memory;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_DEVICE_MAX_FIFO_NUM:
+        *(int *) data = d->dev_attr.max_fifos;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_DEVICE_MAX_GRAPH_NUM:
+        *(int *) data = d->dev_attr.max_graphs;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_DEVICE_OPTION_CLASS_LIMIT:
+        *(int *) data = d->dev_attr.max_device_opt_class;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_DEVICE_NAME:
+        if (*dataLength < strlen(d->dev_addr) + 1) {
+            mvLog(MVLOG_ERROR,
+                  "data length of output buffer (%d) is smaller that required (%d)!\n",
+                  *dataLength, d->dev_addr + 1);
+            *dataLength = strlen(d->dev_addr) + 1;
+            return NC_INVALID_DATA_LENGTH;
+        }
+        *dataLength = strlen(d->dev_addr) + 1;
+        strncpy((char *) data, d->dev_addr, *dataLength);
+        break;
+    case NC_RO_DEVICE_HW_VERSION:{
+            unsigned int size = sizeof(ncDeviceHwVersion_t);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            char *p = strchr(d->dev_addr, '-');
+            if (p == NULL) {
+                mvLog(MVLOG_WARN, "Error device name is invalid %s\n",
+                      d->dev_addr);
+                rc = NC_INVALID_PARAMETERS;
+                break;
+            }
+            p++;    //advance to point to the name
+
+            if (strcmp("ma2450", p) == 0) {
+                *(int *) data = NC_MA2450;
+            } else if (strcmp("ma2480", p) == 0) {
+                *(int *) data = NC_MA2480;
+            } else {
+                rc = NC_INVALID_PARAMETERS;
+                mvLog(MVLOG_WARN, "Error device name is invalid %s , %s\n",
+                      d->dev_addr);
+                break;
+            }
+            *dataLength = size;
+            break;
+        }
+    case NC_RO_DEVICE_FW_VERSION:{
+            unsigned int size = sizeof(d->dev_attr.fw_version);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            memcpy((int *) data, d->dev_attr.fw_version, size);
+            *dataLength = size;
+            break;
+        }
+    case NC_RO_DEVICE_CURRENT_MEMORY_USED:{
+            uint32_t mem;
+            if (deviceGetDeviceMemory(d, &mem)) {
+                rc = NC_ERROR;
+                break;
+            }
+            *(int *) data = mem;
+            *dataLength = sizeof(int);
+            break;
+        }
+    case NC_RO_DEVICE_MAX_EXECUTORS_NUM:
+        *(int *) data = d->dev_attr.max_executors;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_DEVICE_MVTENSOR_VERSION:{
+            unsigned int size = sizeof(d->dev_attr.mv_tensor_version);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            memcpy((int *) data, d->dev_attr.mv_tensor_version, size);
+            *dataLength = size;
+            break;
+        }
+    case NC_RO_DEVICE_DEBUG_INFO:
+        return NC_UNSUPPORTED_FEATURE;
+    default:
+        mvLog(MVLOG_ERROR, "No such option");
+        return NC_INVALID_PARAMETERS;
+    }
+    return rc;
+}
+
+ncStatus_t ncDeviceSetOption(struct ncDeviceHandle_t * deviceHandle,
+                             int option,
+                             const void *data, unsigned int dataLength)
+{
+    ncStatus_t rc = NC_OK;
+
+    if (!deviceHandle) {
+        mvLog(MVLOG_ERROR, "handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (!data) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+
+    if (option < DEVICE_CLASS0_BASE ||
+        option > (DEVICE_CLASS0_BASE + OPTION_CLASS_SIZE * NC_OPTION_CLASS3)) {
+        mvLog(MVLOG_ERROR, "Option %d is invalid", option);
+        return NC_INVALID_PARAMETERS;
+    }
+
+    ncOptionClass_t opClass = getOptionClass(option, DEVICE_CLASS0_BASE);
+    if (opClass < NC_OPTION_CLASS1) {
+        mvLog(MVLOG_ERROR, "Class 0 options are read-only");
+        return NC_UNAUTHORIZED;
+    }
+    struct _devicePrivate_t *d = deviceHandle->private_data;
+    pthread_mutex_lock(&globalMutex);
+    if (findDevice(d)) {
+        mvLog(MVLOG_ERROR,
+              "This device handle is corrupt or has been destroyed");
+        pthread_mutex_unlock(&globalMutex);
+
+        return NC_INVALID_HANDLE;
+    }
+    pthread_mutex_unlock(&globalMutex);
+    if (opClass > d->dev_attr.max_device_opt_class) {
+        mvLog(MVLOG_ERROR, "This device FW does not support NC_OPTION_CLASS%d",
+              opClass);
+        return NC_UNAUTHORIZED;
+    }
+    //DataLen will be tested in the specific class, since it varies based on option
+    //type
+
+    switch (opClass) {
+    case NC_OPTION_CLASS0:
+        mvLog(MVLOG_ERROR, "Class 0 options are read-only");
+        rc = NC_UNAUTHORIZED;   // option class 0 consists of read-only value
+        break;
+        //no class1 - no write options for device
+    case NC_OPTION_CLASS2:
+        rc = setDeviceOptionClass2(d, option, data, dataLength);
+        break;
+    case NC_OPTION_CLASS3:
+        rc = setDeviceOptionClass3(d, option, data, dataLength);
+        break;
+    default:
+        rc = NC_INVALID_PARAMETERS;
+        break;
+    }
+    return rc;
+}
+
+//static options can be read before device is open
+static int isDeviceStaticOption(int option)
+{
+    switch (option) {
+    case NC_RO_DEVICE_NAME:
+    case NC_RO_DEVICE_STATE:
+    case NC_RO_DEVICE_HW_VERSION:
+        return 1;
+    default:
+        return 0;
+    }
+}
+
+ncStatus_t ncDeviceGetOption(struct ncDeviceHandle_t * deviceHandle,
+                             int option, void *data, unsigned int *dataLength)
+{
+    ncStatus_t rc;
+
+    if (!deviceHandle) {
+        mvLog(MVLOG_ERROR, "Device handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (!deviceHandle || !dataLength || (*dataLength != 0 && !data)) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+
+
+    if (option < DEVICE_CLASS0_BASE ||
+        option > (DEVICE_CLASS0_BASE + OPTION_CLASS_SIZE * NC_OPTION_CLASS3)) {
+        mvLog(MVLOG_ERROR, "Option %d is invalid", option);
+        return NC_INVALID_PARAMETERS;
+    }
+
+    struct _devicePrivate_t *d = deviceHandle->private_data;
+
+    pthread_mutex_lock(&globalMutex);
+    if (!isDeviceStaticOption(option) && d->state != NC_DEVICE_OPENED) {
+        mvLog(MVLOG_ERROR, "This device hasn't been openned");
+        pthread_mutex_unlock(&globalMutex);
+        return NC_UNAUTHORIZED;
+    }
+
+    ncOptionClass_t opClass = getOptionClass(option, DEVICE_CLASS0_BASE);
+    if (!isDeviceStaticOption(option)) {
+        if (findDevice(d)) {
+            mvLog(MVLOG_ERROR,
+                  "This device handle is corrupt or has been destroyed");
+            pthread_mutex_unlock(&globalMutex);
+            return NC_INVALID_HANDLE;
+        }
+
+        if (d->dev_attr.max_device_opt_class < opClass) {
+            mvLog(MVLOG_ERROR,
+                  "This device FW does not support NC_OPTION_CLASS%d", opClass);
+            pthread_mutex_unlock(&globalMutex);
+            return NC_UNAUTHORIZED;
+        }
+    }
+    pthread_mutex_unlock(&globalMutex);
+
+    switch (opClass) {
+    case NC_OPTION_CLASS0:
+        rc = getDeviceOptionClass0(d, option, data, dataLength);
+        break;
+        //no class1 - no write options for device
+    case NC_OPTION_CLASS2:
+        rc = getDeviceOptionClass2(d, option, data, dataLength);
+        break;
+    case NC_OPTION_CLASS3:
+        rc = getDeviceOptionClass3(d, option, data, dataLength);
+        break;
+    default:
+        rc = NC_INVALID_PARAMETERS;
+        break;
+    }
+    return rc;
+}
+
+static int fifoWriteAccess(struct _fifoPrivate_t *fifoHandle)
+{
+    if (fifoHandle->type == NC_FIFO_HOST_WO) {
+        return 1;
+    }
+    return 0;
+}
+
+static int fifoReadAccess(struct _fifoPrivate_t *fifoHandle)
+{
+    if (fifoHandle->type == NC_FIFO_HOST_RO) {
+        return 1;
+    }
+    return 0;
+}
+
+ncStatus_t ncFifoCreate(const char *name, ncFifoType_t type,
+                        struct ncFifoHandle_t ** fifoHandle)
+{
+    mvLog(MVLOG_INFO, "Init fifo");
+    if (!loglevel_initialized)
+        initialize_loglevel();
+
+    if (!fifoHandle) {
+        mvLog(MVLOG_ERROR, "Fifo handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+
+    if (!name) {
+        mvLog(MVLOG_ERROR, "name is NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+
+    if (type != NC_FIFO_HOST_RO && type != NC_FIFO_HOST_WO) {
+        mvLog(MVLOG_ERROR, "Fifo typo not supported!");
+        return NC_UNSUPPORTED_FEATURE;
+    }
+    static int fifoIdCounter = 0;
+    *fifoHandle = (struct ncFifoHandle_t *) malloc(sizeof(struct ncFifoHandle_t));
+    if (!(*fifoHandle)) {
+        mvLog(MVLOG_ERROR, "Memory allocation failed");
+        return NC_OUT_OF_MEMORY;
+    }
+
+    struct _fifoPrivate_t *handle = (struct _fifoPrivate_t *) malloc(sizeof(struct _fifoPrivate_t));
+    (*fifoHandle)->private_data = handle;
+    if (!handle) {
+        mvLog(MVLOG_ERROR, "Memory allocation failed");
+        return NC_OUT_OF_MEMORY;
+    }
+
+    handle->type = type;
+    handle->consumer_cnt = 1;   //default consumers
+    handle->state = NC_FIFO_CREATED;
+    pthread_mutex_init(&handle->fifo_mutex, NULL);
+    handle->consumed_by_graph = 0;
+    handle->write_count = 0;
+    handle->user_param_in = NULL;
+    handle->user_param_out = NULL;
+    handle->api_read_element = 0;
+    handle->api_read_adjust = 0;
+    handle->id = fifoIdCounter++;
+    handle->datatype = NC_FIFO_FP32;
+    handle->num_elements = 0;
+    strncpy(handle->name, name, NC_MAX_NAME_SIZE);
+
+    return NC_OK;
+}
+
+int pushUserParam(struct _fifoPrivate_t *fH, void *user_param, int isIn)
+{
+    struct _userParamPrivate_t *new_user_param =
+        calloc(1, sizeof(struct _userParamPrivate_t));
+    new_user_param->next = NULL;
+    if (!new_user_param) {
+        mvLog(MVLOG_ERROR, "calloc failed!");
+        return NC_OUT_OF_MEMORY;
+    }
+    new_user_param->data = user_param;
+    if (isIn) {
+        new_user_param->next = fH->user_param_in;
+        fH->user_param_in = new_user_param;
+    } else {
+        new_user_param->next = fH->user_param_out;
+        fH->user_param_out = new_user_param;
+    }
+    return NC_OK;
+}
+
+int popUserParam(struct _fifoPrivate_t *fH, void **user_param, int isIn)
+{
+    struct _userParamPrivate_t *prev = NULL;
+    struct _userParamPrivate_t *curr = NULL;
+    if (isIn)
+        curr = fH->user_param_in;
+    else
+        curr = fH->user_param_out;
+
+    if (curr == NULL) {
+        if (user_param != NULL)
+            *user_param = NULL;
+        else
+            mvLog(MVLOG_DEBUG, "user_param is null - ignoring \n");
+        mvLog(MVLOG_ERROR, "Trying to read user param from an empty queue!");
+        return NC_ERROR;
+    }
+
+    while (curr->next != NULL) {
+        prev = curr;
+        curr = curr->next;
+    }
+    if (user_param != NULL)
+        *user_param = curr->data;
+    else
+        mvLog(MVLOG_DEBUG, "user_param is null - ignoring \n");
+
+    if (prev)
+        prev->next = NULL;
+    else {
+        if (isIn)
+            fH->user_param_in = NULL;
+        else
+            fH->user_param_out = NULL;
+    }
+    free(curr);
+    curr = NULL;
+    return NC_OK;
+}
+
+ncStatus_t ncFifoAllocate(struct ncFifoHandle_t * fifoHandle,
+                          struct ncDeviceHandle_t * device,
+                          struct ncTensorDescriptor_t * tensor_desc,
+                          unsigned int numElem)
+{
+    mvLog(MVLOG_INFO, "Creating fifo");
+    if (!fifoHandle || !device) {
+        mvLog(MVLOG_ERROR, "Fifo or device handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (!tensor_desc || !numElem) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+    if (tensor_desc->n * tensor_desc->c * tensor_desc->w * tensor_desc->h == 0
+        || !tensor_desc->totalSize) {
+        mvLog(MVLOG_ERROR,
+              "Tensor descriptor is invalid. Total size 0 or other element is zero");
+        return NC_INVALID_PARAMETERS;
+    }
+    struct _fifoPrivate_t *handle = fifoHandle->private_data;
+    if (handle->state == NC_FIFO_ALLOCATED) {
+        mvLog(MVLOG_ERROR, "Fifo has already been allocated");
+        return NC_UNAUTHORIZED;
+    }
+    if (handle->state != NC_FIFO_CREATED) {
+        mvLog(MVLOG_ERROR, "Fifo handle is corrupt or has been destroyed");
+        return NC_INVALID_HANDLE;
+    }
+    struct _devicePrivate_t *d = devices;
+    pthread_mutex_lock(&globalMutex);
+    while (d) {
+        if (d == device->private_data)
+            break;
+        d = d->next;
+    }
+    if (!d) {
+        pthread_mutex_unlock(&globalMutex);
+        mvLog(MVLOG_ERROR, "Device not found!\n");
+        return NC_INVALID_PARAMETERS;
+    }
+    pthread_mutex_unlock(&globalMutex);
+
+    handle->tensor_desc = *tensor_desc;
+    int sizeof_td_dt =
+        tensor_desc->totalSize / (tensor_desc->n * tensor_desc->c *
+                                  tensor_desc->w * tensor_desc->h);
+    if (sizeof_td_dt == 0) {
+        pthread_mutex_unlock(&globalMutex);
+        mvLog(MVLOG_ERROR,
+              "fifo descriptor has invalid shape, data type size seem to be zero (totalSize/shape produces zero)!\n");
+        return NC_INVALID_PARAMETERS;
+    }
+    handle->user_param_in = NULL;
+    handle->user_param_out = NULL;
+    handle->num_elements = numElem;
+    handle->consumers_remaining = handle->consumer_cnt; //default consumers
+    handle->dev = d;
+    handle->next = NULL;
+    if (handle->datatype == NC_FIFO_FP32)
+        handle->datasize = (tensor_desc->totalSize / sizeof_td_dt) * sizeof(float);
+    else
+        handle->datasize = tensor_desc->totalSize;
+
+    if (d->fifos)
+        handle->next = d->fifos;
+    d->fifos = handle;
+
+    graphMonCommand_t cmd;
+    cmd.cmdClass = GRAPH_MON_CLASS_BUFFER_CMD;
+    cmd.cmd.buffCmd.type = BUFFER_ALLOCATE_CMD;
+    struct tensorDescriptor_t privateDesc;
+    privateDesc.c = tensor_desc->c;
+    privateDesc.n = tensor_desc->n;
+    privateDesc.h = tensor_desc->h;
+    privateDesc.w = tensor_desc->w;
+    privateDesc.totalSize = tensor_desc->totalSize;
+    cmd.cmd.buffCmd.desc = privateDesc;
+    cmd.cmd.buffCmd.elemCnt = numElem;
+    snprintf(cmd.cmd.buffCmd.name, 16, "FIFO%d", handle->id);
+    cmd.cmd.buffCmd.id = handle->id;
+
+    uint32_t writeSize;
+    if (fifoWriteAccess(handle)) {
+        writeSize = tensor_desc->totalSize * numElem;
+        cmd.cmd.buffCmd.writeChannel = 1;
+    } else {
+        cmd.cmd.buffCmd.writeChannel = 0;
+        writeSize = 8;  // no write permission on this buffer, so we shouldn't bother allocating buffer on the device
+    }
+    if (fifoReadAccess(handle)) {
+        cmd.cmd.buffCmd.readChannel = 1;
+    } else {
+        cmd.cmd.buffCmd.readChannel = 0;
+    }
+    streamId_t streamId = XLinkOpenStream(d->usb_link->linkId,
+                                            cmd.cmd.buffCmd.name, writeSize);
+    if (streamId == INVALID_STREAM_ID) {
+        mvLog(MVLOG_WARN, "can't open stream\n");
+        return NC_ERROR;
+    }
+    handle->streamId = streamId;
+    pthread_mutex_lock(&d->graph_streamm);
+
+    if (sendGraphMonitorRequest(d->graph_monitor_stream_id, &cmd)) {
+        pthread_mutex_unlock(&d->graph_streamm);
+        mvLog(MVLOG_WARN, "can't send command\n");
+        return NC_ERROR;
+    }
+    if (checkGraphMonitorResponse(d->graph_monitor_stream_id)) {
+        pthread_mutex_unlock(&d->graph_streamm);
+        mvLog(MVLOG_WARN, "myriad NACK\n");
+        return NC_ERROR;
+    }
+    pthread_mutex_unlock(&d->graph_streamm);
+
+    handle->state = NC_FIFO_ALLOCATED;
+    return NC_OK;
+
+}
+
+ncStatus_t ncFifoDestroy(struct ncFifoHandle_t ** fifoHandle)
+{
+    if (!fifoHandle) {
+        mvLog(MVLOG_ERROR, "Fifo handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    struct ncFifoHandle_t *fh = *fifoHandle;
+    if (!fh) {
+        mvLog(MVLOG_INFO, "handle is already destroyed");
+        return NC_OK;
+    }
+
+    struct _fifoPrivate_t *handle = fh->private_data;
+
+    if (handle->state == NC_FIFO_CREATED) {
+        free(fh->private_data);
+        fh->private_data = NULL;
+        free(fh);
+        *fifoHandle = NULL;
+        return NC_OK;
+    }
+    if (!findFifo(handle)) {
+        mvLog(MVLOG_ERROR,
+              "fifo handle seems to be corrupt or has been destroyed");
+        return NC_INVALID_HANDLE;
+    }
+    //clean up fifo
+    /*if (fifoReadAccess(handle)) {
+        int fillLevel;
+        int rc = XLinkGetFillLevel(handle->streamId, 0, &fillLevel);
+        if (rc == X_LINK_SUCCESS) {
+            while (fillLevel && rc == X_LINK_SUCCESS) {
+                rc = XLinkReleaseData(handle->streamId);
+                fillLevel--;
+            }
+        }
+    }*/
+    //First write to the fifo to stop it's thread
+    if (fifoWriteAccess(handle)) {
+        int msg = 0xdead;
+        if (XLinkWriteData(handle->streamId, (uint8_t *) & msg, sizeof(&msg)) !=
+            0) {
+            mvLog(MVLOG_ERROR, "Failed to write to fifo before deleting it!");
+            return NC_ERROR;
+        }
+    }
+
+    graphMonCommand_t cmd;
+    cmd.cmdClass = GRAPH_MON_CLASS_BUFFER_CMD;
+    cmd.cmd.buffCmd.type = BUFFER_DEALLOCATE_CMD;
+    cmd.cmd.buffCmd.id = handle->id;
+
+    struct _devicePrivate_t *d = handle->dev;
+    pthread_mutex_lock(&d->graph_streamm);
+    if (sendGraphMonitorRequest(d->graph_monitor_stream_id, &cmd)) {
+        pthread_mutex_unlock(&d->graph_streamm);
+        mvLog(MVLOG_WARN, "can't send command\n");
+        return NC_ERROR;
+    }
+    if (checkGraphMonitorResponse(d->graph_monitor_stream_id)) {
+        pthread_mutex_unlock(&d->graph_streamm);
+        mvLog(MVLOG_WARN, "myriad NACK\n");
+        return NC_ERROR;
+    }
+    pthread_mutex_unlock(&d->graph_streamm);
+
+    pthread_mutex_lock(&d->dev_data_m);
+    if (deallocateFifo(handle)) {
+        pthread_mutex_unlock(&d->dev_data_m);
+        return NC_INVALID_PARAMETERS;
+    }
+    pthread_mutex_unlock(&d->dev_data_m);
+
+    free(fh->private_data);
+    fh->private_data = NULL;
+    free(fh);
+    *fifoHandle = NULL;
+    return NC_OK;
+
+}
+
+ncStatus_t ncFifoWriteElem(struct ncFifoHandle_t * fifoHandle,
+                           const void *inputTensor,
+                           unsigned int * inputTensorLength,
+                           void *userParam)
+{
+    if (!fifoHandle) {
+        mvLog(MVLOG_ERROR, "fifo handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (inputTensorLength == NULL || *inputTensorLength <= 0) {
+        mvLog(MVLOG_ERROR, "inputTensorSize is null or invalid value");
+        return NC_INVALID_PARAMETERS;
+    }
+    struct _fifoPrivate_t *handle = fifoHandle->private_data;
+    if (!findFifo(handle)) {
+        if (!handle) {
+            mvLog(MVLOG_ERROR,
+                  "fifo handle seems to be corrupt or has been destroyed");
+            return NC_INVALID_HANDLE;
+        }
+        if (handle->state == NC_FIFO_CREATED) {
+            mvLog(MVLOG_ERROR, "FIFO is not yet allocated");
+            return NC_NOT_ALLOCATED;
+        }
+        if (handle->state != NC_FIFO_ALLOCATED) {
+            mvLog(MVLOG_ERROR,
+                  "FIFO is not yet allocated or have been destroyed.");
+            return NC_UNAUTHORIZED;
+        }
+    }
+
+    if (!inputTensor) {
+        mvLog(MVLOG_ERROR, "input tensor is NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+    if (!fifoWriteAccess(handle)) {
+        mvLog(MVLOG_ERROR, "No write access to fifo");
+        return NC_UNAUTHORIZED;
+    }
+    struct ncTensorDescriptor_t * inputDesc = &handle->tensor_desc;
+
+    int rc;
+    // Convert fp32 to fp16
+    if (handle->datatype == NC_FIFO_FP32) {
+        int sizeof_td_dt =
+            inputDesc->totalSize / (inputDesc->n * inputDesc->c * inputDesc->w *
+                                    inputDesc->h);
+        if (sizeof_td_dt != 2) {
+            mvLog(MVLOG_WARN,
+                  "Converting to FP16 while data type size based on descriptor is not FP16!");
+            mvLog(MVLOG_WARN,
+                  "Ignoring desc shape and using data type size of FP16\n");
+            sizeof_td_dt = 2;
+        }
+        int expectedTensorLength = (inputDesc->totalSize / sizeof_td_dt) * sizeof(float);
+        if (*inputTensorLength != expectedTensorLength) {
+            mvLog(MVLOG_ERROR,
+                  "input tensor length (%d) doesnt match expected value (%d)",
+                  *inputTensorLength, expectedTensorLength);
+            *inputTensorLength = expectedTensorLength;
+            return NC_INVALID_DATA_LENGTH;
+        }
+
+        unsigned char *inputTensorFP16 = malloc(inputDesc->totalSize);
+
+        unsigned int cnt = inputDesc->totalSize / sizeof_td_dt;
+        floattofp16(inputTensorFP16, (float *) inputTensor, cnt);
+        rc = XLinkWriteData(handle->streamId, inputTensorFP16,
+                            inputDesc->totalSize);
+        free(inputTensorFP16);
+    } else {
+        if (*inputTensorLength != inputDesc->totalSize) {
+            mvLog(MVLOG_ERROR,
+                  "input tensor length doesnt match expected value");
+            *inputTensorLength = inputDesc->totalSize;
+            return NC_INVALID_DATA_LENGTH;
+        }
+        rc = XLinkWriteData(handle->streamId, inputTensor, *inputTensorLength);
+    }
+    if (rc != 0)
+        return NC_ERROR;
+
+    pthread_mutex_lock(&handle->fifo_mutex);
+    rc = pushUserParam(handle, userParam, 1);
+    if (rc != NC_OK) {
+        pthread_mutex_unlock(&handle->fifo_mutex);
+        return rc;
+    }
+    handle->write_count++;
+    pthread_mutex_unlock(&handle->fifo_mutex);
+
+    mvLog(MVLOG_DEBUG, "write count %d num_elements %d userparam %p\n",
+          handle->write_count - 1, handle->num_elements, userParam);
+    return NC_OK;
+
+}
+
+ncStatus_t ncFifoReadElem(struct ncFifoHandle_t * fifoHandle, void *outputData,
+                          unsigned int *outputDataLen, void **userParam)
+{
+    if (!fifoHandle) {
+        mvLog(MVLOG_ERROR, "fifo handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (!outputDataLen || (*outputDataLen != 0 && !outputData)) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+
+    struct _fifoPrivate_t *handle = fifoHandle->private_data;
+    if (!findFifo(handle)) {
+        if (!handle) {
+            mvLog(MVLOG_ERROR,
+                  "fifo handle seems to be corrupt or has been destroyed");
+            return NC_INVALID_HANDLE;
+        }
+        if (handle->state == NC_FIFO_CREATED) {
+            mvLog(MVLOG_ERROR, "FIFO is not yet allocated");
+            return NC_NOT_ALLOCATED;
+        }
+    }
+
+    if (handle->state != NC_FIFO_ALLOCATED) {
+        mvLog(MVLOG_ERROR, "FIFO is not yet allocated or have been destroyed.");
+        return NC_UNAUTHORIZED;
+    }
+
+    if (*outputDataLen < handle->datasize) {
+        mvLog(MVLOG_ERROR,
+              "This datasize in tensorDesc (%d) is smaller than required (%d)!",
+              *outputDataLen, handle->datasize);
+        *outputDataLen = handle->datasize;
+        return NC_INVALID_DATA_LENGTH;
+    }
+
+    if (!fifoReadAccess(handle)) {
+        mvLog(MVLOG_ERROR, "FIFO has no read access");
+        return NC_UNAUTHORIZED;
+    }
+    if (handle->api_read_element != 0) {
+        mvLog(MVLOG_ERROR, "API already read this element");
+        return NC_UNAUTHORIZED;
+    }
+
+    streamPacketDesc_t *packet;
+    if (!XLinkReadData(handle->streamId, &packet)) {
+        // Convert fp16 to fp32
+        if (handle->datatype == NC_FIFO_FP32) {
+            int sizeof_td_dt = handle->tensor_desc.totalSize /
+                (handle->tensor_desc.n * handle->tensor_desc.c *
+                 handle->tensor_desc.w * handle->tensor_desc.h);
+            int cnt = packet->length / sizeof_td_dt;
+            fp16tofloat(outputData, (unsigned char *) packet->data, cnt);
+        } else {
+            memcpy(outputData, packet->data, packet->length);
+        }
+        XLinkReleaseData(handle->streamId);
+    }
+    //As user should see an API read to be the same as Graph read, we need to wirte the element in 2 queues.
+    //if we read it here, we will need to remove the element on the device side
+    //to avoid sending a message just for this purpose, we can send it at the next trigger which touches this FIFO.
+    pthread_mutex_lock(&handle->fifo_mutex);
+    handle->api_read_element = 1;
+    handle->api_read_adjust++;
+
+    handle->consumers_remaining--;
+    if (handle->consumers_remaining == 0) {
+        handle->api_read_element = 0;
+        handle->consumers_remaining = handle->consumer_cnt;
+        //no other action required when the element is consumed
+    }
+    popUserParam(handle, userParam, 0);
+    pthread_mutex_unlock(&handle->fifo_mutex);
+    *outputDataLen = handle->datasize;
+    mvLog(MVLOG_DEBUG, "num_elements %d userparam %p output length %d\n",
+          handle->num_elements, userParam, handle->datasize);
+    return NC_OK;
+}
+
+ncStatus_t ncFifoRemoveElem(struct ncFifoHandle_t * fifoHandle)
+{
+    return NC_UNSUPPORTED_FEATURE;
+}
+
+ncStatus_t ncFifoSetOption(struct ncFifoHandle_t * fifoHandle, int option,
+                           const void *data, unsigned int dataLength)
+{
+    if (!fifoHandle) {
+        mvLog(MVLOG_ERROR, "Fifo handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (!data) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+    if (!fifoHandle->private_data) {
+        mvLog(MVLOG_ERROR, "fifo handle is corrupt or has been destroyed");
+        return NC_INVALID_HANDLE;
+    }
+    struct _fifoPrivate_t *f = (struct _fifoPrivate_t *) fifoHandle->private_data;
+    if (f->state != NC_FIFO_CREATED) {
+        mvLog(MVLOG_ERROR, "cannot set Fifo options after allocation");
+        return NC_UNAUTHORIZED;
+    }
+
+    switch (option) {
+    case NC_RW_FIFO_TYPE:{
+            unsigned int size = sizeof(ncFifoType_t);
+            if (dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      dataLength, size);
+                return NC_INVALID_DATA_LENGTH;
+            }
+            f->type = *(ncFifoType_t *) data;
+            break;
+        }
+    case NC_RW_FIFO_CONSUMER_COUNT:{
+            unsigned int size = sizeof(int);
+            if (dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      dataLength, size);
+                return NC_INVALID_DATA_LENGTH;
+            }
+            f->consumer_cnt = *(int *) data;
+            break;
+        }
+    case NC_RW_FIFO_DATA_TYPE:{
+            unsigned int size = sizeof(ncFifoDataType_t);
+            if (dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      dataLength, size);
+                return NC_INVALID_DATA_LENGTH;
+            }
+            f->datatype = *(int *) data;
+            break;
+        }
+    case NC_RW_FIFO_DONT_BLOCK:
+        return NC_UNSUPPORTED_FEATURE;
+        break;
+    case NC_RO_FIFO_CAPACITY:
+    case NC_RO_FIFO_READ_FILL_LEVEL:
+    case NC_RO_FIFO_WRITE_FILL_LEVEL:
+    case NC_RO_FIFO_TENSOR_DESCRIPTOR:
+    case NC_RO_FIFO_STATE:
+    case NC_RO_FIFO_ELEMENT_DATA_SIZE:
+        return NC_UNAUTHORIZED;
+        break;
+    default:
+        return NC_INVALID_PARAMETERS;
+        break;
+    }
+    return NC_OK;
+}
+
+ncStatus_t ncFifoGetOption(struct ncFifoHandle_t * fifoHandle, int option,
+                           void *data, unsigned int *dataLength)
+{
+    if (!dataLength || (*dataLength != 0 && !data)) {
+        mvLog(MVLOG_ERROR, "Some of the parameters are NULL");
+        return NC_INVALID_PARAMETERS;
+    }
+    if (!fifoHandle) {
+        mvLog(MVLOG_ERROR, "fifo handle is NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (!fifoHandle->private_data) {
+        mvLog(MVLOG_ERROR, "Fifo is corrupt or has been destroyed");
+        return NC_INVALID_HANDLE;
+    }
+    if (fifoHandle->private_data->state == NC_FIFO_CREATED &&
+        option != NC_RO_FIFO_STATE && option != NC_RW_FIFO_DATA_TYPE &&
+        option != NC_RW_FIFO_DONT_BLOCK && option != NC_RW_FIFO_CONSUMER_COUNT
+        && option != NC_RO_FIFO_NAME) {
+        mvLog(MVLOG_ERROR,
+              "Fifo hasn't been allocated, cannot read those options");
+        return NC_NOT_ALLOCATED;
+    }
+    switch (option) {
+    case NC_RW_FIFO_CONSUMER_COUNT:
+    case NC_RO_FIFO_CAPACITY:
+    case NC_RO_FIFO_READ_FILL_LEVEL:
+    case NC_RO_FIFO_WRITE_FILL_LEVEL:
+    case NC_RO_FIFO_STATE:
+    case NC_RO_FIFO_ELEMENT_DATA_SIZE:
+        {
+            unsigned int size = sizeof(int);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            break;
+        }
+    default:
+        break;
+    }
+
+    switch (option) {
+    case NC_RW_FIFO_TYPE:{
+            unsigned int size = sizeof(ncFifoType_t);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            *(ncFifoType_t *) data = fifoHandle->private_data->type;
+            *dataLength = sizeof(fifoHandle->private_data->type);
+            break;
+        }
+    case NC_RW_FIFO_CONSUMER_COUNT:
+        *(int *) data = fifoHandle->private_data->consumer_cnt;
+        *dataLength = sizeof(fifoHandle->private_data->consumer_cnt);
+        break;
+    case NC_RO_FIFO_ELEMENT_DATA_SIZE:
+        *(int *) data = fifoHandle->private_data->datasize;
+        *dataLength = sizeof(fifoHandle->private_data->datasize);
+        break;
+    case NC_RW_FIFO_DATA_TYPE:
+        {
+            unsigned int size = sizeof(ncFifoDataType_t);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            *(int *) data = fifoHandle->private_data->datatype;
+            *dataLength = sizeof(fifoHandle->private_data->datatype);
+            break;
+        }
+    case NC_RO_FIFO_CAPACITY:
+        *(int *) data = fifoHandle->private_data->num_elements;
+        *dataLength = sizeof(fifoHandle->private_data->num_elements);
+        break;
+    case NC_RO_FIFO_TENSOR_DESCRIPTOR:
+        {
+            unsigned int size = sizeof(struct ncTensorDescriptor_t);
+            if (*dataLength < size) {
+                mvLog(MVLOG_ERROR,
+                      "data length of output buffer (%d) is smaller that required (%d)!\n",
+                      *dataLength, size);
+                *dataLength = size;
+                return NC_INVALID_DATA_LENGTH;
+            }
+            if (fifoHandle->private_data->state != NC_FIFO_ALLOCATED)
+                return NC_UNAUTHORIZED; // before allocation, tensor_desc is NULL
+            *(struct ncTensorDescriptor_t *) data =
+                fifoHandle->private_data->tensor_desc;
+            *dataLength = sizeof(fifoHandle->private_data->tensor_desc);
+            break;
+        }
+    case NC_RO_FIFO_READ_FILL_LEVEL:
+        {
+            struct _fifoPrivate_t *fi = fifoHandle->private_data;
+            if (!fifoReadAccess(fi))
+                return NC_UNAUTHORIZED;
+
+            *dataLength = sizeof(int);
+            if (fi->state != NC_FIFO_ALLOCATED) {
+                *(int *) data = 0;
+                break;
+            }
+            int fillLevel;
+            if (XLinkGetFillLevel(fi->streamId, 0, &fillLevel) == X_LINK_SUCCESS) {
+                *(int *) data = (fillLevel / fi->tensor_desc.totalSize);
+            } else {
+                return NC_UNAUTHORIZED;
+            }
+
+            break;
+        }
+    case NC_RO_FIFO_WRITE_FILL_LEVEL:
+        {
+            struct _fifoPrivate_t *fi = fifoHandle->private_data;
+            if (!fifoWriteAccess(fi))
+                return NC_UNAUTHORIZED;
+
+            *dataLength = sizeof(int);
+            if (fi->state != NC_FIFO_ALLOCATED) {
+                *(int *) data = 0;
+                break;
+            }
+            int fillLevel;
+            if (XLinkGetFillLevel(fi->streamId, 1, &fillLevel) == X_LINK_SUCCESS) {
+                *(int *) data = (fillLevel / fi->tensor_desc.totalSize);
+            } else {
+                return NC_ERROR;
+            }
+
+            break;
+        }
+    case NC_RW_FIFO_DONT_BLOCK:
+        return NC_UNSUPPORTED_FEATURE;
+        break;
+    case NC_RO_FIFO_STATE:
+        *(int *) data = fifoHandle->private_data->state;
+        *dataLength = sizeof(int);
+        break;
+    case NC_RO_FIFO_NAME:
+        if (*dataLength < strlen(fifoHandle->private_data->name) + 1) {
+            mvLog(MVLOG_ERROR,
+                  "data length of output buffer (%d) is smaller that required (%d)!\n",
+                  *dataLength, strlen(fifoHandle->private_data->name) + 1);
+            *dataLength = strlen(fifoHandle->private_data->name) + 1;
+            return NC_INVALID_DATA_LENGTH;
+        }
+        *dataLength = strlen(fifoHandle->private_data->name) + 1;
+        strncpy((char *) data, fifoHandle->private_data->name, *dataLength);
+        break;
+    default:
+        return NC_INVALID_PARAMETERS;
+        break;
+    }
+    return NC_OK;
+}
+
+static ncStatus_t tensorCompatibility(struct ncTensorDescriptor_t *tens1,
+                                      struct ncTensorDescriptor_t *tens2)
+{
+    if (tens1->totalSize != tens2->totalSize ||
+        tens1->n != tens2->n || tens1->c != tens2->c ||
+        tens1->h != tens2->h || tens1->w != tens2->w)
+        return NC_ERROR;
+    return NC_OK;
+}
+
+ncStatus_t ncGraphQueueInference(struct ncGraphHandle_t * graphHandle,
+                                 struct ncFifoHandle_t ** fifoIn,
+                                 unsigned int inFifoCount,
+                                 struct ncFifoHandle_t ** fifoOut,
+                                 unsigned int outFifoCount)
+{
+    mvLog(MVLOG_INFO, "trigger start\n");
+    if (!graphHandle || !fifoIn || !fifoIn[0] || !fifoOut || !fifoOut[0]) {
+        mvLog(MVLOG_ERROR, "Graph or fifos handles are NULL");
+        return NC_INVALID_HANDLE;
+    }
+    if (!inFifoCount || !outFifoCount)
+        return NC_INVALID_PARAMETERS;
+    struct _graphPrivate_t *g = graphHandle->private_data;
+
+    if (!g || g->state != NC_GRAPH_ALLOCATED) {
+        mvLog(MVLOG_ERROR, "Graph hasn't been allocated");
+        return NC_NOT_ALLOCATED;
+    }
+
+    if (g->input_count != inFifoCount || g->output_count != outFifoCount) {
+        mvLog(MVLOG_ERROR,
+              "number of input or output fifos is not compatible with graph");
+        return NC_INVALID_PARAMETERS;
+    }
+
+    if (inFifoCount != 1 || outFifoCount != 1) {
+        mvLog(MVLOG_ERROR,
+              "Currently multiple inputs and outputs are not supported");
+        return NC_UNSUPPORTED_FEATURE;
+    }
+    struct _fifoPrivate_t *fi = fifoIn[0]->private_data;
+    struct _fifoPrivate_t *fo = fifoOut[0]->private_data;
+    ncStatus_t rc;
+    if (fi->state != NC_FIFO_ALLOCATED || fo->state != NC_FIFO_ALLOCATED) {
+        mvLog(MVLOG_ERROR, "ffos hasn't been allocated");
+        return NC_NOT_ALLOCATED;
+    }
+    //WO fifos have no graph access
+    if (fo->type == NC_FIFO_HOST_WO) {
+        //graphs have no access to one of the fifos
+        return NC_INVALID_PARAMETERS;
+    }
+    if (tensorCompatibility(&fi->tensor_desc, &g->input_tensor_desc) != NC_OK ||
+        tensorCompatibility(&fo->tensor_desc,
+                            &g->output_tensor_desc) != NC_OK) {
+        mvLog(MVLOG_WARN,
+              "Input/Output tensor shape is not compatible with graph");
+        return NC_INVALID_PARAMETERS;
+    }
+
+    graphMonCommand_t cmd;
+    cmd.cmdClass = GRAPH_MON_CLASS_GRAPH_CMD;
+    cmd.cmd.graphCmd.type = GRAPH_TRIGGER_CMD;
+    cmd.cmd.graphCmd.id = g->id;
+    cmd.cmd.graphCmd.buffId1 = fi->id;
+    cmd.cmd.graphCmd.buffId2 = fo->id;
+
+    void *user_param;
+    pthread_mutex_lock(&fi->fifo_mutex);
+    fi->consumers_remaining--;
+    cmd.cmd.graphCmd.releaseElemBuff1 = fi->api_read_adjust;
+    fi->api_read_adjust = 0;
+    if (fi->consumers_remaining == 0) {
+        if (!fi->api_read_element && fifoReadAccess(fi)) {  //the element was entirely consumed by graphs. This means we need to free it up from XLink
+            streamPacketDesc_t *packet;
+            XLinkReadData(fi->streamId, &packet);
+            XLinkReleaseData(fi->streamId);
+        }
+        fi->consumers_remaining = fi->consumer_cnt;
+        fi->api_read_element = 0;
+    }
+    popUserParam(fi, &user_param, 1);
+    if (fi->write_count <= fi->consumed_by_graph) {
+        mvLog(MVLOG_WARN,
+              "No point on triggering graph. There are no more elements in the input FIFO");
+        pthread_mutex_unlock(&fi->fifo_mutex);
+        return NC_UNAUTHORIZED;
+    }
+    fi->consumed_by_graph++;
+    pthread_mutex_unlock(&fi->fifo_mutex);
+
+    pthread_mutex_lock(&fo->fifo_mutex);
+    cmd.cmd.graphCmd.releaseElemBuff2 = fo->api_read_adjust;
+    fo->api_read_adjust = 0;
+    rc = pushUserParam(fo, user_param, 0);
+    if (rc != NC_OK) {
+        pthread_mutex_unlock(&fo->fifo_mutex);
+        return rc;
+    }
+    fo->write_count++;
+    pthread_mutex_unlock(&fo->fifo_mutex);
+
+    pthread_mutex_lock(&g->dev->graph_streamm);
+
+    if (sendGraphMonitorRequest(g->dev->graph_monitor_stream_id, &cmd)) {
+        pthread_mutex_unlock(&g->dev->graph_streamm);
+        mvLog(MVLOG_WARN, "Can't send trigger request");
+        return NC_ERROR;
+    }
+    if (checkGraphMonitorResponse(g->dev->graph_monitor_stream_id)) {
+        pthread_mutex_unlock(&g->dev->graph_streamm);
+        return NC_ERROR;
+    }
+    pthread_mutex_unlock(&g->dev->graph_streamm);
+    g->started = 1;
+    mvLog(MVLOG_INFO, "trigger end\n");
+    return NC_OK;
+}
+
+ncStatus_t ncGraphQueueInferenceWithFifoElem(struct ncGraphHandle_t *
+                                             graphHandle,
+                                             struct ncFifoHandle_t * fifoIn,
+                                             struct ncFifoHandle_t * fifoOut,
+                                             const void *inputTensor,
+                                             unsigned int * inputTensorLength,
+                                             void *userParam)
+{
+    ncStatus_t rc = ncFifoWriteElem(fifoIn, inputTensor, inputTensorLength,
+                                    userParam);
+    if (rc != NC_OK)
+        return rc;
+
+    return ncGraphQueueInference(graphHandle, &fifoIn, 1, &fifoOut, 1);
 }
diff --git a/api/src/usb_boot.c b/api/src/usb_boot.c
deleted file mode 100644 (file)
index 2f7cf27..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
-* Copyright 2017 Intel Corporation.
-* The source code, information and material ("Material") contained herein is
-* owned by Intel Corporation or its suppliers or licensors, and title to such
-* Material remains with Intel Corporation or its suppliers or licensors.
-* The Material contains proprietary information of Intel or its suppliers and
-* licensors. The Material is protected by worldwide copyright laws and treaty
-* provisions.
-* No part of the Material may be used, copied, reproduced, modified, published,
-* uploaded, posted, transmitted, distributed or disclosed in any way without
-* Intel's prior express written permission. No license under any patent,
-* copyright or other intellectual property rights in the Material is granted to
-* or conferred upon you, either expressly, by implication, inducement, estoppel
-* or otherwise.
-* Any license under such intellectual property rights must be express and
-* approved by Intel in writing.
-*/
-
-// USB utility for use with Myriad2v2 ROM
-// Very heavily modified from Sabre version of usb_boot
-// Author: David Steinberg <david.steinberg@movidius.com>
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <time.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <getopt.h>
-#include <errno.h>
-#include <ctype.h>
-#include <libusb.h>
-#include "usb_boot.h"
-#include "mvnc.h"
-#include "common.h"
-
-#define DEFAULT_WRITE_TIMEOUT          2000
-#define DEFAULT_CONNECT_TIMEOUT                20      // in 100ms units
-#define DEFAULT_CHUNK_SZ                       1024 * 1024
-
-static unsigned int bulk_chunk_len = DEFAULT_CHUNK_SZ;
-static int write_timeout = DEFAULT_WRITE_TIMEOUT;
-static int connect_timeout = DEFAULT_CONNECT_TIMEOUT;
-static int initialized;
-
-void __attribute__ ((constructor)) usb_library_load()
-{
-       initialized = !libusb_init(NULL);
-}
-
-void __attribute__ ((destructor)) usb_library_unload()
-{
-       if (initialized)
-               libusb_exit(NULL);
-}
-
-typedef struct timespec highres_time_t;
-
-static inline void highres_gettime(highres_time_t *ptr)
-{
-       clock_gettime(CLOCK_REALTIME, ptr);
-}
-
-static inline double highres_elapsed_ms(highres_time_t *start, highres_time_t *end)
-{
-       struct timespec temp;
-       if ((end->tv_nsec - start->tv_nsec) < 0) {
-               temp.tv_sec = end->tv_sec - start->tv_sec - 1;
-               temp.tv_nsec = 1000000000 + end->tv_nsec - start->tv_nsec;
-       } else {
-               temp.tv_sec = end->tv_sec - start->tv_sec;
-               temp.tv_nsec = end->tv_nsec - start->tv_nsec;
-       }
-       return (double)(temp.tv_sec * 1000) + (((double)temp.tv_nsec) * 0.000001);
-}
-
-static const char *gen_addr(libusb_device *dev)
-{
-       static char buff[4 * 7] = "";   // '255-' x 7 (also gives us nul-terminator for last entry)
-       uint8_t pnums[7];
-       int pnum_cnt, i;
-       char *p;
-
-       pnum_cnt = libusb_get_port_numbers(dev, pnums, 7);
-       if (pnum_cnt == LIBUSB_ERROR_OVERFLOW) {
-               // shouldn't happen!
-               strcpy(buff, "<error>");
-               return buff;
-       }
-       p = buff;
-       for (i = 0; i < pnum_cnt - 1; i++)
-               p += snprintf(p, sizeof(buff) - strlen(buff), "%u.", pnums[i]);
-       snprintf(p, sizeof(buff) - strlen(buff), "%u", pnums[i]);
-       return buff;
-}
-
-// if device is NULL, return device address for device at index idx
-// if device is not NULL, search by name and return device struct
-int usb_find_device(unsigned idx, char *addr, unsigned addr_size, void **device,
-                   int vid, int pid)
-{
-       static libusb_device **devs;
-       libusb_device *dev;
-       struct libusb_device_descriptor desc;
-       int count = 0;
-       size_t i;
-       int res;
-
-       if (!initialized) {
-               PRINT_INFO(stderr,
-                          "Library has not been initialized when loaded\n");
-               return MVNC_ERROR;
-       }
-       if (!devs || idx == 0) {
-               if (devs) {
-                       libusb_free_device_list(devs, 1);
-                       devs = 0;
-               }
-               if ((res = libusb_get_device_list(NULL, &devs)) < 0) {
-                       PRINT_INFO(stderr,
-                                  "Unable to get USB device list: %s\n",
-                                  libusb_strerror(res));
-                       return MVNC_ERROR;
-               }
-       }
-
-       i = 0;
-       while ((dev = devs[i++]) != NULL) {
-               if ((res = libusb_get_device_descriptor(dev, &desc)) < 0) {
-                       PRINT_INFO(stderr,
-                                  "Unable to get USB device descriptor: %s\n",
-                                  libusb_strerror(res));
-                       continue;
-               }
-               if ((desc.idVendor == vid && desc.idProduct == pid) ||
-                   (pid == 0 && vid == 0 && ((desc.idVendor == DEFAULT_VID
-                                              && desc.idProduct == DEFAULT_PID)
-                                             || (desc.idVendor ==
-                                                 DEFAULT_OPEN_VID &&
-                                                 desc.idProduct ==
-                                                 DEFAULT_OPEN_PID)))) {
-                       if (device) {
-                               const char *caddr = gen_addr(dev);
-                               if (!strcmp(caddr, addr)) {
-                                       PRINT_DEBUG(stderr,
-                                                   "Found Address: %s - VID/PID %04x:%04x\n",
-                                                   addr, desc.idVendor, desc.idProduct);
-                                       libusb_ref_device(dev);
-                                       libusb_free_device_list(devs, 1);
-                                       *device = dev;
-                                       devs = 0;
-                                       return 0;
-                               }
-                       } else if (idx == count) {
-                               const char *caddr = gen_addr(dev);
-                               PRINT_DEBUG(stderr,
-                                           "Device %d Address: %s - VID/PID %04x:%04x\n",
-                                           idx, caddr, desc.idVendor, desc.idProduct);
-                               strncpy(addr, caddr, addr_size);
-                               return 0;
-                       }
-                       count++;
-               }
-       }
-       libusb_free_device_list(devs, 1);
-       devs = 0;
-       return MVNC_DEVICE_NOT_FOUND;
-}
-
-static libusb_device_handle *usb_open_device(libusb_device *dev, uint8_t *endpoint,
-                                            char *err_string_buff, unsigned buff_size)
-{
-       struct libusb_config_descriptor *cdesc;
-       const struct libusb_interface_descriptor *ifdesc;
-       libusb_device_handle *h = NULL;
-       int res, i;
-
-       if ((res = libusb_open(dev, &h)) < 0) {
-               snprintf(err_string_buff, buff_size, "cannot open device: %s\n",
-                        libusb_strerror(res));
-               return 0;
-       }
-       if ((res = libusb_set_configuration(h, 1)) < 0) {
-               snprintf(err_string_buff, buff_size,
-                        "setting config 1 failed: %s\n", libusb_strerror(res));
-               libusb_close(h);
-               return 0;
-       }
-       if ((res = libusb_claim_interface(h, 0)) < 0) {
-               snprintf(err_string_buff, buff_size,
-                        "claiming interface 0 failed: %s\n",
-                        libusb_strerror(res));
-               libusb_close(h);
-               return 0;
-       }
-       if ((res = libusb_get_config_descriptor(dev, 0, &cdesc)) < 0) {
-               snprintf(err_string_buff, buff_size,
-                        "Unable to get USB config descriptor: %s\n",
-                        libusb_strerror(res));
-               libusb_close(h);
-               return 0;
-       }
-
-       ifdesc = cdesc->interface->altsetting;
-       for (i = 0; i < ifdesc->bNumEndpoints; i++) {
-               PRINT_DEBUG(stderr,
-                           "Found EP 0x%02x : max packet size is %u bytes\n",
-                           ifdesc->endpoint[i].bEndpointAddress,
-                           ifdesc->endpoint[i].wMaxPacketSize);
-               if ((ifdesc->endpoint[i].bmAttributes & LIBUSB_TRANSFER_TYPE_MASK) !=
-                   LIBUSB_TRANSFER_TYPE_BULK)
-                       continue;
-               if (!
-                   (ifdesc->endpoint[i].bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK)) {
-                       *endpoint = ifdesc->endpoint[i].bEndpointAddress;
-                       bulk_chunk_len = ifdesc->endpoint[i].wMaxPacketSize;
-                       libusb_free_config_descriptor(cdesc);
-                       return h;
-               }
-       }
-       libusb_free_config_descriptor(cdesc);
-       strcpy(err_string_buff, "Unable to find BULK OUT endpoint\n");
-       libusb_close(h);
-       return 0;
-}
-
-// timeout: -1 = no (infinite) timeout, 0 = must happen immediately
-static int wait_findopen(const char *device_address, int timeout,
-                        libusb_device ** dev, libusb_device_handle ** devh,
-                        uint8_t * endpoint)
-{
-       int i, rc;
-       char last_open_dev_err[128];
-
-       usleep(100000);
-       if (mvnc_loglevel > 1) {
-               // I know about switch(), but for some reason -1 is picked up correctly
-               if (timeout == -1)
-                       PRINT("Starting wait for connect, no timeout\n");
-               else if (timeout == 0)
-                       PRINT("Trying to connect\n");
-               else
-                       PRINT("Starting wait for connect with %ums timeout\n", timeout * 100);
-       }
-
-       last_open_dev_err[0] = 0;
-       i = 0;
-       for (;;) {
-               rc = usb_find_device(0, (char *) device_address, 0,
-                                    (void **) dev, DEFAULT_VID, DEFAULT_PID);
-               if (rc < 0)
-                       return MVNC_ERROR;
-               if (!rc) {
-                       if ((*devh = usb_open_device(*dev, endpoint, last_open_dev_err, 128))) {
-                               PRINT_DEBUG(stderr, "Found and opened device\n");
-                               return 0;
-                       }
-                       libusb_unref_device(*dev);
-               }
-
-               if (timeout != -1 && i == timeout) {
-                       PRINT_INFO(stderr, "%serror: device not found!\n",
-                                  last_open_dev_err[0] ? last_open_dev_err : "");
-                       return rc ? MVNC_DEVICE_NOT_FOUND : MVNC_TIMEOUT;
-               }
-               i++;
-               usleep(100000);
-       }
-}
-
-static int send_file(libusb_device_handle * h, uint8_t endpoint,
-                    const uint8_t * tx_buf, unsigned file_size)
-{
-       const uint8_t *p;
-       int rc;
-       int wb, twb, wbr;
-       double elapsed_time;
-       highres_time_t t1, t2;
-
-       elapsed_time = 0;
-       twb = 0;
-       p = tx_buf;
-       PRINT_DEBUG(stderr, "Performing bulk write of %u bytes...\n",
-                   file_size);
-
-       while (twb < file_size) {
-               highres_gettime(&t1);
-               wb = file_size - twb;
-               if (wb > bulk_chunk_len)
-                       wb = bulk_chunk_len;
-               wbr = 0;
-               rc = libusb_bulk_transfer(h, endpoint, (void *) p, wb, &wbr,
-                                         write_timeout);
-
-               if (rc || (wb != wbr)) {
-                       if (rc == LIBUSB_ERROR_NO_DEVICE)
-                               break;
-
-                       PRINT_INFO(stderr,
-                                  "bulk write: %s (%d bytes written, %d bytes to write)\n",
-                                  libusb_strerror(rc), wbr, wb);
-                       if (rc == LIBUSB_ERROR_TIMEOUT)
-                               return MVNC_TIMEOUT;
-                       else
-                               return MVNC_ERROR;
-               }
-               highres_gettime(&t2);
-               elapsed_time += highres_elapsed_ms(&t1, &t2);
-               twb += wbr;
-               p += wbr;
-       }
-       PRINT_DEBUG(stderr,
-                   "Successfully sent %u bytes of data in %lf ms (%lf MB/s)\n",
-                   file_size, elapsed_time,
-                   ((double) file_size / 1048576.) / (elapsed_time * 0.001));
-       return 0;
-}
-
-int usb_boot(const char *addr, const void *mvcmd, unsigned size)
-{
-       int rc;
-       libusb_device *dev;
-       libusb_device_handle *h;
-       uint8_t endpoint;
-
-       rc = wait_findopen(addr, connect_timeout, &dev, &h, &endpoint);
-       if (rc)
-               return rc;
-       rc = send_file(h, endpoint, mvcmd, size);
-       libusb_release_interface(h, 0);
-       libusb_close(h);
-       libusb_unref_device(dev);
-       return rc;
-}
diff --git a/api/src/usb_boot.h b/api/src/usb_boot.h
deleted file mode 100644 (file)
index 7659b5f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-* Copyright 2017 Intel Corporation.
-* The source code, information and material ("Material") contained herein is
-* owned by Intel Corporation or its suppliers or licensors, and title to such
-* Material remains with Intel Corporation or its suppliers or licensors.
-* The Material contains proprietary information of Intel or its suppliers and
-* licensors. The Material is protected by worldwide copyright laws and treaty
-* provisions.
-* No part of the Material may be used, copied, reproduced, modified, published,
-* uploaded, posted, transmitted, distributed or disclosed in any way without
-* Intel's prior express written permission. No license under any patent,
-* copyright or other intellectual property rights in the Material is granted to
-* or conferred upon you, either expressly, by implication, inducement, estoppel
-* or otherwise.
-* Any license under such intellectual property rights must be express and
-* approved by Intel in writing.
-*/
-
-extern int mvnc_loglevel;
-int usb_find_device(unsigned idx, char *addr, unsigned addrsize, void **device, int vid, int pid);
-int usb_boot(const char *addr, const void *mvcmd, unsigned size);
diff --git a/api/src/usb_link.h b/api/src/usb_link.h
deleted file mode 100644 (file)
index 4c99f35..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-* Copyright 2017 Intel Corporation.
-* The source code, information and material ("Material") contained herein is
-* owned by Intel Corporation or its suppliers or licensors, and title to such
-* Material remains with Intel Corporation or its suppliers or licensors.
-* The Material contains proprietary information of Intel or its suppliers and
-* licensors. The Material is protected by worldwide copyright laws and treaty
-* provisions.
-* No part of the Material may be used, copied, reproduced, modified, published,
-* uploaded, posted, transmitted, distributed or disclosed in any way without
-* Intel's prior express written permission. No license under any patent,
-* copyright or other intellectual property rights in the Material is granted to
-* or conferred upon you, either expressly, by implication, inducement, estoppel
-* or otherwise.
-* Any license under such intellectual property rights must be express and
-* approved by Intel in writing.
-*/
-
-#include "USBLinkDefines.h"
-
-int usblink_sendcommand(void *f, hostcommands_t command);
-int usblink_resetmyriad(void *f);
-int usblink_getmyriadstatus(void *f, myriadStatus_t *myriadState);
-void *usblink_open(const char *path);
-void usblink_close(void *f);
-int usblink_setdata(void *f, const char *name, const void *data, unsigned int length, int hostready);
-int usblink_getdata(void *f, const char *name, void *data, unsigned int length, unsigned int offset, int hostready);
-void usblink_resetall();
diff --git a/api/src/usb_link_vsc.c b/api/src/usb_link_vsc.c
deleted file mode 100644 (file)
index d9c8f26..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
-* Copyright 2017 Intel Corporation.
-* The source code, information and material ("Material") contained herein is
-* owned by Intel Corporation or its suppliers or licensors, and title to such
-* Material remains with Intel Corporation or its suppliers or licensors.
-* The Material contains proprietary information of Intel or its suppliers and
-* licensors. The Material is protected by worldwide copyright laws and treaty
-* provisions.
-* No part of the Material may be used, copied, reproduced, modified, published,
-* uploaded, posted, transmitted, distributed or disclosed in any way without
-* Intel's prior express written permission. No license under any patent,
-* copyright or other intellectual property rights in the Material is granted to
-* or conferred upon you, either expressly, by implication, inducement, estoppel
-* or otherwise.
-* Any license under such intellectual property rights must be express and
-* approved by Intel in writing.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-#include <sys/timeb.h>
-#include <sys/un.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <time.h>
-#include <termios.h>
-#include <libusb.h>
-
-#include "usb_link.h"
-#include "usb_boot.h"
-#include "common.h"
-
-#define USB_ENDPOINT_IN        0x81
-#define USB_ENDPOINT_OUT       0x01
-#define USB_TIMEOUT            10000
-#define USB_MAX_PACKET_SIZE    1024 * 1024 * 10
-
-#define SLEEP_MS       100
-#define ITERATIONS     50
-
-static int usb_write(void *f, const void *data, size_t size)
-{
-       while (size > 0) {
-               int bt, ss = size;
-               if (ss > USB_MAX_PACKET_SIZE)
-                       ss = USB_MAX_PACKET_SIZE;
-               if (libusb_bulk_transfer(f, USB_ENDPOINT_OUT, (unsigned char *) data, ss, &bt,
-                    USB_TIMEOUT))
-                       return -1;
-               data = (char *) data + bt;
-               size -= bt;
-       }
-       return 0;
-}
-
-static int usb_read(void *f, void *data, size_t size)
-{
-       while (size > 0) {
-               int bt, ss = size;
-               if (ss > USB_MAX_PACKET_SIZE)
-                       ss = USB_MAX_PACKET_SIZE;
-               if (libusb_bulk_transfer(f, USB_ENDPOINT_IN, data, ss, &bt, USB_TIMEOUT))
-                       return -1;
-               data = (char *) data + bt;
-               size -= bt;
-       }
-       return 0;
-}
-
-void *usblink_open(const char *path)
-{
-       int rc;
-       libusb_device_handle *h = NULL;
-       libusb_device *dev;
-
-       rc = usb_find_device(0, (char *) path, 0, (void **) &dev,
-                            DEFAULT_OPEN_VID, DEFAULT_OPEN_PID);
-       if (rc < 0)
-               return 0;
-
-       rc = libusb_open(dev, &h);
-       if (rc < 0) {
-               libusb_unref_device(dev);
-               return 0;
-       }
-
-       libusb_unref_device(dev);
-       rc = libusb_claim_interface(h, 0);
-       if (rc < 0) {
-               libusb_close(h);
-               return 0;
-       }
-       return h;
-}
-
-void usblink_close(void *f)
-{
-       libusb_release_interface(f, 0);
-       libusb_close(f);
-}
-
-void usblink_resetall()
-{
-       libusb_device **devs;
-       libusb_device *dev;
-       struct libusb_device_descriptor desc;
-       libusb_device_handle *h;
-       size_t i;
-       int rc, iters = 0, cnt_bootrom = 0, cnt_runtime = 0, cnt_after = 0;
-
-       if ((rc = libusb_get_device_list(NULL, &devs)) < 0)
-               return;
-       i = 0;
-       while ((dev = devs[i++]) != NULL) {
-               if (libusb_get_device_descriptor(dev, &desc) < 0)
-                       continue;
-               if (desc.idVendor == DEFAULT_VID &&
-                       desc.idProduct == DEFAULT_PID)
-                       cnt_bootrom++;
-               // If Runtime device found, reset it
-               if (desc.idVendor == DEFAULT_OPEN_VID &&
-                   desc.idProduct == DEFAULT_OPEN_PID) {
-                       cnt_runtime++;
-                       rc = libusb_open(dev, &h);
-                       if (rc < -1)
-                               continue;
-                       rc = libusb_claim_interface(h, 0);
-                       if (rc < 0) {
-                               libusb_close(h);
-                               continue;
-                       }
-                       PRINT_DEBUG(stderr, "Found stale device, resetting\n");
-                       usblink_resetmyriad(h);
-                       usblink_close(h);
-               }
-       }
-       // If some devices needed reset
-       if(cnt_runtime > 0){
-               iters = 0;
-               // Wait until all devices re-enumerate, or timeout occurs
-               while((cnt_after < cnt_bootrom + cnt_runtime) && (iters < ITERATIONS)){
-                       usleep(SLEEP_MS*1000);
-                       cnt_after = 0;
-                       if ((rc = libusb_get_device_list(NULL, &devs)) < 0)
-                               return;
-                       i = 0;
-                       while ((dev = devs[i++]) != NULL) {
-                               if ((rc = libusb_get_device_descriptor(dev, &desc)) < 0)
-                                       continue;
-                               if (desc.idVendor == DEFAULT_VID &&
-                                       desc.idProduct == DEFAULT_PID)
-                                       cnt_after++;
-                       }
-                       iters++;
-               }
-       }
-       libusb_free_device_list(devs, 1);
-}
-
-int usblink_setdata(void *f, const char *name, const void *data,
-                   unsigned int length, int host_ready)
-{
-       usbHeader_t header;
-       memset(&header, 0, sizeof(header));
-       header.cmd = USB_LINK_HOST_SET_DATA;
-       header.hostready = host_ready;
-       strcpy(header.name, name);
-       header.dataLength = length;
-       if (usb_write(f, &header, sizeof(header)))
-               return -1;
-
-       unsigned int operation_permit = 0xFFFF;
-       if (usb_read(f, &operation_permit, sizeof(operation_permit)))
-               return -1;
-
-       if (operation_permit != 0xABCD)
-               return -1;
-       int rc = usb_write(f, data, length);
-       return rc;
-}
-
-int usblink_getdata(void *f, const char *name, void *data, unsigned int length,
-                   unsigned int offset, int host_ready)
-{
-       usbHeader_t header;
-       memset(&header, 0, sizeof(header));
-       header.cmd = USB_LINK_HOST_GET_DATA;
-       header.hostready = host_ready;
-       strcpy(header.name, name);
-       header.dataLength = length;
-       header.offset = offset;
-       if (usb_write(f, &header, sizeof(header)))
-               return -1;
-
-       unsigned int operation_permit = 0xFFFF;
-       if (usb_read(f, &operation_permit, sizeof(operation_permit)))
-               return -1;
-
-       if (operation_permit != 0xABCD)
-               return -1;
-       return usb_read(f, data, length);
-}
-
-int usblink_resetmyriad(void *f)
-{
-       usbHeader_t header;
-       memset(&header, 0, sizeof(header));
-       header.cmd = USB_LINK_RESET_REQUEST;
-       if (usb_write(f, &header, sizeof(header)))
-               return -1;
-       return 0;
-}
-
-int usblink_getmyriadstatus(void *f, myriadStatus_t* myriad_state)
-{
-       usbHeader_t header;
-       memset(&header, 0, sizeof(header));
-       header.cmd = USB_LINK_GET_MYRIAD_STATUS;
-       if (usb_write(f, &header, sizeof(header)))
-               return -1;
-       return usb_read(f, myriad_state, sizeof(*myriad_state));
-}
diff --git a/api/src/version.txt b/api/src/version.txt
new file mode 100644 (file)
index 0000000..ce4879c
--- /dev/null
@@ -0,0 +1 @@
+2.04.00.06
diff --git a/docs/Caffe.md b/docs/Caffe.md
deleted file mode 100644 (file)
index fea53db..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-# Caffe Support
-
-## Introduction
-[Caffe](http://caffe.berkeleyvision.org/) is a deep learning framework developed by Berkeley AI Research ([BAIR](http://bair.berkley.edu)) and by community contributors. The setup script currently downloads Berkley Vision and Learning Center (BVLC) Caffe and installs it in a system location. Other versions of Caffe are not supported at this time. For more information, please visit http://caffe.berkeleyvision.org/.
-
-* Default Caffe installation location: /opt/movidius/caffe<br>
-* Check out Berkley Vision's Web Image Classification [demo](http://demo.caffe.berkeleyvision.org/)
-
-## Caffe Zoo
-Berkley Vision hosts a Caffe Model Zoo for researchers and engineers to contribute Caffe models for various tasks. Please visit the [Berkley Caffe Zoo](http://caffe.berkeleyvision.org/model_zoo.html) page to learn more about the caffe zoo, how to create your own Caffe Zoo model, and contribute.
-
-Caffe Zoo has several models contributed, including a model network that can classify images for age and gender. This network, trained by [Gil Levi](https://gist.github.com/GilLevi) and Tal Hassner, is available at [Gender Net Caffe Zoo Model on GitHub](https://gist.github.com/GilLevi/c9e99062283c719c03de).
-
-Caffe models consists of two files that are used for compiling the caffe model using the [Neural Compute Compiler](tools/compile.md).
-* Caffe Network Description (.prototxt): Text file that describes the topology and layers of the network
-* Caffe Weights (.caffemodel): Contains the weights for each layer that are obtained after training a model
-
-## Neural Compute Caffe Layer Support
-The following layers are supported in Caffe by the Intel® Movidius™ Neural Compute SDK. The Intel® Movidius™ Neural Compute Stick does not support training, so some layers that are only required for training are not supported.
-
-### Activation/Neuron  
-* bias
-* elu
-* prelu
-* relu
-* scale
-* sigmoid
-* tanh
-
-### Common     
-* inner_product
-
-### Normalization      
-* batch_norm
-* lrn
-
-### Utility    
-* concat
-* eltwise
-* flatten
-* parameter
-* reshape
-* slice
-* softmax
-
-### Vision     
-* conv 
-  * Regular Convolution - 1x1s1, 3x3s1, 5x5s1, 7x7s1, 7x7s2, 7x7s4
-  * Group Convolution - <1024 groups total
-* deconv
-* pooling
-
-# Known Issues
-### Caffe Input Layer
-
-Limitation: Batch Size, which is the first dimension, must always be 1
-
-Limitation: The number of inputs must be 1
-
-Limitation: We don't support this "input_param" format for the input layer:
-
-```
-1 name: "GoogleNet" 
-2 layer { 
-3   name: "data" 
-4   type: "Input" 
-5   top: "data" 
-6   input_param { shape: { dim: *10* dim: 3 dim: 224 dim: 224 } } 
-7 } 
-```
-
-We only support this "input_shape" format for the input layer:
-
-```
-name: "GoogleNet" 
-input: "data"
- input_shape 
-{ dim:1 dim:3 dim:224 dim:224 } 
-```
-
-### Input Name
-Input name should be always called "data"
-This works:
-```
-name: "GoogleNet" 
-input: "data"
- input_shape 
-{ dim:1 dim:3 dim:224 dim:224 } 
-```
-This does not:
-```
-name: "GoogleNet" 
-input: "data_x"
- input_shape 
-{ dim:1 dim:3 dim:224 dim:224 } 
-```
-
-### Non-Square Convolutions
-Limitation: We don't support non-square convolutions such as 1x20.
-```
-input: "data"
- input_shape 
-{ dim:1 dim:1 dim:1 dim:64 } 
-layer {
- name: "conv1_x"
- type: "Convolution"
- bottom: "data"
- top: "conv1_x"
-  convolution_param {
-   num_output: 3
-   kernel_h: 1
-   kernel_w: 20
-   stride: 1
-  }
-```
-
-### Crop Layer
-Limitation: Crop layer cannot take reference size layer from input:"data".
-
-```
-layer {
-  name: "score"
-  type: "Crop"
-  bottom: "upscore"
-  bottom: "data"
-  top: "score"
-  crop_param {
-    axis: 2
-    offset: 18
-  }
-}
-```
-
-### Size Limitations
-Compiled Movidius "graph" file < 320 MB; 
-Intermediate layer buffer size < 100 MB
-```
-[Error 35] Setup Error: Not enough resources on Myriad to process this network
-```
-
-Scratch Memory size < 112 KB
-
-```
-[Error 25] Myriad Error: "Matmul scratch memory [112640] lower than required [165392]"
-```
-
-## Caffe Networks
-The following networks are validated and known to work on the Intel Movidius Neural Compute SDK:
-- GoogleNet V1
-- SqueezeNet V1.1
-- LeNet
-- CaffeNet
-- VGG (Sousmith VGG_A)
-- AlexNet
-- TinyYolo v1
diff --git a/docs/TOC.html b/docs/TOC.html
new file mode 100644 (file)
index 0000000..4c51099
--- /dev/null
@@ -0,0 +1,105 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="intel-movidius-neural-compute-sdk-documentation">Intel® Movidius™ Neural Compute SDK Documentation</h1>
+
+<ul>
+  <li><a href="index.html#Introduction"> Introduction </a>
+    <ul>
+      <li><a href="ncs.html">Intel® Movidius™ Neural Compute Stick</a></li>
+    </ul>
+  </li>
+  <li><a href="index.html#Frameworks"> Frameworks </a>
+    <ul>
+      <li><a href="caffe.html">Caffe</a></li>
+      <li><a href="tensorflow.html">TensorFlow™</a>
+        <ul>
+          <li><a href="tf_modelzoo.html">Guidance for Compiling TensorFlow™ Model Zoo Networks</a></li>
+          <li><a href="tf_slim.html">Guidance for Compiling TensorFlow-Slim Networks</a></li>
+          <li><a href="tf_compile_guidance.html">Guidance for Compiling TensorFlow™ Networks</a></li>
+        </ul>
+      </li>
+      <li><a href="configure_network.html">Configuring Networks for the NCSDK</a></li>
+    </ul>
+  </li>
+  <li><a href="index.html#NcSdkTools">Intel® Movidius™ Neural Compute SDK Tools </a>
+    <ul>
+      <li><a href="tools/compile.html">mvNCCompile</a></li>
+      <li><a href="tools/profile.html">mvNCProfile</a></li>
+      <li><a href="tools/check.html">mvNCCheck</a></li>
+    </ul>
+  </li>
+  <li><a href="index.html#NcApi">Neural Compute API </a>
+    <ul>
+      <li><a href="ncapi/readme.html">Documentation Overview</a>
+        <ul>
+          <li><a href="ncapi/ncapi2/py_api/readme.html">Python API</a>
+            <ul>
+              <li><a href="ncapi/python_api_migration.html">Python NCAPI v1 to NCAPI v2 Migration</a></li>
+            </ul>
+          </li>
+          <li><a href="ncapi/ncapi2/c_api/readme.html">C API</a>
+            <ul>
+              <li><a href="ncapi/c_api_migration.html">C NCAPI v1 to NCAPI v2 Migration</a></li>
+            </ul>
+          </li>
+        </ul>
+      </li>
+    </ul>
+  </li>
+  <li><a href="index.html#Installation"> Installation</a>
+    <ul>
+      <li><a href="install.html">Basic Installation</a></li>
+      <li><a href="virtualenv.html">Installation with a Python virtualenv</a></li>
+      <li><a href="vm_config.html">Virtual Machine Installation</a></li>
+      <li><a href="docker.html">Docker Installation</a></li>
+    </ul>
+  </li>
+  <li><a href="index.html#Examples">Examples </a></li>
+  <li><a href="index.html#AppZoo">Neural Compute App Zoo</a></li>
+  <li><a href="index.html#ReleaseNotes">Release Notes </a></li>
+  <li><a href="index.html#UserForum">Intel® Movidius™ User Forum </a></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/TOC.md b/docs/TOC.md
deleted file mode 100644 (file)
index 2887a46..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-# NC SDK Documentation Table of Contents
-
--  <a href="{{ "index.html#Introduction" | absolute_url }}"> Introduction </a>
-    - [Intel® Movidius™ NCS Architecture](ncs1arch.md)
-
--  <a href="{{ "index.html#Frameworks" | absolute_url }}"> Frameworks </a>
-    - [Caffe Support](Caffe.md)
-    - [TensorFlow™ Support](TensorFlow.md)
-      - [Guidance for Compiling TensorFlow™ Networks](tf_compile_guidance.md)
-    - [Configure Networks for NCS](configure_network.md)
-
-- <a href="{{ "index.html#InstallAndExamples" | absolute_url }}"> Installation and examples </a>
-    - [Detailed Installation Instructions](install.md)
-        - [Virtual Machine Configuration](VirtualMachineConfig.md)
-        - [Installation Manifiest](manifest.md)
-
-- <a href="{{ "index.html#NcSdkTools" | absolute_url }}">NC SDK Tools </a>
-    - [mvNCCompile](tools/compile.md)
-    - [mvNCProfile](tools/profile.md)
-    - [mvNCCheck](tools/check.md)
-
-- <a href="{{ "index.html#NcApi" | absolute_url }}">Neural Compute API </a>
-    - [Python API](py_api/readme.md)
-    - [C API](c_api/readme.md)
-
-- <a href="{{ "index.html#UserForum" | absolute_url }}">Neural Compute User Forum </a>
-
-- <a href="{{ "index.html#Examples" | absolute_url }}">Examples </a>
-
-- <a href="{{ "index.html#AppZoo" | absolute_url }}">Neural Compute App Zoo </a>
-
-- <a href="{{ "index.html#TroubleShooting" | absolute_url }}">Troubleshooting </a>
-
-- <a href="{{ "index.html#ReleaseNotes" | absolute_url }}">Release Notes </a>
diff --git a/docs/TensorFlow.md b/docs/TensorFlow.md
deleted file mode 100644 (file)
index 1488546..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-# TensorFlow™ Support
-
-# Introduction
-[TensorFlow™](https://www.tensorflow.org/) is a deep learning framework pioneered by Google. The NCSDK introduced TensorFlow™ support with the 1.09.xx NCSDK release and TensorFlow™ 1.3. Validation for each release happens on the TensorFlow™ version noted in the release notes. As described on the TensorFlow™ website, "TensorFlow™ is an open source software library for numerical computation using data flow graphs. Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) communicated between them."
-
-* Default installation location: /opt/movidius/tensorflow
-
-# TensorFlow Model Zoo
-TensorFlow has a model GitHub repo at https://github.com/tensorflow/models similar to the Caffe Zoo for Caffe. The TensorFlow models GitHub repository contains several models that are maintained by the respective authors, unlike Caffe, which is not a single GitHub repo.
-
-# Save Session with Graph and Checkpoint Information
-The code below shows one way to save a tensorflow session which can be compiled for the NCS.
-```python
-import numpy as np
-import tensorflow as tf
-
-from tensorflow.contrib.slim.nets import inception
-
-slim = tf.contrib.slim
-
-def run(name, image_size, num_classes):
-  with tf.Graph().as_default():
-    image = tf.placeholder("float", [1, image_size, image_size, 3], name="input")
-    with slim.arg_scope(inception.inception_v1_arg_scope()):
-        logits, _ = inception.inception_v1(image, num_classes, is_training=False, spatial_squeeze=False)
-    probabilities = tf.nn.softmax(logits)
-    init_fn = slim.assign_from_checkpoint_fn('inception_v1.ckpt', slim.get_model_variables('InceptionV1'))
-
-    with tf.Session() as sess:
-        init_fn(sess)
-        saver = tf.train.Saver(tf.global_variables())
-        saver.save(sess, "output/"+name)
-
-run('inception-v1', 224, 1001)
-```
-# Compile for TensorFlow
-The command here shows how to compile the saved session from the above code sample
-```
-mvNCCompile output/inception-v1.meta -in=input -on=InceptionV1/Logits/Predictions/Reshape_1 -s12
-
-```
-
-# Guidence for Compiling TensorFlow Networks
-If you are training a TensorFlow network you will want to [follow the guidance for creating an inference only version of the network](tf_compile_guidance.md) that is suitable for compiling via the ncsdk compiler.
-
-# TensorFlow Networks Supported
-* Inception V1
-* Inception V2
-* Inception V3
-* Inception V4
-* Inception ResNet V2
-* MobileNet_v1_1.0 variants:
-    * MobileNet_v1_1.0_224
-    * MobileNet_v1_1.0_192
-    * MobileNet_v1_1.0_160
-    * MobileNet_v1_1.0_128
-    * MobileNet_v1_0.75_224
-    * MobileNet_v1_0.75_192
-    * MobileNet_v1_0.75_160
-    * MobileNet_v1_0.75_128
-    * MobileNet_v1_0.5_224
-    * MobileNet_v1_0.5_192
-    * MobileNet_v1_0.5_160
-    * MobileNet_v1_0.5_128
-    * MobileNet_v1_0.25_224
-    * MobileNet_v1_0.25_192
-    * MobileNet_v1_0.25_160
-    * MobileNet_v1_0.25_128
-    
-_*see release notes for supported networks for a particular release_
-
-
diff --git a/docs/VirtualMachineConfig.md b/docs/VirtualMachineConfig.md
deleted file mode 100644 (file)
index b7e20cd..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# Virtual Machine Configurations
-
-The following configuration has been tested with the 1.09 SDK release.
-
-## General Requirements
-- Virtualbox 5.1.28 (later releases should be fine, but have not been tested)
-- Guest Extensions installed
-- You will need to select USB 3.0 and create two filters: 
-  - USB2 filter with vendor ID 03e7
-  - USB3 filter with vendor ID 040e
-- Host OS (these have been tested, other may work):
-  - OS X Yosemite 10.10.5
-  - Windows 10 Enterprise
-  - Ubuntu 16.04 Desktop
-- Guest OS: 
-  - Ubuntu 16.04 Desktop
-
-## Installation Order
-- Install Ubuntu 16.04 on VM
-- Install updates (apt-get update, apt-get upgrade)
-- Install guest extensions (virtualbox menu devices / Insert guest additions CD image)
-- Setup USB filters
-- Install NCSDK with 'make install' ([Installation Instructions](install.md))
-- Insert Intel® Movidius™ NCS device to USB port
-- Install examples with 'make examples'; if it doesn’t work, re-insert key and try again
-
-## Notes
-- During operation applications, will need 2s delay between close and re-opening NCS device
-- VM RAM needs to be 2 GB, or caffe compile will likely fail
diff --git a/docs/_config.yml b/docs/_config.yml
deleted file mode 100644 (file)
index 58aadec..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-title: Movidius™ Neural Compute SDK
-description: Home of the ncsdk used to develop software for the Movidius™ Neural Compute Stick
-theme: jekyll-theme-modernist
diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html
deleted file mode 100644 (file)
index fc26faf..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<!doctype html>
-<html lang="{{ site.lang | default: "en-US" }}">
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="chrome=1">
-
-    <link href='https://fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700' rel='stylesheet' type='text/css'>
-    <link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
-    <script src="{{ '/assets/js/scale.fix.js' | relative_url }}"></script>
-    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
-
-    <!--[if lt IE 9]>
-    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
-    <![endif]-->
-  </head>
-  <body>
-    <div class="wrapper">
-      <header {% unless site.description or site.github.project_tagline %} class="without-description" {% endunless %}>
-        <h1 style="color:#FFFFFF;text-shadow:none">{{ site.title | default: site.github.repository_name }}</h1>
-        {% if site.description or site.github.project_tagline %}
-          <p style="color:#FFFFFF;">{{ site.description | default: site.github.project_tagline }}</p>
-        {% endif %}
-        <p class="view"><a href="{{ site.github.repository_url }}">View the Project on GitHub <small>{{ github_name }}</small></a></p>
-        <ul>
-        {% if site.show_downloads %}
-          <li><a href="{{ site.github.zip_url }}">Download <strong>ZIP File</strong></a></li>
-          <li><a href="{{ site.github.tar_url }}">Download <strong>TAR Ball</strong></a></li>
-        {% endif %}
-          <li>  <a href={{ "index.html#Introduction" | absolute_url }}><small>Docs Home</small></a> </li>
-          <li>  <a href={{ "TOC.html" | absolute_url }}><small>Table of Contents</small></a> </li>
-          <li>  <a href={{ "index.html#NcSdkTools" | absolute_url }}><small>SDK Tools</small></a> </li> 
-           <li> <a href={{ "index.html#NcApi" | absolute_url }}><small>Neural Compute API</small></a> 
-          <li>  <a href="{{ site.github.repository_url }}">View On <strong>GitHub</strong></a></li>
-        </ul>
-      </header>
-
-      <section>
-
-      {{ content }}
-
-      </section>
-    </div>
-    <footer>
-    {% if site.github.is_project_page %}
-      <p>Project maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></p>
-    {% endif %}
-      
-    </footer>
-    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
-
-    {% if site.google_analytics %}
-      <script type="text/javascript">
-        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
-        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
-        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-        ga('create', '{{ site.google_analytics }}', 'auto');
-        ga('send', 'pageview');
-      </script>
-    {% endif %}
-  </body>
-</html>
diff --git a/docs/assets/css/style.css b/docs/assets/css/style.css
new file mode 100644 (file)
index 0000000..2ef3b35
--- /dev/null
@@ -0,0 +1,364 @@
+/*
+   generated by rouge http://rouge.jneen.net/
+   original base16 by Chris Kempson (https://github.com/chriskempson/base16)
+*/
+.highlight table td {
+  padding: 5px; }
+
+.highlight table pre {
+  margin: 0; }
+
+.highlight, .highlight .w {
+  color: #d0d0d0; }
+
+.highlight .err {
+  color: #151515;
+  background-color: #ac4142; }
+
+.highlight .c, .highlight .cd, .highlight .cm, .highlight .c1, .highlight .cs {
+  color: #888; }
+
+.highlight .cp {
+  color: #f4bf75; }
+
+.highlight .nt {
+  color: #f4bf75; }
+
+.highlight .o, .highlight .ow {
+  color: #d0d0d0; }
+
+.highlight .p, .highlight .pi {
+  color: #d0d0d0; }
+
+.highlight .gi {
+  color: #90a959; }
+
+.highlight .gd {
+  color: #ac4142; }
+
+.highlight .gh {
+  color: #6a9fb5;
+  font-weight: bold; }
+
+.highlight .k, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kv {
+  color: #aa759f; }
+
+.highlight .kc {
+  color: #d28445; }
+
+.highlight .kt {
+  color: #d28445; }
+
+.highlight .kd {
+  color: #d28445; }
+
+.highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .s1 {
+  color: #90a959; }
+
+.highlight .sr {
+  color: #75b5aa; }
+
+.highlight .si {
+  color: #8f5536; }
+
+.highlight .se {
+  color: #8f5536; }
+
+.highlight .nn {
+  color: #f4bf75; }
+
+.highlight .nc {
+  color: #f4bf75; }
+
+.highlight .no {
+  color: #f4bf75; }
+
+.highlight .na {
+  color: #6a9fb5; }
+
+.highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mb, .highlight .mx {
+  color: #90a959; }
+
+.highlight .ss {
+  color: #90a959; }
+
+html {
+  background: #6C7989;
+  background: #6C7989 linear_gradient(#6C7989, #434B55) fixed; }
+
+body {
+  padding: 50px 0;
+  margin: 0;
+  font: 14px/1.5 Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
+  color: #555;
+  font-weight: 300;
+  background: inline-image("checker.png") fixed; }
+
+.wrapper {
+  width: 640px;
+  margin: 0 auto;
+  background: #DEDEDE;
+  border-radius: 8px;
+  box-shadow: rgba(0, 0, 0, 0.2) 0 0 0 1px, rgba(0, 0, 0, 0.45) 0 3px 10px; }
+
+header, section, footer {
+  display: block; }
+
+a {
+  color: #069;
+  text-decoration: none; }
+
+p {
+  margin: 0 0 20px;
+  padding: 0; }
+
+strong {
+  color: #222;
+  font-weight: 700; }
+
+header {
+  border-radius: 8px 8px 0 0;
+  background: #C6EAFA;
+  background: linear_gradient(#DDFBFC, #C6EAFA);
+  position: relative;
+  padding: 15px 20px;
+  border-bottom: 1px solid #B2D2E1; }
+  header h1 {
+    margin: 0;
+    padding: 0;
+    font-size: 24px;
+    line-height: 1.2;
+    color: #069;
+    text-shadow: rgba(255, 255, 255, 0.9) 0 1px 0; }
+  header.without-description h1 {
+    margin: 10px 0; }
+  header p {
+    margin: 0;
+    color: #61778B;
+    width: 300px;
+    font-size: 13px; }
+    header p.view {
+      display: none;
+      font-weight: 700;
+      text-shadow: rgba(255, 255, 255, 0.9) 0 1px 0;
+      -webkit-font-smoothing: antialiased; }
+      header p.view a {
+        color: #06c; }
+      header p.view small {
+        font-weight: 400; }
+  header ul {
+    margin: 0;
+    padding: 0;
+    list-style: none;
+    position: absolute;
+    z-index: 1;
+    right: 20px;
+    top: 20px;
+    height: 38px;
+    padding: 1px 0;
+    background: #5198DF;
+    background: linear_gradient(#77B9FB, #3782CD);
+    border-radius: 5px;
+    box-shadow: inset rgba(255, 255, 255, 0.45) 0 1px 0, inset rgba(0, 0, 0, 0.2) 0 -1px 0;
+    width: auto; }
+    header ul:before {
+      content: '';
+      position: absolute;
+      z-index: -1;
+      left: -5px;
+      top: -4px;
+      right: -5px;
+      bottom: -6px;
+      background: rgba(0, 0, 0, 0.1);
+      border-radius: 8px;
+      box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0, inset rgba(255, 255, 255, 0.7) 0 -1px 0; }
+    header ul li {
+      width: 79px;
+      float: left;
+      border-right: 1px solid #3A7CBE;
+      height: 38px; }
+      header ul li.single {
+        border: none; }
+    header ul li + li {
+      width: 78px;
+      border-left: 1px solid #8BBEF3; }
+    header ul li + li + li {
+      border-right: none;
+      width: 79px; }
+    header ul a {
+      line-height: 1;
+      font-size: 11px;
+      color: #fff;
+      color: rgba(255, 255, 255, 0.8);
+      display: block;
+      text-align: center;
+      font-weight: 400;
+      padding-top: 6px;
+      height: 40px;
+      text-shadow: rgba(0, 0, 0, 0.4) 0 -1px 0; }
+      header ul a strong {
+        font-size: 14px;
+        display: block;
+        color: #fff;
+        -webkit-font-smoothing: antialiased; }
+
+section {
+  padding: 15px 20px;
+  font-size: 15px;
+  border-top: 1px solid #fff;
+  background: linear_gradient(#fafafa, #DEDEDE 700px);
+  border-radius: 0 0 8px 8px;
+  position: relative; }
+
+h1, h2, h3, h4, h5, h6 {
+  color: #222;
+  padding: 0;
+  margin: 0 0 20px;
+  line-height: 1.2; }
+
+p, ul, ol, table, pre, dl {
+  margin: 0 0 20px; }
+
+h1, h2, h3 {
+  line-height: 1.1; }
+
+h1 {
+  font-size: 28px; }
+
+h2 {
+  color: #393939; }
+
+h3, h4, h5, h6 {
+  color: #494949; }
+
+blockquote {
+  margin: 0 -20px 20px;
+  padding: 15px 20px 1px 40px;
+  font-style: italic;
+  background: #ccc;
+  background: rgba(0, 0, 0, 0.06);
+  color: #222; }
+
+img {
+  max-width: 100%; }
+
+code, pre {
+  font-family: Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal;
+  color: #333;
+  font-size: 12px;
+  overflow-x: auto; }
+
+pre {
+  padding: 20px;
+  background: #3A3C42;
+  color: #f8f8f2;
+  margin: 0 -20px 20px; }
+  pre code {
+    color: #f8f8f2; }
+  li pre {
+    margin-left: -60px;
+    padding-left: 60px; }
+
+table {
+  width: 100%;
+  border-collapse: collapse; }
+
+th, td {
+  text-align: left;
+  padding: 5px 10px;
+  border-bottom: 1px solid #aaa; }
+
+dt {
+  color: #222;
+  font-weight: 700; }
+
+th {
+  color: #222; }
+
+small {
+  font-size: 11px; }
+
+hr {
+  border: 0;
+  background: #aaa;
+  height: 1px;
+  margin: 0 0 20px; }
+
+footer {
+  width: 640px;
+  margin: 0 auto;
+  padding: 20px 0 0;
+  color: #ccc;
+  overflow: hidden; }
+  footer a {
+    color: #fff;
+    font-weight: bold; }
+  footer p {
+    float: left; }
+  footer p + p {
+    float: right; }
+
+@media print, screen and (max-width: 740px) {
+  body {
+    padding: 0; }
+
+  .wrapper {
+    border-radius: 0;
+    box-shadow: none;
+    width: 100%; }
+
+  footer {
+    border-radius: 0;
+    padding: 20px;
+    width: auto; }
+    footer p {
+      float: none;
+      margin: 0; }
+    footer p + p {
+      float: none; } }
+@media print, screen and (max-width: 580px) {
+  header ul {
+    display: none; }
+
+  header p.view {
+    display: block; }
+
+  header p {
+    width: 100%; } }
+@media print {
+  header p.view a small:before {
+    content: 'at https://github.com/'; } }
+header {
+  background: #0066D7;
+  color: #00FF00; }
+
+header ul {
+  background: #2a2e67; }
+
+header a {
+  color: #FFFFFF; }
+
+ul a {
+  color: #0066d7; }
+
+a {
+  color: #0066d7; }
+
+ul li ul {
+  margin: 0 0 0px; }
+
+h1 {
+  padding-top: 25px; }
+
+h2, h3 {
+  padding-top: 10px; }
+
+h1:first-of-type {
+  padding-top: 0px; }
+
+p {
+  color: #61778B; }
+
+.wrapper {
+  width: 900px;
+  background: #FAFAFA; }
diff --git a/docs/assets/css/style.scss b/docs/assets/css/style.scss
deleted file mode 100644 (file)
index e4c05af..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
----
----
-
-@import "{{ site.theme }}";
-
-header 
-{
-  background:#0066D7;
-  color:#00FF00
-}
-
-header ul
-{
-  background:#2a2e67;
-}
-
-ul a
-{
-    color:#0066d7;
-}
-
-a
-{
-  color:#0066d7;
-}
-
-p
-{
-    color:#61778B;
-    font-weight: bold;
-}
-
-.wrapper
-{
-  width: 900px;
-  background:#FAFAFA;
-}
diff --git a/docs/assets/images/checker.png b/docs/assets/images/checker.png
new file mode 100644 (file)
index 0000000..7a65b23
Binary files /dev/null and b/docs/assets/images/checker.png differ
diff --git a/docs/assets/js/scale.fix.js b/docs/assets/js/scale.fix.js
new file mode 100644 (file)
index 0000000..08716c0
--- /dev/null
@@ -0,0 +1,20 @@
+fixScale = function(doc) {
+
+       var addEvent = 'addEventListener',
+           type = 'gesturestart',
+           qsa = 'querySelectorAll',
+           scales = [1, 1],
+           meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
+
+       function fix() {
+               meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
+               doc.removeEventListener(type, fix, true);
+       }
+
+       if ((meta = meta[meta.length - 1]) && addEvent in doc) {
+               fix();
+               scales = [.25, 1.6];
+               doc[addEvent](type, fix, true);
+       }
+
+};
\ No newline at end of file
diff --git a/docs/c_api/mvncAllocateGraph.md b/docs/c_api/mvncAllocateGraph.md
deleted file mode 100644 (file)
index ae90548..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-# mvncAllocateGraph()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncOpenDevice](mvncOpenDevice.md), [mvncDeallocateGraph](mvncDeallocateGraph.md)
-
-## Overview
-This function allocates a graph on the specified device and creates a handle to the graph that can be passed to other API functions such as mvncLoadTensor() and mvncGetResult(). When the caller is done with the graph, the mvncDeallocateGraph() function should be called to free the resources associated with the graph.
-
-## Prototype
-
-```C
-mvncStatus mvncAllocateGraph(void *deviceHandle, void **graphHandle, const void *graphFile, unsigned int graphFileLength);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-deviceHandle|void\*|The deviceHandle pointer to the opaque device datatype (which was created via mvncOpenDevice()) on which the graph should be allocated.
-graphHandle|void\*\*|Address of a pointer that will be set to point to an opaque graph datatype. Upon successful return, this graphHandle can be passed to other API funtions.
-graphFile|const void\* | Pointer to a buffer that contains the contents of a graph file. The graph file is a compiled neural network file that gets created by the MvNCCompile SDK tool.  
-graphFileLength|unsigned int|The number of bytes allocated for the buffer that graphFile points to.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-- Be sure to call mvncDeallocateGraph() for the graphHandle returned from this function.
-
-## Example
-```C
-
-// Graph file name
-#define GRAPH_FILE_NAME "graphfile"
-
-int main(int argc, char** argv)
-{
-    void* deviceHandle; 
-    
-    //
-    // Assume NCS device opened here and deviceHandle is valid now.
-    //
-    
-    // Now read in a graph file so graphFileBuf will point to the 
-    // bytes of the file in a memory buffer and graphFileLen will be
-    // set to the number of bytes in the graph file and memory buffer.
-    unsigned int graphFileLen;
-    void* graphFileBuf = LoadFile(GRAPH_FILE_NAME, &graphFileLen);
-
-    // Allocate the graph
-    void* graphHandle;
-    retCode = mvncAllocateGraph(deviceHandle, &graphHandle, graphFileBuf, graphFileLen);
-    if (retCode != MVNC_OK)
-    {   // Error allocating graph
-        printf("Could not allocate graph for file: %s\n", GRAPH_FILE_NAME); 
-    }
-    else
-    {   // Successfully allocated graph. Now graphHandle is ready to go.  
-        // Use graphHandle for other API calls and call mvncDeallocateGraph
-        // when done with it.
-        printf("Successfully allocated graph for %s\n", GRAPH_FILE_NAME);
-        
-        retCode = mvncDeallocateGraph(graphHandle);
-        graphHandle = NULL;
-    }
-    
-    free(graphFileBuf);
-    retCode = mvncCloseDevice(deviceHandle);
-    deviceHandle = NULL;
-}
-
-```
diff --git a/docs/c_api/mvncCloseDevice.md b/docs/c_api/mvncCloseDevice.md
deleted file mode 100644 (file)
index eb70d8f..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-# mvncCloseDevice()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncOpenDevice](mvncOpenDevice.md), [mvncGetDeviceOption](mvncGetDeviceOption.md), [mvncSetDeviceOption](mvncSetDeviceOption.md)
-
-## Overview
-This function is used to cease communication and reset the device.
-
-## Prototype
-
-```C
-mvncStatus mvncCloseDevice(void *deviceHandle);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-deviceHandle|void*|Pointer to the opaque NCS device structure that was allocated and returned from the mvncOpenDevice function.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-```C
-#include <stdio.h>
-#include <stdlib.h>
-
-extern "C" 
-{
-#include <mvnc.h>
-}
-// Somewhat arbitrary buffer size for the device name.
-#define NAME_SIZE 100
-int main(int argc, char** argv)
-{
-    mvncStatus retCode;
-    void *deviceHandle;
-    char devName[NAME_SIZE];
-    retCode = mvncGetDeviceName(0, devName, NAME_SIZE);
-    if (retCode != MVNC_OK)
-    {   // failed to get device name, maybe none plugged in.
-        printf("No NCS devices found\n");
-        exit(-1);
-    }
-    
-    // Try to open the NCS device via the device name.
-    retCode = mvncOpenDevice(devName, &deviceHandle);
-    if (retCode != MVNC_OK)
-    {   // Failed to open the device.  
-        printf("Could not open NCS device\n");
-        exit(-1);
-    }
-    
-    // deviceHandle is ready to use now.  
-    // Pass it to other NC API calls as needed and close it when finished.
-    printf("Successfully opened NCS device!\n");
-    
-    // Close the device previously opened by mvncOpenDevice().
-    retCode = mvncCloseDevice(deviceHandle);
-}
-```
diff --git a/docs/c_api/mvncDeallocateGraph.md b/docs/c_api/mvncDeallocateGraph.md
deleted file mode 100644 (file)
index 6d96e6c..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-# mvncDeallocateGraph()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncOpenDevice](mvncOpenDevice.md), [mvncAllocateGraph](mvncAllocateGraph.md)
-
-## Overview
-This function deallocates a graph that was previously allocated with mvncAllocateGraph(). After successful return from this function, the passed graphHandle will be invalid and should not be used.
-
-## Prototype
-
-```C
-mvncStatus mvncDeallocateGraph(void *graphHandle);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-graphHandle|void\*\*|Pointer to opaque graph data type that was initialized with the mvncAllocateGraph() function.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-Using a deallocated graph handle can lead to hard-to-find bugs. To prevent this, it's good practice to set the handle to NULL (or nullptr for C++ 11) after deallocating, as shown in this code snippet:
-```C++
-mvncDeallocateGraph(graphHandle);
-graphHandle = NULL;
-```
-
-## Example
-```C
-// Graph file name
-#define GRAPH_FILE_NAME "graphfile"
-
-int main(int argc, char** argv)
-{
-    void* deviceHandle; 
-    
-    .
-    .
-    .
-    
-    //
-    // Assume NCS device opened here and deviceHandle is valid now
-    // and the graph file is in graphFileBuf and length in bytes  
-    // is in graphFileLen.
-    //
-
-    // Allocate the graph
-    void* graphHandle;
-    retCode = mvncAllocateGraph(deviceHandle, &graphHandle, graphFileBuf, graphFileLen);
-    if (retCode != MVNC_OK)
-    {   // Error allocating graph
-        printf("Could not allocate graph for file: %s\n", GRAPH_FILE_NAME); 
-    }
-    else
-    {   // Successfully allocated graph. Now graphHandle is ready to go.  
-        // Use graphHandle for other API calls, and call mvncDeallocateGraph
-        // when done with it.
-        printf("Successfully allocated graph for %s\n", GRAPH_FILE_NAME);
-        
-        retCode = mvncDeallocateGraph(graphHandle);
-        graphHandle = NULL;
-    }
-.
-.
-.
-
-}
-```
diff --git a/docs/c_api/mvncDeviceOptions.md b/docs/c_api/mvncDeviceOptions.md
deleted file mode 100644 (file)
index c706abe..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# mvncDeviceOptions enumeration
-
-Info | Value/s
------------- | -------------
-Header|mvnc.h
-Version|1.0
-See also|[mvncGetDeviceOption](mvncGetDeviceOption.md), [mvncSetDeviceOption](mvncSetDeviceOption.md), [mvncOpenDevice](mvncOpenDevice.md) 
-
-## Overview
-
-This enumeration is used to specify an option on the Intel® Movidius™ NCS device that can be written or read via mvncGetDeviceOption() and mvncSetDeviceOption(). The table below provides details on the meaning of each of the values in the enumeration.
-
-Constant | Option Type | Possible Values | Get/Set | Description
--------- | ------------| --------------- | ------- | -----------
-MVNC_THERMAL_THROTTLING_LEVEL|int|1, 2|get|1: if lower guard temperature threshold of chip sensor is reached. This indicates short throttling time is in action between inferences to protect the device. <br>2: if upper guard temperature of chip sensor is reached. This indicates long throttling time is in action between inferences to protect the device.
diff --git a/docs/c_api/mvncGetDeviceName.md b/docs/c_api/mvncGetDeviceName.md
deleted file mode 100644 (file)
index 77f0099..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-# mvncGetDeviceName()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncOpenDevice](mvncOpenDevice.md) 
-
-## Overview
-This function is used to get the name of a particular Intel® Movidius™ NCS device. Typical usage is to call the function repeatedly, starting with index = 0, and incrementing the index each time until an error is returned. These successive calls will give you the names of all the devices in the system.
-
-## Prototype
-
-```C
-mvncStatus mvncGetDeviceName(int index, char* name, unsigned int nameSize);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-index|int|Index of the device for which the name should be retrieved.
-name|char\*|Pointer to a character buffer into which the name will be copied. This buffer should be allocated by the caller.
-nameSize|unsigned int|The number of characters allocated to the buffer pointed to by the name parameter.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-The following example shows how to get the name of all Intel Movidius NCS devices attached to the system. mvncGetDeviceName is called repeatedly until it returns MVNC_DEVICE_NOT_FOUND.
-
-```C++
-#include <stdio.h>
-extern "C" 
-{
-#include <mvnc.h>
-}
-// somewhat arbitrary buffer size for the device name
-#define NAME_SIZE 100
-int main(int argc, char** argv)
-{
-    mvncStatus retCode;
-    int deviceCount = 0;
-    char devName[NAME_SIZE];
-    while ((retCode = mvncGetDeviceName(deviceCount, devName, NAME_SIZE)) != MVNC_DEVICE_NOT_FOUND)
-    {
-        printf("Found NCS device named: \"%s\"\n", devName); 
-        deviceCount++;
-    }
-    printf("Total number of NCS devices found: %d\n", deviceCount);
-}
-```
-Output from the example code above with two Intel Movidius NCS devices in the system.
-
-```
-Found NCS device named: "2.3"
-Found NCS device named: "1"
-Total number of NCS devices found: 2
-```
diff --git a/docs/c_api/mvncGetDeviceOption.md b/docs/c_api/mvncGetDeviceOption.md
deleted file mode 100644 (file)
index d9b2693..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# mvncGetDeviceOption()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncOpenDevice](mvncOpenDevice.md), [mvncDeviceOptions](mvncDeviceOptions.md), [mvncSetDeviceOption](mvncSetDeviceOption.md)
-
-## Overview
-This function gets the current value of an option for an Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) device. The available options and their data types can be found in the [DeviceOptions](mvncDeviceOptions.md) enumeration documentation.
-
-## Prototype
-
-```C
-mvncStatus mvncGetDeviceOption(void *deviceHandle, int option, void *data, unsigned int *datalength);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-deviceHandle|void\*|Pointer to opaque device data type that was initialized with the mvncOpenDevice() function. This specifies which NCS device's option will be retrieved.
-option|int|A value from the DeviceOptions enumeration that specifies which option will be retrieved.
-data|void\*|Pointer to a buffer where the value of the option will be copied. The type of data this points to will depend on the option that is specified. Check mvncDeviceOptions for the data types that each option requires.
-dataLength|unsigned int\*|Pointer to an unsigned int which must point to the size, in bytes, of the buffer allocated to the data parameter when called. Upon successfull return, it will be set to the number of bytes copied to the data buffer.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-```C
-TBD
-```
diff --git a/docs/c_api/mvncGetGlobalOption.md b/docs/c_api/mvncGetGlobalOption.md
deleted file mode 100644 (file)
index b2e94d7..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-
-# mvncGetGlobalOption()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.09
-See also|[mvncGlobalOptions](mvncGlobalOptions.md), [mvncSetGlobalOption](mvncSetGlobalOption.md)
-
-## Overview
-This function gets the current value of an option that is global to the SDK. The available options and their data types can be found in the [mvncGlobalOptions](mvncGlobalOptions.md) enumeration documentation.
-
-## Prototype
-
-```C
-mvncStatus mvncGetGlobalOption(int option, void *data, unsigned int *datalength);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-option|int|A value from the GlobalOptions enumeration that specifies which option will be retrieved.
-data|void\*|Pointer to a buffer where the value of the option will be copied. The type of data this points to will depend on the option that is specified. Check mvncGlobalOptions for the data types that each option requires.
-dataLength|unsigned int\*|Pointer to an unsigned int which must point to the size, in bytes, of the buffer allocated to the data parameter when called. Upon successfull return, it will be set to the number of bytes copied to the data buffer.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-```C
-int len;
-int loggingLevel;
-status = mvncGetGlobalOption(MVNC_LOGLEVEL, &loggingLevel, &len);
-// loggingLevel has the option value now.
-```
diff --git a/docs/c_api/mvncGetGraphOption.md b/docs/c_api/mvncGetGraphOption.md
deleted file mode 100644 (file)
index 7ac7a26..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-# mvncGetGraphOption()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncAllocateGraph](mvncAllocateGraph.md), [mvncGraphOptions](mvncGraphOptions.md), [mvncSetGraphOption](mvncSetGraphOption.md)
-
-## Overview
-This function gets the current value of an option for a graph. The available options can be found in the GraphOptions enumeration.
-
-## Prototype
-
-```C
-mvncStatus mvncGetGraphOption(void *graphHandle, int option, void **data, unsigned int *datalength);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-graphHandle|void\*|Pointer to opaque graph data type that was initialized with the mvncAllocateGraph() function, which represents the neural network. This specifies which graph's option value will be retrieved.
-option|int|A value from the GraphOptions enumeration that specifies which option will be retrieved.
-data|void\*|Pointer to a buffer where the value of the option will be copied. The type of data this points to will depend on the option that is specified. Check mvncGraphOptions for the data types that each option requires.
-dataLength|unsigned int\*|Pointer to an unsigned int, which must point to the size, in bytes, of the buffer allocated to the data parameter when called. Upon successfull return, it will be set to the number of bytes copied to the data buffer.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-```C++
-.
-.
-.
-    // Open device to get device handle, 
-    // allocate the graph to get graph handle.
-
-    // Set the graph option for blocking calls
-    int dontBlockValue;
-    unsigned int sizeOfValue;
-    retCode = mvncGetGraphOption(graphHandle, MVNC_DONTBLOCK, (void**)(&dontBlockValue), &sizeOfValue);
-    if (retCode == MVNC_OK)
-    {
-        printf("Successfully got graph option, value is: %d\n", dontBlockValue);
-    }
-    else
-    {
-        printf("Could not get graph option\n");
-        printf("Error returned from mvncGetGraphOption: %d\n", retCode);
-    }
-
-    // Use graph, deallocate graph, close device, etc.
-    
-    .
-    .
-    .
-
-```
diff --git a/docs/c_api/mvncGetResult.md b/docs/c_api/mvncGetResult.md
deleted file mode 100644 (file)
index 84520ef..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-# mvncGetResult()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library|libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncOpenDevice](mvncOpenDevice.md), [mvncAllocateGraph](mvncAllocateGraph.md), [mvncLoadTensor](mvncLoadTensor.md)
-
-## Overview
-This function retrieves the result of an inference that was initiated via LoadTensor() on the specified graph.  
-
-## Prototype
-
-```C
-mvncStatus mvncGetResult(void *graphHandle, void **outputData, unsigned int *outputDataLength, void **userParam);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-graphHandle|void\*|Pointer to opaque graph data type that was initialized with the mvncAllocateGraph() function that represents the neural network for which an inference was initiated.
-outputData|void\*\*|Address of the pointer that will be set to a buffer of 16-bit floats, which contain the result of the inference. The buffer will contain one 16-bit float for each network category, the values of which are the results of the output node. Typically these values are the probabilities that an image belongs to the category.
-outputDataLength|unsigned int\*|Pointer to an unsigned int that will be set to the number of bytes in the outputData buffer.
-userParam|void\*\*|Address of a pointer that will be set to the user parameter for this inference. This corresponds to the userParam that was passed to the LoadTensor() function, which initiated the inference.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-```C++
-.
-.
-.
-
-// Use a 16-bit unsigned type to represent half precision floats since C++ has no 
-// built-in support for 16-bit floats.
-typedef unsigned short half;
-
-int main(int argc, char** argv)
-{
-.
-.
-.
-    //
-    // Open NCS device and set deviceHandle to the valid handle.
-    //
-    
-    //
-    // Read graph from disk and call mvncAllocateGraph to set graphHandle appropriately.
-    //
-
-    //
-    // Load an image.png from disk and preprocess it to match network 
-    // requirements so that imageBufFp16 list to 16-bit floats.
-    //
-    
-    // Start the inference with call to mvncLoadTensor().
-    retCode = mvncLoadTensor(graphHandle, imageBufFp16, lenBufFp16, NULL);
-    if (retCode == MVNC_OK)
-    {   // The inference has been started, now call mvncGetResult() for the
-        // inference result. 
-        printf("Successfully loaded the tensor for image %s\n", "image.png");
-            
-        void* resultData16;
-        void* userParam;
-        unsigned int lenResultData;
-        retCode = mvncGetResult(graphHandle, &resultData16, &lenResultData, &userParam);
-        if (retCode == MVNC_OK)
-        {   // Successfully got the result. The inference result is in the buffer pointed to by resultData.
-            printf("Successfully got the inference result for image %s\n", IMAGE_FILE_NAME);
-            printf("resultData is %d bytes which is %d 16-bit floats.\n", lenResultData, lenResultData/(int)sizeof(half));
-                
-            // convert half precision floats to full floats
-            int numResults = lenResultData / sizeof(half);
-            float* resultData32;
-            resultData32 = (float*)malloc(numResults * sizeof(*resultData32));
-            fp16tofloat(resultData32, (unsigned char*)resultData16, numResults);
-
-            float maxResult = 0.0;
-            int maxIndex = -1;
-            for (int index = 0; index < numResults; index++)
-            {
-                printf("Category %d is: %f\n", index, resultData32[index]);
-                if (resultData32[index] > maxResult)
-                {
-                    maxResult = resultData32[index];
-                    maxIndex = index;
-                }
-            }
-            printf("index of top result is: %d - probability of top result is: %f\n", maxIndex, resultData32[maxIndex]);
-            free(resultData32);
-        } 
-    }
-
-    // 
-    // Call mvncDeallocateGraph to free the resources tied to graphHandle.
-    // Close the device with mvncCloseDevice().
-    // 
-}
-
-```
diff --git a/docs/c_api/mvncGlobalOptions.md b/docs/c_api/mvncGlobalOptions.md
deleted file mode 100644 (file)
index f918d9a..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# mvncGlobalOptions enumeration
-
-Info | Value/s
------------- | -------------
-Header|mvnc.h
-Version|1.09
-See also|[mvncGetGlobalOption](mvncGetGlobalOption.md), [mvncSetGlobalOption](mvncSetGlobalOption.md)
-
-## Overview
-
-This enumeration is used to specify a global option that can be written or read via mvncGetDeviceOption() and mvncSetDeviceOption().  The table below provides details on the meaning of each of the values in the enumeration.
-
-Constant | Option Type | Possible Values | Get/Set | Description
--------- | ------------| --------------- | ------- | -----------
-MVNC_LOGLEVEL | int |  0, 1, 2 |get, set|The logging level for application  Value meanings are: <br>0: log nothing (default)<br>1: log errors only<br>2: log all, verbose logging. 
diff --git a/docs/c_api/mvncGraphOptions.md b/docs/c_api/mvncGraphOptions.md
deleted file mode 100644 (file)
index 889dab5..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# mvncGraphOptions enumeration
-
-Info | Value/s
------------- | -------------
-Header|mvnc.h
-Version|1.0
-See also|[mvncGetGraphOption](mvncGetGraphOption.md), [mvncSetGraphOption](mvncSetGraphOption.md), [mvncAllocateGraph](mvncAllocateGraph.md) 
-
-## Overview
-
-
-This enumeration is used to specify an option on the graph that can be written or read via mvncGetGraphOption() and mvncSetGraphOption(). The table below provides details on the meaning of each of the values in the enumeration.
-
-Constant | Option Type | Possible Values | Get/Set | Description
--------- | ------------| --------------- | ------- | -----------
-MVNC_DONT_BLOCK| int |0, 1|get, set|0: Calls to mvncLoadTensor and mvncGetResult will block (won't return until the action is completed) (Default)<br>1: Calls to those functions don't block (they will return immediately).  If the action coudn't be completed the return value will indicate why.  mvncLoadTensor() will return MVNC_BUSY when the NCS isn't able to perform the action because its busy, try again later.  mvncGetResult() will return MVNC_NO_DATA unless there is an inference that is ready to be returned.  In this case try again later and when there is a completed inference the results will be returned.
-MVNC_TIME_TAKEN| float\* | any | get |Time taken for the last inference returned by mvncGetResult.
-MVNC_DEBUG_INFO| char\* | any | get | A string that provides more details when the result of a function call was MVNC_MYRIADERROR.
diff --git a/docs/c_api/mvncLoadTensor.md b/docs/c_api/mvncLoadTensor.md
deleted file mode 100644 (file)
index a735dfc..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-# mvncLoadTensor()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncOpenDevice](mvncOpenDevice.md), [mvncAllocateGraph](mvncAllocateGraph.md), [mvncGetResult](mvncGetResult.md)
-
-## Overview
-This function initiates an inference on the specified graph via the associated Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) device. After calling this function, use the mvncGetResult() function to retrieve the inference result.
-
-## Prototype
-
-```C
-mvncStatus mvncLoadTensor(void *graphHandle, const void *inputTensor, unsigned int inputTensorLength, void *userParam);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-graphHandle|void\*|Pointer to opaque graph data type that was initialized with the mvncAllocateGraph() function that represents the neural network for which an inference will be initiated.
-inputTensor|const void\*|Pointer to tensor data buffer, which contains 16-bit half precision floats (per IEEE 754 half precision binary floating-point format: binary16). The values in the buffer are dependent on the neural network (graph), but are typically representations of each color channel of each pixel of an image.
-inputTensorLength|unsigned int|The length, in bytes, of the buffer pointed to by the inputTensor parameter.
-userParam|void\*|Pointer to user data that will be returned along with the inference result from the GetResult() function.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-```C+
-.
-.
-.
-
-// Use a 16-bit unsigned type to represent half precision floats, since C++ has no 
-// built-in support for 16-bit floats.
-typedef unsigned short half;
-
-// GoogleNet image dimensions and network mean values for each channel. This information is specific 
-// for each network, and usually available from network creators.
-const int networkDim = 224;
-float networkMean[] = {0.40787054*255.0, 0.45752458*255.0, 0.48109378*255.0};
-
-int main(int argc, char** argv)
-{
-.
-.
-.
-    //
-    // Open NCS device and set deviceHandle to the valid handle.
-    //
-    
-    //
-    // Read graph from disk and call mvncAllocateGraph to set graphHandle appropriately.
-    //
-
-    //
-    // Load an image from disk.
-    // LoadImage will read image from disk, convert channels to floats.
-    // Subtract network mean for each value in each channel. Then convert
-    // floats to half precision floats.
-    // Return pointer to the buffer of half precision floats. 
-    half* imageBufFp16 = LoadImage("image.png", networkDim, networkMean);
-        
-    // Calculate the length of the buffer that contains the half precision floats.
-    // 3 channels * width * height * sizeof a 16-bit float 
-    unsigned int lenBufFp16 = 3*networkDim*networkDim*sizeof(*imageBufFp16);
-
-    // Start the inference with mvncLoadTensor()
-    retCode = mvncLoadTensor(graphHandle, imageBufFp16, lenBufFp16, NULL);
-    if (retCode == MVNC_OK)
-    {   // The inference has been started, now call mvncGetResult() for the
-        // inference result. 
-        printf("Successfully loaded the tensor for image %s\n", "image.png");
-     
-        // Here mvncGetResult() can be called to get the result of the inference
-        // that was started with mvncLoadTensor() above.
-    }
-
-    // 
-    // Call mvncDeallocateGraph to free the resources tied to graphHandle.
-    // Close the device with mvncCloseDevice().
-    // 
-}
-
-```
diff --git a/docs/c_api/mvncOpenDevice.md b/docs/c_api/mvncOpenDevice.md
deleted file mode 100644 (file)
index eadb29f..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-# mvncOpenDevice()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncCloseDevice](mvncCloseDevice.md), [mvncGetDeviceName](mvncGetDeviceName.md) [mvncGetDeviceOption](mvncGetDeviceOption.md), [mvncSetDeviceOption](mvncSetDeviceOption.md)
-
-## Overview
-This function is used to initialize the Intel® Movidius™ NCS device and return a device handle that can be passed to other API functions.
-
-## Prototype
-
-```C
-mvncStatus mvncOpenDevice(const char *name, void **deviceHandle);
-```
-
-## Parameters
-
-Name|Type|Description
-----|----|------------
-name|const char\*|Pointer to a constant array of chars that contains the name of the device to open. This value is obtained from mvncGetDeviceName.
-deviceHandle|void\*\*|Address of a pointer that will be set to point to an opaque structure representing an NCS device.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-In the example below, the code gets the name of the first device and then calls mvncOpenDevice to open the device and set the deviceHandle variable for use to other API calls that expect a device handle for an open device.
-```C++
-#include <stdio.h>
-#include <stdlib.h>
-
-extern "C" 
-{
-#include <mvnc.h>
-}
-// Somewhat arbitrary buffer size for the device name.
-#define NAME_SIZE 100
-int main(int argc, char** argv)
-{
-    mvncStatus retCode;
-    void *deviceHandle;
-    char devName[NAME_SIZE];
-    retCode = mvncGetDeviceName(0, devName, NAME_SIZE);
-    if (retCode != MVNC_OK)
-    {   // If failed to get device name, may be none plugged in.
-        printf("No NCS devices found\n");
-        exit(-1);
-    }
-    
-    // Try to open the NCS device via the device name.
-    retCode = mvncOpenDevice(devName, &deviceHandle);
-    if (retCode != MVNC_OK)
-    {   // Failed to open the device.  
-        printf("Could not open NCS device\n");
-        exit(-1);
-    }
-    
-    // deviceHandle is ready to use now.  
-    // Pass it to other NC API calls as needed, and close it when finished.
-    printf("Successfully opened NCS device!\n");
-    
-    retCode = mvncCloseDevice(deviceHandle);
-}
-
-```
diff --git a/docs/c_api/mvncSetDeviceOption.md b/docs/c_api/mvncSetDeviceOption.md
deleted file mode 100644 (file)
index ff2eed8..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# mvncSetDeviceOption()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncOpenDevice](mvncOpenDevice.md), [mvncDeviceOptions](mvncDeviceOptions.md), [mvncGetDeviceOption](mvncGetDeviceOption.md)
-
-## Overview
-This function sets an option for a specific Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) device. The available options can be found in the [DeviceOptions](mvncDeviceOptions.md) enumeration.
-
-## Prototype
-
-```C
-mvncStatus mvncSetDeviceOption(void *deviceHandle, int option, const void *data, unsigned int datalength);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-deviceHandle|void\*|Pointer to opaque device data type that was initialized with the mvncOpenDevice() function. This specifies which device's option will be set.
-option|int|A value from the DeviceOptions enumeration that specifies which option will be set.
-data|const void\*|Pointer to the data for the new value for the option. The type of data this points to depends on the option that is being set. Check mvncDeviceOptions for the data types that each option requires.
-dataLength|unsigned int|An unsigned int that contains the length, in bytes, of the buffer that the data parameter points to.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-```C
-TBD
-```
diff --git a/docs/c_api/mvncSetGlobalOption.md b/docs/c_api/mvncSetGlobalOption.md
deleted file mode 100644 (file)
index ccb8fe9..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# mvncSetGlobalOption()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.09
-See also|[mvncGlobalOptions](mvncGlobalOptions.md), [mvncGetGlobalOption](mvncGetGlobalOption.md)
-
-## Overview
-This function sets an option that is global for an application using the SDK.  The available options can be found in the [mvncGlobalOptions](mvncGlobalOptions.md) enumeration.
-
-## Prototype
-
-```C
-mvncStatus mvncSetGlobalOption(int option, const void *data, unsigned int datalength);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-option|int|A value from the mvncGlobalOptions enumeration that specifies which option will be set.
-data|const void\*|Pointer to the data for the new value for the option.  The type of data this points to depends on the option that is being set.  Check mvncGlobalOptions for the data types that each option requires.
-dataLength|unsigned int| An unsigned int that contains the length, in bytes, of the buffer that the data parameter points to.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-```C
-int logLevel = 3;
-retCode = mvncSetGlobalOption(MVNC_LOGLEVEL, &logLevel, sizeof(int));
-
-```
diff --git a/docs/c_api/mvncSetGraphOption.md b/docs/c_api/mvncSetGraphOption.md
deleted file mode 100644 (file)
index caf782c..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-# mvncSetGraphOption()
-
-Type|Function
------------- | -------------
-Header|mvnc.h
-Library| libmvnc.so
-Return|[mvncStatus](mvncStatus.md)
-Version|1.0
-See also|[mvncAllocateGraph](mvncAllocateGraph.md), [mvncGraphOptions](mvncGraphOptions.md), [mvncGetGraphOption](mvncGetGraphOption.md)
-
-## Overview
-This function sets an option of a graph.  The available options can be found in the GraphOptions enumeration.
-
-## Prototype
-
-```C
-mvncStatus mvncSetGraphOption(void *graphHandle, int option, const void *data, unsigned int datalength);
-```
-## Parameters
-
-Name|Type|Description
-----|----|-----------
-graphHandle|void\*|Pointer to opaque graph data type that was initialized with the mvncAllocateGraph() function that represents the neural network.  This specifies which graph's option will be set.
-option|int|A value from the GraphOptions enumeration that specifies which option will be set.
-data|const void\*|Pointer to the data for the new value for the option.  The type of data this points to depends on the option that is being set.  Check mvncGraphOptions for the data types that each option requires.
-dataLength|unsigned int| An unsigned int that contains the length, in bytes, of the buffer that the data parameter points to.
-
-## Return
-This function returns an appropriate value from the [mvncStatus](mvncStatus.md) enumeration.
-
-## Known Issues
-
-## Example
-```C++
-.
-.
-.
-    // Open NCS device to initialize deviceHandle.
-    // Read compiled graph file into graphFileBuf and put length of it in graphFileLen
-
-    // Allocate the graph
-    void* graphHandle;
-    retCode = mvncAllocateGraph(deviceHandle, &graphHandle, graphFileBuf, graphFileLen);
-    if (retCode != MVNC_OK)
-    {   // Error allocating graph
-        printf("Could not allocate graph for file: %s\n", GRAPH_FILE_NAME); 
-    }
-    else
-    {   // Successfully allocated graph. Now graphHandle is ready to go.  
-        // Use graphHandle for other API calls and call mvncDeallocateGraph
-        // when done with it.
-        printf("Successfully allocated graph for %s\n", GRAPH_FILE_NAME);
-        
-        // Set the graph option for blocking calls
-        int dontBlockValue = 0;
-        retCode = mvncSetGraphOption(graphHandle, MVNC_DONTBLOCK, &dontBlockValue, sizeof(int));
-        if (retCode == MVNC_OK)
-        {
-            printf("Successfully set graph option\n");
-        }
-        else
-        {
-            printf("Could not set graph option\n");
-            printf("Error returned from mvncSetGraphOption: %d\n", retCode);
-        }
-
-        // Use graphHandle here with the option set above.
-        // Then deallocate the graph and close the device.
-    }
-.
-.
-.
-```
diff --git a/docs/c_api/mvncStatus.md b/docs/c_api/mvncStatus.md
deleted file mode 100644 (file)
index 1102c79..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# mvncStatus enumeration
-
-Info         | Value/s
------------- | -------------
-Header       |mvnc.h
-Version      |1.0
-See also     | 
-
-## Overview
-A value from this enumeration is returned from most of the C API functions.  The table below provides details on the meaning of each of the values in the enumeration.
-
-constant | description
--------- | -----------
-MVNC_OK | The function call worked as expected.
-MVNC_BUSY | The device is busy, retry later.
-MVNC_ERROR | An unexpected error was encountered during the function call.
-MVNC_OUT_OF_MEMORY | The host is out of memory.
-MVNC_DEVICE_NOT_FOUND | There is no device at the given index or name.
-MVNC_INVALID_PARAMETERS | At least one of the given parameters is invalid in the context of the function call.
-MVNC_TIMEOUT | Timeout in the communication with the device.
-MVNC_MVCMD_NOT_FOUND | The file named MvNCAPI.mvcmd should be installed in the mvnc directory. This message may mean that the installation failed.
-MVNC_NO_DATA | No data to return.
-MVNC_GONE | The graph or device has been closed during the operation.
-MVNC_UNSUPPORTED_GRAPH_FILE | The graph file may have been created with an incompatible prior version of the Toolkit. Try to recompile the graph file with the version of the Toolkit that corresponds to the API version.
-MVNC_MYRIAD_ERROR | An error has been reported by Intel® Movidius™ VPU. Use MVNC_DEBUGINFO to get more information.
diff --git a/docs/c_api/readme.md b/docs/c_api/readme.md
deleted file mode 100644 (file)
index 0d8d5b3..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# Intel® Movidius™ Neural Compute SDK C API
-
-The SDK comes with a C language API that enables developers to create applications in C or C++ that utilize hardware-accelerated Deep Neural Networks via the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS). The C API is provided as a header file (mvnc.h) and an associated library file (libmvnc.so), both of which are placed on the development computer when the SDK is installed. Details of the C API are provided below and within the documentation avilable via the link in each line. 
-
-## Enumerations
-- [mvncStatus](mvncStatus.md): Contains possible return values for API functions.
-- [mvncDeviceOptions](mvncDeviceOptions.md): Contains all possible options to get/set for an Intel Movidius NCS device, and their data types.
-- [mvncGraphOptions](mvncGraphOptions.md): Contains all possible options to get/set for a graph, and their data types.
-- [mvncGlobalOptions](mvncGlobalOptions.md): Contains all possible global options to get/set, and their data types.
-
-## Functions
-- [mvncGetDeviceName](mvncGetDeviceName.md): Retrieves the name of an Intel Movidius NCS device that can be opened.
-- [mvncOpenDevice](mvncOpenDevice.md): Opens an Intel Movidius NCS device for use by the application. 
-- [mvncAllocateGraph](mvncAllocateGraph.md): Allocates a graph for a specific Intel Movidius NCS device in preparation for computing inferences.
-- [mvncDeallocateGraph](mvncDeallocateGraph.md): Deallocates and frees resouces associated with a graph.
-- [mvncLoadTensor](mvncLoadTensor.md): Initiates an inference by providing input to the neural network.
-- [mvncGetResult](mvncGetResult.md): Retrieves the result of an inference that was previously initiated.
-- [mvncSetGraphOption](mvncSetGraphOption.md): Sets an option for a graph.
-- [mvncGetGraphOption](mvncGetGraphOption.md): Retrieves the current value of an option for a graph.
-- [mvncSetDeviceOption](mvncSetDeviceOption.md): Sets an option for an Intel Movidius NCS device.
-- [mvncGetDeviceOption](mvncGetDeviceOption.md): Retrieves the current value of an option for an Intel Movidius NCS device.
-- [mvncSetGlobalOption](mvncSetGlobalOption.md): Sets a global option for an application.
-- [mvncGetGlobalOption](mvncGetGlobalOption.md): Retrieves the current value of a global option for an application.
-- [mvncCloseDevice](mvncCloseDevice.md): Closes a previously opened Intel Movidius NCS device.
-
diff --git a/docs/caffe.html b/docs/caffe.html
new file mode 100644 (file)
index 0000000..4db96ad
--- /dev/null
@@ -0,0 +1,181 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="caffe-support">Caffe Support</h1>
+
+<h2 id="introduction">Introduction</h2>
+<p><a href="http://caffe.berkeleyvision.org/">Caffe</a> is a deep learning framework developed by Berkeley AI Research (<a href="http://bair.berkley.edu">BAIR</a>) and by community contributors.</p>
+
+<p>Each version of the Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) installs and is validated with a single version of Caffe that provides broad network support for that release. The specific version installed may change from release to release. Other versions of Caffe may work with the NCSDK but are not officially supported and may require customization for your specific development machine.</p>
+
+<p>The setup script currently downloads <a href="https://github.com/weiliu89/caffe/tree/master">SSD Caffe</a> and installs it in a system location.<br />
+A soft link to the Caffe installation is available at <em>/opt/movidius/caffe</em></p>
+
+<h2 id="caffe-models">Caffe Models</h2>
+
+<p>Caffe models consist of two files that are used for compiling the caffe model using the NCSDK <a href="tools/compile.html">mvNCCompile</a> tool:</p>
+<ul>
+  <li><strong>.prototxt</strong> - Text file that describes the topology and layers of the network</li>
+  <li><strong>.caffemodel</strong> - Binary file that contains the weights for each layer that are obtained after training a model</li>
+</ul>
+
+<p>Further reading: <a href="https://movidius.github.io/blog/deploying-custom-caffe-models/">Deploying Your Customized Caffe Models on Intel® Movidius™ Neural Compute Stick</a></p>
+
+<h2 id="caffe-layer-support">Caffe Layer Support</h2>
+<p>The following layers are supported in Caffe by the NCSDK. The NCSDK does not support network training, so some layers that are only required for training are not supported.</p>
+
+<h3 id="activationneuron">Activation/Neuron</h3>
+<ul>
+  <li>bias</li>
+  <li>elu</li>
+  <li>prelu</li>
+  <li>relu</li>
+  <li>scale</li>
+  <li>sigmoid</li>
+  <li>tanh</li>
+</ul>
+
+<h3 id="common">Common</h3>
+<ul>
+  <li>inner_product</li>
+</ul>
+
+<h3 id="normalization">Normalization</h3>
+<ul>
+  <li>batch_norm</li>
+  <li>lrn</li>
+</ul>
+
+<h3 id="utility">Utility</h3>
+<ul>
+  <li>concat</li>
+  <li>eltwise</li>
+  <li>flatten</li>
+  <li>parameter</li>
+  <li>reshape</li>
+  <li>slice</li>
+  <li>softmax</li>
+</ul>
+
+<h3 id="vision">Vision</h3>
+<ul>
+  <li>conv
+    <ul>
+      <li>Regular Convolution - 1x1s1, 3x3s1, 5x5s1, 7x7s1, 7x7s2, 7x7s4</li>
+      <li>Group Convolution - &lt;1024 groups total</li>
+    </ul>
+  </li>
+  <li>deconv</li>
+  <li>pooling</li>
+</ul>
+
+<h1 id="known-issues">Known Issues</h1>
+<h3 id="caffe-input-layer">Caffe Input Layer</h3>
+
+<p>Limitation: Batch Size, which is the first dimension, must always be 1</p>
+
+<p>Limitation: The number of inputs must be 1</p>
+
+<p>Limitation: We don’t support this “input_param” format for the input layer:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>1 name: "GoogleNet" 
+2 layer { 
+3   name: "data" 
+4   type: "Input" 
+5   top: "data" 
+6   input_param { shape: { dim: *10* dim: 3 dim: 224 dim: 224 } } 
+7 } 
+</code></pre></div></div>
+
+<p>We only support this “input_shape” format for the input layer:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>name: "GoogleNet" 
+input: "data"
+ input_shape 
+{ dim:1 dim:3 dim:224 dim:224 } 
+</code></pre></div></div>
+
+<h3 id="input-name">Input Name</h3>
+<p>Input should be always called “data”.</p>
+
+<p>This works:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>name: "GoogleNet" 
+input: "data"
+ input_shape 
+{ dim:1 dim:3 dim:224 dim:224 } 
+</code></pre></div></div>
+
+<p>This does not:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>name: "GoogleNet" 
+input: "data_x"
+ input_shape 
+{ dim:1 dim:3 dim:224 dim:224 } 
+</code></pre></div></div>
+
+<h3 id="crop-layer">Crop Layer</h3>
+<p>Limitation: Crop layer cannot take reference size layer from input:”data”.</p>
+
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>layer {
+  name: "score"
+  type: "Crop"
+  bottom: "upscore"
+  bottom: "data"
+  top: "score"
+  crop_param {
+    axis: 2
+    offset: 18
+  }
+}
+</code></pre></div></div>
+
+<h3 id="size-limitations">Size Limitations</h3>
+<p>Compiled Movidius™ “graph” file &lt; 320 MB;
+Intermediate layer buffer size &lt; 100 MB</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[Error 35] Setup Error: Not enough resources on Myriad to process this network
+</code></pre></div></div>
+
+<p>Scratch Memory size &lt; 112 KB</p>
+
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[Error 25] Myriad Error: "Matmul scratch memory [112640] lower than required [165392]"
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/compiler_error.html b/docs/compiler_error.html
new file mode 100644 (file)
index 0000000..31237b0
--- /dev/null
@@ -0,0 +1,83 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvnccompile-error-codes">mvNCCompile Error Codes</h1>
+
+<h3 id="error--1-setup-error-caffe-import-error">Error  1: “Setup Error: Caffe Import Error.”</h3>
+<h3 id="error--2-setup-error-using-a-version-of-python-that-is-unsupported">Error  2: “Setup Error: Using a version of Python that is unsupported.”</h3>
+<h3 id="error--3-setup-error-caffe-syntax-error-">Error  3: “Setup Error: Caffe Syntax Error: …”</h3>
+<h3 id="error--4-toolkit-error-stage-type-not-supported-">Error  4: “Toolkit Error: Stage Type Not Supported: …”</h3>
+<h3 id="error--5-toolkit-error-stage-details-not-supported-">Error  5: “Toolkit Error: Stage Details Not Supported: …”</h3>
+<h3 id="error--6-setup-error-no-myriad-executable-detected">Error  6: “Setup Error: no Myriad Executable detected.”</h3>
+<h3 id="error--7-toolkit-error-usb-failure-code-">Error  7: “Toolkit Error: USB Failure. Code: …”</h3>
+<h3 id="error--8-argument-error-network-description-cannot-be-found">Error  8: “Argument Error: Network description cannot be found.”</h3>
+<h3 id="error--9-argument-error-network-weight-cannot-be-found">Error  9: “Argument Error: Network weight cannot be found.”</h3>
+<h3 id="error-10-toolkit-error-no-such-mode-">Error 10: “Toolkit Error: No such Mode …”</h3>
+<h3 id="error-11-argument-error-expected-id-not-provided">Error 11: “Argument Error: Expected ID not provided.”</h3>
+<h3 id="error-12-argument-error-image-cannot-be-found">Error 12: “Argument Error: Image cannot be found.”</h3>
+<h3 id="error-13-toolkit-error-provided-outputnodeinputnode-name-does-not-exist-or-does-not-match-with-one-contained-in-caffemodel-file-provided-">Error 13: “Toolkit Error: Provided OutputNode/InputNode name does not exist or does not match with one contained in caffemodel file Provided: …”</h3>
+<h3 id="error-14-toolkit-error-data-type-not-supported-">Error 14: “Toolkit Error: Data Type Not Supported: …”</h3>
+<h3 id="error-15-toolkit-error-parser-not-supported-">Error 15: “Toolkit Error: Parser Not Supported: …”</h3>
+<h3 id="error-16-toolkit-error-internal-error-input-stage-is-not-first-layer">Error 16: “Toolkit Error: Internal Error: Input Stage is not first layer.”</h3>
+<h3 id="error-17-toolkit-error-internal-error-could-not-build-graph-missing-link-">Error 17: “Toolkit Error: Internal Error: Could not build graph. Missing link: …”</h3>
+<h3 id="error-18-toolkit-error-internal-error-invalid-conversion-optimization-from-">Error 18: “Toolkit Error: Internal Error: Invalid Conversion Optimization. From: …”</h3>
+<h3 id="error-19-toolkit-error-setup-error-not-all-required-arguments-were-passed--erroneous-arguments">Error 19: “Toolkit Error: Setup Error: Not all required arguments were passed / Erroneous arguments.”</h3>
+<h3 id="error-20-toolkit-error-input-layer-must-be-in-an-input_shape-construct">Error 20: “Toolkit Error: Input Layer must be in an input_shape construct.”</h3>
+<h3 id="error-21-argument-error-validation-metric-not-supported-">Error 21: “Argument Error: Validation metric not supported “</h3>
+<h3 id="error-22-toolkit-error-unable-to-tell-what-parser-is-required-consider-overriding-with-parser-argument">Error 22: “Toolkit Error: Unable to tell what parser is required. Consider overriding with –parser argument.”</h3>
+<h3 id="error-23-toolkit-error-mismatch-between-input-layer-of-network-and-given-input-file">Error 23: “Toolkit Error: Mismatch between input layer of network and given input file.”</h3>
+<h3 id="error-24-toolkit-error-1-image-inference-not-supported">Error 24: “Toolkit Error: &gt;1 image inference not supported.”</h3>
+<h3 id="error-26-toolkit-error-no-moviusbboot-executable-detected">Error 26: “Toolkit Error: No moviUsbBoot Executable detected.”</h3>
+<h3 id="error-25-myriad-error-">Error 25: “Myriad Error: …”</h3>
+<h3 id="error-27-setup-error-too-many--too-few-shave-processors-selected">Error 27: “Setup Error: Too Many / Too Few Shave Processors Selected.”</h3>
+<h3 id="error-28-caffe-error-memoryerror-potential-cause-available-ram-not-sufficient-for-network-to-be-loaded-into-caffe">Error 28: “Caffe Error: MemoryError. Potential Cause: Available RAM not sufficient for Network to be loaded into Caffe”</h3>
+<h3 id="error-29-setup-error-tuple-syntax-incorrect-should-be-in-form-xyz-">Error 29: “Setup Error: Tuple Syntax Incorrect, should be in form x,y,z “</h3>
+<h3 id="error-30-toolkit-error-filetype-not-supported-as-a-input">Error 30: “Toolkit Error: Filetype not supported as a input.”</h3>
+<h3 id="error-31-usb-error-problem-transferring-data">Error 31: “USB Error: Problem Transferring data.”</h3>
+<h3 id="error-32-setup-error-problem-parsing-configuration-file">Error 32: “Setup Error: Problem parsing configuration File.”</h3>
+<h3 id="error-33-toolkit-error-no-temperature-read-from-device">Error 33: “Toolkit Error: No Temperature Read from device.”</h3>
+<h3 id="error-34-setup-error-values-for-input-contain-placeholder-pass-an-absolute-value">Error 34: “Setup Error: Values for input contain placeholder. Pass an absolute value.”</h3>
+<h3 id="error-35-setup-error-not-enough-resources-on-myriad-to-process-this-network">Error 35: “Setup Error: Not enough resources on Myriad to process this network.”</h3>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/compiler_error.md b/docs/compiler_error.md
deleted file mode 100644 (file)
index 1add980..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# Error Codes
-
-### Error  1: "Setup Error: Caffe Import Error."
-### Error  2: "Setup Error: Using a version of Python that is unsupported."
-### Error  3: "Setup Error: Caffe Syntax Error: ..."
-### Error  4: "Toolkit Error: Stage Type Not Supported: " + str(extra)
-### Error  5: "Toolkit Error: Stage Details Not Supported: " + str(extra)
-### Error  6: "Setup Error: no Myriad Executable detected."
-### Error  7: "Toolkit Error: USB Failure. Code: ..." 
-### Error  8: "Argument Error: Network description cannot be found."
-### Error  9: "Argument Error: Network weight cannot be found."
-### Error 10: "Toolkit Error: No such Mode ..."
-### Error 11: "Argument Error: Expected ID not provided."
-### Error 12: "Argument Error: Image cannot be found."
-### Error 13: "Toolkit Error: Provided OutputNode/InputNode name does not exist or does not match with one contained in caffemodel file Provided: ..."
-### Error 14: "Toolkit Error: Data Type Not Supported: " + str(extra)
-### Error 15: "Toolkit Error: Parser Not Supported: ..."
-### Error 16: "Toolkit Error: Internal Error: Input Stage is not first layer."
-### Error 17: "Toolkit Error: Internal Error: Could not build graph. Missing link: ..."
-### Error 18: "Toolkit Error: Internal Error: Invalid Conversion Optimization. From: ..."
-### Error 19: "Toolkit Error: Setup Error: Not all required arguments were passed / Erroneous arguments."
-### Error 20: "Toolkit Error: Input Layer must be in an input_shape construct."
-### Error 21: "Argument Error: Validation metric not supported "
-### Error 22: "Toolkit Error: Unable to tell what parser is required. Consider overriding with --parser argument."
-### Error 23: "Toolkit Error: Mismatch between input layer of network and given input file."
-### Error 24: "Toolkit Error: >1 image inference not supported."
-### Error 26: "Toolkit Error: No moviUsbBoot Executable detected."
-### Error 25: "Myriad Error: ..."
-### Error 27: "Setup Error: Too Many / Too Few Shave Processors Selected."
-### Error 28: "Caffe Error: MemoryError. Potential Cause: Available RAM not sufficient for Network to be loaded into Caffe"
-### Error 29: "Setup Error: Tuple Syntax Incorrect, should be in form x,y,z "
-### Error 30: "Toolkit Error: Filetype not supported as a input."
-### Error 31: "USB Error: Problem Transferring data."
-### Error 32: "Setup Error: Problem parsing configuration File."
-### Error 33: "Toolkit Error: No Temperature Read from device."
-### Error 34: "Setup Error: Values for input contain placeholder. Pass an absolute value."
-### Error 35: "Setup Error: Not enough resources on Myriad to process this network."
diff --git a/docs/config.rb b/docs/config.rb
new file mode 100644 (file)
index 0000000..9410f77
--- /dev/null
@@ -0,0 +1,26 @@
+# Require any additional compass plugins here.
+
+# Set this to the root of your project when deployed:
+http_path = "SITE_ROOT"
+css_dir = "stylesheets"
+sass_dir = "sass"
+images_dir = "images"
+javascripts_dir = "javascripts"
+
+# You can select your preferred output style here (can be overridden via the command line):
+# output_style = :expanded or :nested or :compact or :compressed
+
+# To enable relative paths to assets via compass helper functions. Uncomment:
+# relative_assets = true
+
+# To disable debugging comments that display the original location of your selectors. Uncomment:
+# line_comments = false
+
+# If you prefer the indented syntax, you might want to regenerate this
+# project again passing --syntax sass, or you can uncomment this:
+# preferred_syntax = :sass
+# and then run:
+# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
+preferred_syntax = :scss
+
+line_comments = false # by Compass.app
diff --git a/docs/configure_network.html b/docs/configure_network.html
new file mode 100644 (file)
index 0000000..31388ee
--- /dev/null
@@ -0,0 +1,219 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="configuring-your-network-for-the-intel-movidius-neural-compute-sdk">Configuring Your Network for the Intel® Movidius™ Neural Compute SDK</h1>
+
+<p>This guide will help you get all of the configuration information correct when creating your network for the Intel® Movidius™ Neural Compute SDK (NCSDK). All of these parameters are critical. If you don’t get them right, your network won’t give you the accuracy that was achieved by the team that trained the model. The configuration parameters are as follows:</p>
+<ul>
+  <li>Mean subtraction</li>
+  <li>Scale</li>
+  <li>Color channel configuration</li>
+  <li>Class prediction</li>
+  <li>Input image size</li>
+</ul>
+
+<p><strong>Let’s go through these one at a time.</strong></p>
+
+<h2 id="mean-subtraction">Mean Subtraction</h2>
+<p>Mean subtraction on the input data to a convolutional neural network (CNN) is a common technique. The mean is calculated on the data set. For example, the mean on Imagenet is calculated on a per channel basis to be:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>104, 117, 123
+These numbers are in BGR orientation.
+</code></pre></div></div>
+<h3 id="caffe-specific-examples">Caffe Specific Examples</h3>
+<p>This mean calculation can be calculated with a tool that comes with caffe (<a href="https://github.com/BVLC/caffe/blob/master/tools/compute_image_mean.cpp">compute_image_mean.cpp</a>). Caffe provides a script to do it, as well (<a href="https://github.com/BVLC/caffe/blob/master/examples/imagenet/make_imagenet_mean.sh">make_imagenet_mean.sh</a>).</p>
+
+<hr />
+<p>This will create an output file often called mean_binary.proto. You can see an example of this in the training prototxt file for AlexNet:</p>
+
+<p><a href="https://github.com/BVLC/caffe/blob/master/models/bvlc_alexnet/train_val.prototxt">train_val.prototxt</a></p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> transform_param {
+    mirror: true
+    crop_size: 227
+    mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
+  }
+</code></pre></div></div>
+<hr />
+<p>In the GoogLeNet prototxt file, they have put in the values directly:</p>
+
+<p><a href="https://github.com/BVLC/caffe/blob/master/models/bvlc_googlenet/train_val.prototxt">train_val.prototxt</a></p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
+  transform_param {
+    mirror: true
+    crop_size: 224
+    mean_value: 104
+    mean_value: 117
+    mean_value: 123
+  }
+</code></pre></div></div>
+<hr />
+<p>Some models don’t use mean subtraction. See the LeNet example below. There is no mean in the transform_param, but there is a scale that we’ll get to later:</p>
+
+<p><a href="https://github.com/BVLC/caffe/blob/master/examples/mnist/lenet_train_test.prototxt">lenet_train_test.prototxt</a></p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  transform_param {
+    scale: 0.00390625
+  }
+</code></pre></div></div>
+<h3 id="tensorflow-specific-examples">TensorFlow™ Specific Examples</h3>
+<p>TensorFlow™ documentation of mean is not as straightforward as Caffe. The TensorFlow Slim models for image classification are a great place to get high quality pre-trained models:</p>
+
+<p><a href="https://github.com/tensorflow/models/tree/master/research/slim#pre-trained-models">slim models</a></p>
+
+<p>The following file is the mean (and scale) for both Inception V3 and MobileNet V1:</p>
+
+<p><a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py#L872">retrain script</a></p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>input_mean = 128
+</code></pre></div></div>
+<p>In the case of the Inception V3 model, there is not a per color channel mean. The same mean is used for all channels. This mean should apply to all of the Inception and MobileNet models, but other models might be different.</p>
+
+<p>For example, the VGG16 model had the weights converted from Caffe. If we look at the link to the VGG16 for Caffe page, we see the means are done like the other Caffe models:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>https://gist.github.com/ksimonyan/211839e770f7b538e2d8#description
+
+The following BGR values should be subtracted: [103.939, 116.779, 123.68]
+</code></pre></div></div>
+
+<h2 id="scale">Scale</h2>
+<p>Typical 8-bit per pixel per channel images will have a scale of 0-255. Many CNN networks use the native scale, but some don’t. As was seen in a snippet of the Caffe prototxt file, the <strong>transform_param</strong> would show whether there was a scale. In the example of LeNet for Caffe, you can see it has a scale pameter of <strong>0.00390625</strong>.</p>
+
+<p><a href="https://github.com/BVLC/caffe/blob/master/examples/mnist/lenet_train_test.prototxt">lenet_train_test.prototxt</a></p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  transform_param {
+    scale: 0.00390625
+  }
+</code></pre></div></div>
+<p>This may seem like a strange number, but it is actually just 1/256. The input 8-bit image is being scaled down to an image from 0-1 instead of 0-255.</p>
+
+<hr />
+<p>Regarding the example of TensorFlow for Inception V3, the <strong>input_mean</strong> the <strong>input_std</strong> are listed below. This is a scaling factor. You divide 255/128, and it’s about 2. In this case, the scale is two, but the mean subtraction is 128. In the end, the scale is actually -1 to 1.</p>
+
+<p><a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py#L872">retrain script</a></p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>input_mean = 128
+input_std = 128
+</code></pre></div></div>
+<h2 id="color-channel-configuration">Color Channel Configuration</h2>
+<p>Different models may be trained with different color channel orientations (either RGB or BGR). Typically, Caffe models seem to be trained with BGR, whereas the Slim TensorFlow models (at least Inception and MobileNet) are trained in RGB.</p>
+
+<p>Once you figure out the color channel orientation for your model, you will need to know the way the image is loaded. For example, opencv will open images in BGR, but skimiage will open the image in RGB.</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>* skimage.io.imread will open the image in RGB
+* cv2.imread will open the image in BGR
+* Caffe trained models will probably be BGR
+* TensorFlow trained models will probably be in RGB
+</code></pre></div></div>
+<h2 id="categories">Categories</h2>
+<p>For models that are trained on the ImageNet database, some have 1000 output classes and some have 1001 output classes. The extra output class is a background class. The following list has the list of the 1000 classes not including the background:
+<a href="https://github.com/HoldenCaulfieldRye/caffe/blob/master/data/ilsvrc12/synset_words.txt">synset_words.txt</a></p>
+
+<p>Most Caffe trained models seem to follow the 1000 class convention, and TensorFlow trained models follow the 1001 class convention. For the TensorFlow models, an offset needs to be added. You can see this documented in the <a href="https://github.com/tensorflow/models/tree/master/research/slim#the-resnet-and-vgg-models-have-1000-classes-but-the-imagenet-dataset-has-1001">TensorFlow GitHub</a>.</p>
+
+<h1 id="putting-it-all-together">Putting It All Together</h1>
+<p>Now with all of these factors, let’s go through two examples.</p>
+
+<h2 id="caffe-example">Caffe Example</h2>
+<p>Let’s use the Berkeley Caffe GoogLeNet model as an example. The basic model parameters are:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Scale: 0-255 (before mean subtraction)
+Mean: based on mean_binary.proto file
+Color channel configuration: BGR
+output categories: 1000
+input size: 224x224
+labels_offset=0
+</code></pre></div></div>
+<p>Code snippet:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#Load the label files
+labels_offset=0 # no background class offset
+labels_file='./synset_words.txt'
+labels=numpy.loadtxt(labels_file,str,delimiter='\t')
+#Load blob
+with open('./googlenet.blob', mode='rb') as f:
+       blob = f.read()
+graph = device.AllocateGraph(blob)
+graph.SetGraphOption(mvnc.GraphOption.ITERATIONS, 1)
+iterations = graph.GetGraphOption(mvnc.GraphOption.ITERATIONS)
+img = cv2.imread('./dog.jpg') # using OpenCV for reading the image, it will be in BGR
+img=cv2.resize(img,(224,224)) # resize to 224x224
+img-=[104,117,124] # subtract mean
+#Run, get the result and print results per the synset_words.txt
+graph.LoadTensor(img.astype(numpy.float16), 'user object')
+output, userobj = graph.GetResult()
+order = output.argsort()[::-1][:6]
+print('\n------- predictions --------')
+for i in range(0,5):
+       print ('prediction ' + str(i) + ' is ' + labels[order[i]-labels_offset])
+</code></pre></div></div>
+
+<h2 id="tensorflow-example">TensorFlow Example</h2>
+<p>Let’s use the TensorFlow Slim Inception V3:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Scale: -1 to 1 (after mean subtraction)
+Mean: 128
+Color channel configuration: RBG
+output categories: 1001
+input size: 299x299
+labels_offset=1
+</code></pre></div></div>
+<p>Code snippet:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#Load the label files
+labels_offset=1 # background class offset of 1
+labels_file='./synset_words.txt'
+labels=numpy.loadtxt(labels_file,str,delimiter='\t')
+#Load blob
+with open('./inceptionv3.blob', mode='rb') as f:
+       blob = f.read()
+graph = device.AllocateGraph(blob)
+graph.SetGraphOption(mvnc.GraphOption.ITERATIONS, 1)
+iterations = graph.GetGraphOption(mvnc.GraphOption.ITERATIONS)
+#Import the image and do the proper scaling
+img = cv2.imread('./dog.jpg').astype(numpy.float32) # using OpenCV for reading the image, it will be in BGR
+img=cv2.resize(img,(299,299)) # resize to 299x299
+img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB) # need to convert to RBG
+img-=[128,128,128] # subtract mean 
+img /=128. # scale the image
+#Run, get the result and print results per the synset_words.txt
+graph.LoadTensor(img.astype(numpy.float16), 'user object')
+output, userobj = graph.GetResult()
+order = output.argsort()[::-1][:6]
+print('\n------- predictions --------')
+for i in range(0,5):
+       print ('prediction ' + str(i) + ' is ' + labels[order[i]-labels_offset])
+</code></pre></div></div>
+
+<p>Feedback or comments? Let me know at darren.s.crews@intel.com.</p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/configure_network.md b/docs/configure_network.md
deleted file mode 100644 (file)
index f0069c6..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-# Configuring Your Network for Intel® Movidius™ NCS
-This guide will help you get all of the configuration information correct when creating your network for the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS). All of these parameters are critical. If you don't get them right, your network won't give you the accuracy that was achieved by the team that trained the model. The configuration parameters are as follows:
-* Mean subtraction
-* Scale
-* Color channel configuration
-* Class prediction
-* Input image size
-
-**Let's go through these one at a time.**
-
-## Mean Subtraction
-Mean subtraction on the input data to a convolutional neural network (CNN) is a common technique. The mean is calculated on the data set. For example, the mean on Imagenet is calculated on a per channel basis to be:
-```
-104, 117, 123
-These numbers are in BGR orientation.
-```
-### Caffe Specific Examples
-This mean calculation can be calculated with a tool that comes with caffe ([compute_image_mean.cpp](https://github.com/BVLC/caffe/blob/master/tools/compute_image_mean.cpp)). Caffe provides a script to do it, as well ([make_imagenet_mean.sh](https://github.com/BVLC/caffe/blob/master/examples/imagenet/make_imagenet_mean.sh)).
-
----
-This will create an output file often called mean_binary.proto. You can see an example of this in the training prototxt file for AlexNet:
-
-[train_val.prototxt](https://github.com/BVLC/caffe/blob/master/models/bvlc_alexnet/train_val.prototxt)
-```
- transform_param {
-    mirror: true
-    crop_size: 227
-    mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
-  }
-```
----
-In the GoogLeNet prototxt file, they have put in the values directly:
-
-[train_val.prototxt](https://github.com/BVLC/caffe/blob/master/models/bvlc_googlenet/train_val.prototxt)
-```
-
-  transform_param {
-    mirror: true
-    crop_size: 224
-    mean_value: 104
-    mean_value: 117
-    mean_value: 123
-  }
-```
----
-Some models don't use mean subtraction. See the LeNet example below. There is no mean in the transform_param, but there is a scale that we'll get to later:
-
-[lenet_train_test.prototxt](https://github.com/BVLC/caffe/blob/master/examples/mnist/lenet_train_test.prototxt)
-```
-  transform_param {
-    scale: 0.00390625
-  }
-  ```
-### TensorFlow™ Specific Examples
-TensorFlow™ documentation of mean is not as straightforward as Caffe. The TensorFlow Slim models for image classification are a great place to get high quality pre-trained models:
-
-[slim models](https://github.com/tensorflow/models/tree/master/research/slim#pre-trained-models)
-
-The following file is the mean (and scale) for both Inception V3 and MobileNet V1:
-
-[retrain script](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py#L872)
-```
-input_mean = 128
-```
-In the case of the Inception V3 model, there is not a per color channel mean. The same mean is used for all channels. This mean should apply to all of the Inception and MobileNet models, but other models might be different.
-
-For example, the VGG16 model had the weights converted from Caffe. If we look at the link to the VGG16 for Caffe page, we see the means are done like the other Caffe models:
-```
-https://gist.github.com/ksimonyan/211839e770f7b538e2d8#description
-
-The following BGR values should be subtracted: [103.939, 116.779, 123.68]
-```
-
-## Scale
-Typical 8-bit per pixel per channel images will have a scale of 0-255. Many CNN networks use the native scale, but some don't. As was seen in a snippet of the Caffe prototxt file, the **transform_param** would show whether there was a scale. In the example of LeNet for Caffe, you can see it has a scale pameter of **0.00390625**.
-
-[lenet_train_test.prototxt](https://github.com/BVLC/caffe/blob/master/examples/mnist/lenet_train_test.prototxt)
-```
-  transform_param {
-    scale: 0.00390625
-  }
-  ```
-This may seem like a strange number, but it is actually just 1/256. The input 8-bit image is being scaled down to an image from 0-1 instead of 0-255.
- ---
-Regarding the example of TensorFlow for Inception V3, the **input_mean** the **input_std** are listed below. This is a scaling factor. You divide 255/128, and it's about 2. In this case, the scale is two, but the mean subtraction is 128. In the end, the scale is actually -1 to 1.
-
-[retrain script](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py#L872)
-```
-input_mean = 128
-input_std = 128
-```
-## Color Channel Configuration
-Different models may be trained with different color channel orientations (either RGB or BGR). Typically, Caffe models seem to be trained with BGR, whereas the Slim TensorFlow models (at least Inception and MobileNet) are trained in RGB.  
-
-Once you figure out the color channel orientation for your model, you will need to know the way the image is loaded. For example, opencv will open images in BGR, but skimiage will open the image in RGB.  
-```
-* skimage.io.imread will open the image in RGB
-* cv2.imread will open the image in BGR
-* Caffe trained models will probably be BGR
-* TensorFlow trained models will probably be in RGB
-```
-## Categories
-For models that are trained on the ImageNet database, some have 1000 output classes and some have 1001 output classes. The extra output class is a background class. The following list has the list of the 1000 classes not including the background:
-[synset_words.txt](https://github.com/HoldenCaulfieldRye/caffe/blob/master/data/ilsvrc12/synset_words.txt)
-
-Most Caffe trained models seem to follow the 1000 class convention, and TensorFlow trained models follow the 1001 class convention. For the TensorFlow models, an offset needs to be added. You can see this documented in the [TensorFlow GitHub](https://github.com/tensorflow/models/tree/master/research/slim#the-resnet-and-vgg-models-have-1000-classes-but-the-imagenet-dataset-has-1001).
-
-# Putting It All Together
-Now with all of these factors, let's go through two examples.
-
-## Caffe Example
-Let's use the Berkeley Caffe GoogLeNet model as an example. The basic model parameters are:
-```
-Scale: 0-255 (before mean subtraction)
-Mean: based on mean_binary.proto file
-Color channel configuration: BGR
-output categories: 1000
-input size: 224x224
-labels_offset=0
-```
-Code snippet:
-```
-#Load the label files
-labels_offset=0 # no background class offset
-labels_file='./synset_words.txt'
-labels=numpy.loadtxt(labels_file,str,delimiter='\t')
-#Load blob
-with open('./googlenet.blob', mode='rb') as f:
-       blob = f.read()
-graph = device.AllocateGraph(blob)
-graph.SetGraphOption(mvnc.GraphOption.ITERATIONS, 1)
-iterations = graph.GetGraphOption(mvnc.GraphOption.ITERATIONS)
-img = cv2.imread('./dog.jpg') # using OpenCV for reading the image, it will be in BGR
-img=cv2.resize(img,(224,224)) # resize to 224x224
-img-=[104,117,124] # subtract mean
-#Run, get the result and print results per the synset_words.txt
-graph.LoadTensor(img.astype(numpy.float16), 'user object')
-output, userobj = graph.GetResult()
-order = output.argsort()[::-1][:6]
-print('\n------- predictions --------')
-for i in range(0,5):
-       print ('prediction ' + str(i) + ' is ' + labels[order[i]-labels_offset])
-```
-
-## TensorFlow Example
-Let's use the TensorFlow Slim Inception V3:
-```
-Scale: -1 to 1 (after mean subtraction)
-Mean: 128
-Color channel configuration: RBG
-output categories: 1001
-input size: 299x299
-labels_offset=1
-```
-Code snippet:
-```
-#Load the label files
-labels_offset=1 # background class offset of 1
-labels_file='./synset_words.txt'
-labels=numpy.loadtxt(labels_file,str,delimiter='\t')
-#Load blob
-with open('./inceptionv3.blob', mode='rb') as f:
-       blob = f.read()
-graph = device.AllocateGraph(blob)
-graph.SetGraphOption(mvnc.GraphOption.ITERATIONS, 1)
-iterations = graph.GetGraphOption(mvnc.GraphOption.ITERATIONS)
-#Import the image and do the proper scaling
-img = cv2.imread('./dog.jpg').astype(numpy.float32) # using OpenCV for reading the image, it will be in BGR
-img=cv2.resize(img,(299,299)) # resize to 299x299
-img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB) # need to convert to RBG
-img-=[128,128,128] # subtract mean 
-img /=128. # scale the image
-#Run, get the result and print results per the synset_words.txt
-graph.LoadTensor(img.astype(numpy.float16), 'user object')
-output, userobj = graph.GetResult()
-order = output.argsort()[::-1][:6]
-print('\n------- predictions --------')
-for i in range(0,5):
-       print ('prediction ' + str(i) + ' is ' + labels[order[i]-labels_offset])
-```
-
-Feedback or comments? Let me know at darren.s.crews@intel.com.
diff --git a/docs/docker.html b/docs/docker.html
new file mode 100644 (file)
index 0000000..c5ece43
--- /dev/null
@@ -0,0 +1,188 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="using-the-intel-movidius-neural-compute-sdk-with-docker">Using the Intel® Movidius™ Neural Compute SDK with Docker</h1>
+
+<p><strong>NOTE: This feature is only available with Intel® Movidius™ Neural Compute SDK 2.x.</strong></p>
+
+<p><a href="https://www.docker.com">Docker</a> is an open-source platform for the creation of lightweight operating-system-level virtualizations called containers for building, distributing, and running applications. Docker images are packages that include everything needed to run the container and its applications, and Docker containers are runtime instances of these images. You can read more about basic Docker concepts <a href="https://docs.docker.com/get-started/">here</a>.</p>
+
+<p>The Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) can be installed and run within a Docker container so that its required packages and libraries are isolated from the rest of your system.</p>
+
+<p>This document will tell you how to use the NCSDK with Docker. These instructions assume that you will be using a neural compute device that is connected to your host machine via USB.</p>
+
+<h1 id="install-docker-on-an-ubuntu-host">Install Docker on an Ubuntu host</h1>
+
+<p>Go to <a href="https://docs.docker.com/install/linux/docker-ce/ubuntu">https://docs.docker.com/install/linux/docker-ce/ubuntu/</a> and follow the instructions to install docker-ce on Ubuntu.</p>
+
+<h3 id="proxy-configuration">Proxy Configuration</h3>
+
+<p>See <a href="docker_proxy.html">Configuring Docker For Use With a Proxy</a>.</p>
+
+<h3 id="sudo-configuration">sudo Configuration</h3>
+
+<p>To use Docker in Ubuntu without having to use sudo, execute the following commands:</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>groupadd docker
+<span class="nb">sudo </span>usermod <span class="nt">-aG</span> docker <span class="nv">$USER</span>
+</code></pre></div></div>
+
+<p>Reboot your machine for this to take effect.</p>
+
+<h3 id="other-operating-systems">Other Operating Systems</h3>
+
+<p>These instructions have been validated in Docker Community Edition for Ubuntu. Other versions of Docker may not have the required USB support.</p>
+
+<p>These instructions can be done in an Ubuntu <a href="vm_config.html">virtual machine</a>.</p>
+
+<h1 id="create-a-docker-container-for-the-ncsdk">Create a Docker container for the NCSDK</h1>
+
+<p>We have provided a Dockerfile to build an Ubuntu-based Docker image that has the NCSDK installed.</p>
+
+<h4 id="1-build-the-docker-image">1. Build the Docker image</h4>
+
+<p>This command will create an image named ‘ncsdk’.</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>docker build <span class="nt">-t</span> ncsdk <span class="nt">-f</span> ./extras/docker/Dockerfile https://github.com/movidius/ncsdk.git#ncsdk2
+</code></pre></div></div>
+
+<p>This may take some time as the NCSDK is installed and dependencies are built.</p>
+
+<p>If you have already cloned the ncsdk repo, you can instead execute this build command from within the ncsdk directory in the ncsdk2 branch:</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>docker build <span class="nt">-t</span> ncsdk <span class="nt">-f</span> ./extras/docker/Dockerfile <span class="nb">.</span>
+</code></pre></div></div>
+
+<h4 id="2-create-and-run-a-docker-container-from-the-built-image">2. Create and run a Docker container from the built image</h4>
+
+<p>This command will create a container named ‘ncsdk’.</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>docker run <span class="nt">--net</span><span class="o">=</span>host <span class="nt">--privileged</span> <span class="nt">-v</span> /dev:/dev <span class="nt">--name</span> ncsdk <span class="nt">-i</span> <span class="nt">-t</span> ncsdk /bin/bash
+</code></pre></div></div>
+
+<p>The elevated permissions are necessary for the USB access required by the neural compute device. Additional <code class="highlighter-rouge">run</code> options can be seen <a href="https://docs.docker.com/engine/reference/run/">here</a>. See the instructions above if you need to configure your Docker container to run behind a proxy.</p>
+
+<h4 id="3-build-examples-optional">3. Build examples (optional)</h4>
+
+<p>You must have a neural compute device connected to a USB port in your host system when running this command. This command is executed inside of your Docker container.</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>make examples
+</code></pre></div></div>
+
+<h4 id="4-exit-the-container">4. Exit the container</h4>
+
+<p>This command is executed inside of your Docker container.</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">exit</span>
+</code></pre></div></div>
+
+<h1 id="use-your-ncsdk-container">Use your NCSDK container</h1>
+
+<h2 id="starting-the-container">Starting the container</h2>
+<p>The Docker <code class="highlighter-rouge">run</code> command creates a new container instance each time that is used. If you want to use your existing container, use the <code class="highlighter-rouge">start</code> command.
+<em>(Note: We named the container ‘ncsdk’ in the run command above.)</em></p>
+
+<ul>
+  <li>
+    <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker start <span class="nt">-a</span> <span class="nt">-i</span> ncsdk
+</code></pre></div>    </div>
+  </li>
+</ul>
+
+<h2 id="other-useful-docker-commands">Other useful Docker commands</h2>
+
+<p>These commands are executed from your host terminal, not from inside the Docker container.</p>
+
+<ul>
+  <li>View a list of Docker images:</li>
+</ul>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker images
+</code></pre></div></div>
+
+<ul>
+  <li>Remove an image (REPOSITORY_NAME can be found with the <code class="highlighter-rouge">images</code> command):</li>
+</ul>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker rmi REPOSITORY_NAME
+</code></pre></div></div>
+
+<ul>
+  <li>View a list of all Docker containers:</li>
+</ul>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker container <span class="nb">ls</span> <span class="nt">-a</span>
+</code></pre></div></div>
+
+<ul>
+  <li>Remove a Docker container (CONTAINER_NAME can be found with the <code class="highlighter-rouge">container ls</code> command):</li>
+</ul>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker <span class="nb">rm </span>CONTAINER_NAME
+</code></pre></div></div>
+
+<ul>
+  <li>View a list of active Docker processes:</li>
+</ul>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker ps
+</code></pre></div></div>
+
+<ul>
+  <li>Stop an active Docker process (CONTAINER_ID can be found with the <code class="highlighter-rouge">ps</code> command):</li>
+</ul>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker stop CONTAINER_ID
+</code></pre></div></div>
+
+<ul>
+  <li>Create a Docker image from a container:</li>
+</ul>
+
+<p>Commit the image (CONTAINER_NAME can be found with the <code class="highlighter-rouge">container ls</code> command; REPOSITORY_NAME can be any name for the image).</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker commit CONTAINER_ID <span class="o">[</span>REPOSITORY_NAME[:TAG]]
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/docker_proxy.html b/docs/docker_proxy.html
new file mode 100644 (file)
index 0000000..e7ebbce
--- /dev/null
@@ -0,0 +1,116 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="configuring-docker-for-use-with-a-proxy">Configuring Docker For Use With a Proxy</h1>
+
+<p><strong>NOTE: Docker support is only available with Intel® Movidius™ Neural Compute SDK 2.x.</strong></p>
+
+<p>See <a href="docker.html">Using the Intel® Movidius™ Neural Compute SDK with Docker</a> for general information about using Docker with the NCSDK.</p>
+
+<p>If you are using Docker behind a proxy, you will need to configure your Docker client and services to use proxy settings in order to complete the NCSDK installation or build examples.</p>
+
+<p>Official Docker proxy documentation:</p>
+<ul>
+  <li><a href="https://docs.docker.com/network/proxy/">Configure Docker to use a proxy server</a></li>
+  <li><a href="https://docs.docker.com/config/daemon/systemd/#httphttps-proxy">Control Docker with systemd - HTTP/HTTPS proxy</a></li>
+</ul>
+
+<h2 id="proxy-setup-on-ubuntu-1604">Proxy Setup on Ubuntu 16.04</h2>
+
+<p>The following steps show one example of a possible configuration for Docker proxy settings on Ubuntu 16.04 with docker-ce 18.03.1~ce-0-ubuntu.
+Refer to the official Docker documentation to configure your specific environment.</p>
+
+<h5 id="1-create-a-docker-config-file-at-dockerconfigjson">1. Create a docker config file at <code class="highlighter-rouge">~/.docker/config.json</code></h5>
+
+<p>Enter the following into the config file (replace the example proxy info with your proxy info):</p>
+<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
+ </span><span class="s2">"proxies"</span><span class="p">:</span><span class="w">
+  </span><span class="p">{</span><span class="w">
+    </span><span class="s2">"default"</span><span class="p">:</span><span class="w">
+    </span><span class="p">{</span><span class="w">
+      </span><span class="s2">"httpProxy"</span><span class="p">:</span><span class="s2">"http://proxy.example.com:80"</span><span class="w">
+    </span><span class="p">}</span><span class="w">
+  </span><span class="p">}</span><span class="w">
+</span><span class="p">}</span><span class="w">
+</span></code></pre></div></div>
+
+<h5 id="2-edit-etcdefaultdocker">2. Edit <code class="highlighter-rouge">/etc/default/docker</code></h5>
+
+<p>Change the line that says this:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#export http_proxy="http://127.0.0.1:3128/"
+</code></pre></div></div>
+<p>to this (with the info for your proxy):</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>http_proxy="http://proxy.example.com:80"
+</code></pre></div></div>
+
+<h5 id="3-edit-libsystemdsystemdockerservice">3. Edit <code class="highlighter-rouge">/lib/systemd/system/docker.service</code></h5>
+
+<p>Add this line to the Services section:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>EnvironmentFile=/etc/default/docker
+</code></pre></div></div>
+
+<h4 id="4-reload-services">4. Reload services</h4>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>systemctl daemon-reload
+<span class="nv">$ </span><span class="nb">sudo </span>systemctl restart docker
+</code></pre></div></div>
+
+<h4 id="5-edit-etcnetworkmanagernetworkmanagerconf">5. Edit <code class="highlighter-rouge">/etc/NetworkManager/NetworkManager.conf</code></h4>
+
+<p><em>Note: This may not be necessary for your configuration.</em></p>
+
+<p>Comment out the line that says <code class="highlighter-rouge">dns=dnsmasq</code> with a #:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#dns=dnsmasq
+</code></pre></div></div>
+
+<p>Restart the service.</p>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>systemctl restart network-manager
+</code></pre></div></div>
+
+<h4 id="6-test">6. Test</h4>
+
+<p>Pull the Docker image for Ubuntu 16.04:</p>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>docker pull ubuntu:16.04
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/forum.md b/docs/forum.md
deleted file mode 100644 (file)
index a13bcf7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# Movidius™ Neural Compute User Forum
-
-There is an active user forum in which users of the Neural Compute Stick discuss ideas and issues they have with regard to the NCS.  The link to the NCS User Forum is:
-
-https://ncsforum.movidius.com
-
-The forum is a good place to go if you need help troubleshooting an issue.  You may find other people that have figured out the issue or get ideas for how to fix it.  The forum is also monitored by Movidius™ engineers which provide solutions as well. 
-
diff --git a/docs/images/freezegraph_diagram.jpg b/docs/images/freezegraph_diagram.jpg
new file mode 100644 (file)
index 0000000..bb293d7
Binary files /dev/null and b/docs/images/freezegraph_diagram.jpg differ
diff --git a/docs/index.html b/docs/index.html
new file mode 100644 (file)
index 0000000..dadd2ea
--- /dev/null
@@ -0,0 +1,158 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <p><a name="Introduction"></a></p>
+<h1 id="introduction">Introduction</h1>
+<p>The Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) enables rapid prototyping and deployment of deep neural networks (DNNs) on compatible neural compute devices like the <a href="ncs.html">Intel® Movidius™ Neural Compute Stick</a>. The NCSDK includes a set of software tools to compile, profile, and validate (check) DNNs as well as the Neural Compute API (NCAPI) for application development in C/C++ or Python.</p>
+
+<p>The NCSDK has two general usages:</p>
+<ul>
+  <li>Profiling, tuning, and compiling a DNN model on a development computer (host system) with the <a href="#NcSdkTools">tools</a> provided in the NCSDK.</li>
+  <li>Prototyping a user application on a development computer (host system), which accesses the neural compute device hardware to accelerate DNN inferences via the <a href="#NcApi">NCAPI</a>.</li>
+</ul>
+
+<p>The following diagram shows the typical workflow for development with the NCSDK:</p>
+
+<p><img src="images/ncs_workflow.jpg" alt="" /></p>
+
+<p>Note that network training phase does not utilize the NCSDK.</p>
+
+<p><a name="Frameworks"></a></p>
+<h1 id="frameworks">Frameworks</h1>
+
+<p>The NCSDK currently supports two deep learning frameworks:</p>
+<ol>
+  <li><a href="caffe.html">Caffe</a> from Berkeley Vision Labs</li>
+  <li><a href="tensorflow.html">TensorFlow™</a> from Google</li>
+</ol>
+
+<p><a href="configure_network.html">See here</a> for more directions for using networks from these frameworks with the NCSDK.</p>
+
+<p><a name="NcSdkTools"></a></p>
+<h1 id="ncsdk-tools">NCSDK Tools</h1>
+
+<ul>
+  <li><a href="tools/compile.html">mvNCCompile</a>: Converts a Caffe/TensorFlow™ network and associated weights to an internal Intel® Movidius™ compiled format.</li>
+  <li><a href="tools/profile.html">mvNCProfile</a>: Provides layer-by-layer statistics to evaluate the performance of Caffe/TensorFlow™ networks on your neural compute device.</li>
+  <li><a href="tools/check.html">mvNCCheck</a>: Compares the inference results from running the network on your neural compute device vs. Caffe/TensorFlow™ for network compilation validation.</li>
+</ul>
+
+<p><a name="NcApi"></a></p>
+<h1 id="ncapi">NCAPI</h1>
+
+<p>Applications for performing inferences with the NCAPI can be developed either in C/C++ or Python. The NCAPI provides a software interface to communicate with neural compute devices, load compiled network files, manage input/output, and perform inferences.</p>
+
+<ul>
+  <li><a href="ncapi/readme.html">Documentation Overview</a>
+    <ul>
+      <li><a href="ncapi/ncapi2/py_api/readme.html">Python API</a>
+        <ul>
+          <li><a href="ncapi/python_api_migration.html">Python NCAPI v1 to NCAPI v2 Migration</a></li>
+        </ul>
+      </li>
+      <li><a href="ncapi/ncapi2/c_api/readme.html">C API</a>
+        <ul>
+          <li><a href="ncapi/c_api_migration.html">C NCAPI v1 to NCAPI v2 Migration</a></li>
+        </ul>
+      </li>
+    </ul>
+  </li>
+</ul>
+
+<p><a name="Installation"></a></p>
+<h1 id="installation">Installation</h1>
+
+<p>View the <a href="install.html">NCSDK installation instructions</a> or choose an alternate installation method:</p>
+<ul>
+  <li><a href="vm_config.html">Install in a virtual machine</a></li>
+  <li><a href="docker.html">Install in a Docker container</a></li>
+  <li><a href="virtualenv.html">Install with a Python virtualenv</a></li>
+</ul>
+
+<p><a name="Examples"></a></p>
+<h1 id="base-examples">Base Examples</h1>
+
+<p>There are several example applications and networks included with the NCSDK:</p>
+<ul>
+  <li>Caffe
+    <ul>
+      <li>GoogLeNet</li>
+      <li>AlexNet</li>
+      <li>SqueezeNet</li>
+    </ul>
+  </li>
+  <li>TensorFlow™
+    <ul>
+      <li>Inception v1</li>
+      <li>Inception v3</li>
+    </ul>
+  </li>
+  <li>Apps
+    <ul>
+      <li>hello_ncs_py</li>
+      <li>hello_ncs_cpp</li>
+      <li>multistick_cpp</li>
+    </ul>
+  </li>
+</ul>
+
+<p>Each example contains a Makefile. Running <code class="highlighter-rouge">make help</code> in the example’s base directory will give possible make targets. Running <code class="highlighter-rouge">make examples</code> in the base ncsdk directory will build all examples.</p>
+
+<p><a name="AppZoo"></a></p>
+<h1 id="neural-compute-app-zoo">Neural Compute App Zoo</h1>
+<p>Many more examples, including user-submitted networks and applications, can be found at our <a href="https://github.com/movidius/ncappzoo">Neural Compute App Zoo</a> GitHub repository.</p>
+
+<p><a name="ReleaseNotes"></a></p>
+<h1 id="release-notes">Release Notes</h1>
+
+<p>See the latest <a href="release_notes.html">Release Notes</a>.</p>
+
+<p><a name="UserForum"></a></p>
+
+<h1 id="intel-movidius-user-forum">Intel® Movidius™ User Forum</h1>
+
+<p>There is an active user forum for users of the NCSDK to discuss ideas and seek troubleshooting help at <a href="https://ncsforum.movidius.com">https://ncsforum.movidius.com</a>.</p>
+
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/install.html b/docs/install.html
new file mode 100644 (file)
index 0000000..03ec2b3
--- /dev/null
@@ -0,0 +1,137 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="intel-movidius-neural-compute-sdk-installation-and-configuration">Intel® Movidius™ Neural Compute SDK Installation and Configuration</h1>
+
+<p>This guide will tell you how to install the Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) and build the included examples.</p>
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<ul>
+  <li>Compatible neural compute device (like the <a href="ncs.html">Intel® Movidius™ Neural Compute Stick</a>)</li>
+  <li>Git</li>
+  <li>Development computer with a supported OS:
+    <ul>
+      <li>x86-64 with Ubuntu (64 bit) 16.04 Desktop</li>
+      <li>Raspberry Pi 3 with Raspbian Stretch (starting with SDK 1.09.xx)
+        <ul>
+          <li><a href="https://linuxconfig.org/how-to-upgrade-debian-8-jessie-to-debian-9-stretch">Upgrade Raspbian Jessie to Stretch</a></li>
+        </ul>
+      </li>
+      <li>Other operating environments (with supported OS):
+        <ul>
+          <li><a href="vm_config.html">Virtual Machine</a></li>
+          <li><a href="docker.html">Docker</a></li>
+          <li><a href="virtualenv.html">Python virtualenv</a></li>
+        </ul>
+      </li>
+      <li>Internet connection</li>
+      <li>USB camera (optional, needed for some examples)</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="upgrading-from-ncsdk-1x-to-ncsdk-2x">Upgrading from NCSDK 1.x to NCSDK 2.x</h2>
+
+<p>If you currently have NCSDK 1.x installed and you are installing NCSDK 2.x, the Neural Compute API (NCAPI) will be upgraded from v1 to v2. NCAPI v2 is not backwards-compatible with NCAPI v1 (i.e. programs written with NCAPI v1 will not compile or run with NCAPI v2). However, all of your NCAPI v1 files will be moved to /opt/movidius/ncsdk1.</p>
+
+<p>For more information about NCAPI changes, see the <a href="ncapi/readme.html">Neural Compute API overview</a>.</p>
+
+<h2 id="installation">Installation</h2>
+
+<p>To perform the typical installation of the NCSDK, use the following command on your host machine:</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone <span class="nt">-b</span> ncsdk2 http://github.com/Movidius/ncsdk <span class="o">&amp;&amp;</span> <span class="nb">cd </span>ncsdk <span class="o">&amp;&amp;</span> make <span class="nb">install</span>
+</code></pre></div></div>
+
+<p>The <code class="highlighter-rouge">-b ncsdk2</code> option checks out the latest version of NCSDK 2 from the ncsdk2 branch. If you omit this option you will install the NCSDK version on the master branch, which is currently NCSDK 1.x.</p>
+
+<p><strong>Caffe Users:</strong> If you are installing on a host machine that already has Caffe installed and its directory is already in the PYTHONPATH environment variable, you must remove the existing Caffe directory from the PYTHONPATH environment variable prior to installing the NCSDK.  You will need to manually modify the PYTHONPATH to match your development needs such that it points to the Caffe version installed with the NCSDK when using the NCSDK and it points to other Caffe versions when you wish to use those.</p>
+
+<p><strong>Note:</strong> The installation will only set the PYTHONPATH environment variable for the current user.  It will do so by modifying the .bashrc file for that user.  To use the NCSDK as another user on the host machine you will need to manually set the PYTHONPATH for that user.</p>
+
+<h3 id="raspberry-pi-installation-notes">Raspberry Pi Installation Notes</h3>
+
+<p>We recommend a 16GB SD card for a full NCSDK installation.</p>
+
+<p>You will likely need to increase the swapfile size on the Raspberry Pi in order to successfully complete NCSDK and/or OpenCV installation. To increase the swapfile size, edit the value of CONF_SWAPSIZE in /etc/dphys-swapfile:</p>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>nano /etc/dphys-swapfile
+</code></pre></div></div>
+
+<p>The default value is 100 (MB). We recommend that you change this to 1024 (MB) or greater.</p>
+
+<p>Then restart the swapfile service:</p>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo</span> /etc/init.d/dphys-swapfile restart
+</code></pre></div></div>
+
+<p>After you have installed the NCSDK (and optionally OpenCV), you should change the swapfile size back to 100 MB.</p>
+
+<h2 id="examples">Examples</h2>
+
+<p>Use the following command in your ncsdk directory to download necessary prerequisites and models and build all examples:</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>make examples
+</code></pre></div></div>
+
+<p>You must have a neural compute device attached to your system to build the examples.</p>
+
+<h4 id="building-individual-examples">Building Individual Examples</h4>
+<p>Each example comes with its own Makefile that will install only that specific example and any prerequisites that it requires. To build and run an example, run the following command within that example’s directory:</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>make run
+</code></pre></div></div>
+
+<p>The Makefile for each example also has a ‘help’ target that will display all possible make targets:</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>make <span class="nb">help</span>
+</code></pre></div></div>
+
+<h1 id="uninstallation">Uninstallation</h1>
+
+<p>To uninstall the NCSDK, type the following command:</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>make uninstall
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/install.md b/docs/install.md
deleted file mode 100644 (file)
index e5f105d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-# Installation and Configuration
-This page provides installation and configuration information needed to use the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) and the examples provided in this repository. To use the Intel Movidius NCS, you will need to have the Intel Movidius Neural Compute SDK installed on your development computer. The SDK installation provides an option to install the examples in this repository. If you've already installed the SDK on your development computer, you may have selected the option to also install these examples. If you have not already installed the SDK, you should follow the instructions in the Installation of SDK and Examples section on this page. When prompted, select the option to install the examples. 
-
-## Prerequisites
-To build and run the examples in this repository, you will need to have the following:
-- Intel Movidius Neural Compute Stick
-- Intel Movidius Neural Compute SDK 
-- Development computer with supported OS 
-  - x86-64 with Ubuntu (64 bit) 16.04 Desktop 
-  - Raspberry Pi 3 with Raspian Stretch (starting with SDK 1.09.xx)
-    - See [Upgrade Raspian Jessie to Stretch](https://linuxconfig.org/how-to-upgrade-debian-8-jessie-to-debian-9-stretch) 
-  - Virtual Machine per the [supported VM configuration](VirtualMachineConfig.md)
-- Internet connection
-- USB camera (optional)
-
-## Connecting the Intel Movidius NCS to a Development Computer
-The Intel Movidius NCS connects to the development computer over a USB 2.0 High Speed interface. Plug the Intel Movidius NCS directly to a USB port on your development computer or into a powered USB hub that is plugged into your development computer.
-
-![](images/ncs_plugged.jpg)
-
-## Installation of SDK and Examples
-To install the SDK along with the examples in this repository, use the following command on your development computer. This is the typical installation. If your development machine already has caffe installed see the note below.  If you haven't already installed the SDK on your development computer, you should use this command to install:
-```
-git clone http://github.com/Movidius/ncsdk && cd ncsdk && make install && make examples
-```
-<strong>Note:</strong> if you are installing on a machine that already has caffe installed and it's directory is already in the PYTHONPATH environment variable you will need to manually remove the existing directory from the PYTHONPATH environment variable prior to installing the ncsdk.  Also, you will need to manually adjust the PYTHONPATH to match your development needs such that it points to the caffe version installed with the NCSDK when using the NCSDK, and it points to other caffe versions when using those.
-
-<strong>Note:</strong> The installation will only set the PYTHONPATH environment variable for the current user.  It will do so by modifying the .bashrc file for that user.  To use the sdk as other users on the machine you will need to manually set the PYTHONPATH for those other users.
-
-## Installation of Examples without SDK
-To install only the examples and not the SDK on your development computer, use the following command to clone the repository and then make appropriate examples for your development computer. If you already have the SDK installed and only need the examples on your machine, you should use this command to install the examples:
-```
-git clone http://github.com/Movidius/ncsdk && cd ncsdk && make examples
-```
-
-## Building Individual Examples
-Whether installing with the SDK or without it, both methods above will install and build the examples that are appropriate for your development system, including prerequisite software. Each example comes with its own Makefile that will install only that specific example and any prerequisites that it requires. To install and build any individual example, run the 'make' command from within that example's base directory. For example, to build the GoogLeNet examples, type the following command:
-
-```
-cd examples/Caffe/GoogLeNet && make
-
-```
-
-The Makefile for each example also has a 'help' target that will display all possible targets. To see all possible targets for any example, use the following command from within the examples top directory:
-```
-make help
-
-```
-
-## Uninstallation 
-To uninstall the SDK, type the following command:
-```
-make uninstall
-
-```
-
-## Installation Manifest
-For the list of files that 'make install' will modify on your system (outside of the repository), see the [installation manifest](manifest.md). 
diff --git a/docs/jekyll-theme-modernist.gemspec b/docs/jekyll-theme-modernist.gemspec
new file mode 100644 (file)
index 0000000..acf9ee7
--- /dev/null
@@ -0,0 +1,19 @@
+# encoding: utf-8
+
+Gem::Specification.new do |s|
+  s.name          = "jekyll-theme-modernist"
+  s.version       = "0.1.0"
+  s.license       = "CC0-1.0"
+  s.authors       = ["Steve Smith", "GitHub, Inc."]
+  s.email         = ["opensource+jekyll-theme-modernist@github.com"]
+  s.homepage      = "https://github.com/pages-themes/modernist"
+  s.summary       = "Modernist is a Jekyll theme for GitHub Pages"
+
+  s.files         = `git ls-files -z`.split("\x0").select do |f|
+    f.match(%r{^((_includes|_layouts|_sass|assets)/|(LICENSE|README)((\.(txt|md|markdown)|$)))}i)
+  end
+
+  s.platform      = Gem::Platform::RUBY
+  s.add_runtime_dependency "jekyll", "~> 3.5"
+  s.add_runtime_dependency "jekyll-seo-tag", "~> 2.0"
+end
diff --git a/docs/manifest.md b/docs/manifest.md
deleted file mode 100644 (file)
index 85c33d2..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-
-# NC SDK Installation Manifest 
-These are the files and directories installed outside of repository directory as part of the NC SDK.
-
-- /usr/local/include/mvnc.h
-- /usr/local/include/mvnc_deprecated.h
-- /usr/local/lib/libmvnc.so
-- /usr/local/lib/libmvnc.so.0
-- /usr/local/lib/mvnc/libmvnc.so
-- /usr/local/lib/mvnc/MvNCAPI.mvcmd
-- /usr/local/bin/mvNCCheck
-- /usr/local/bin/mvNCProfile
-- /usr/local/bin/mvNCCompile
-- /etc/udev/rules.d/97-usbboot.rules
-- /opt/movidius/*
diff --git a/docs/ncapi/c_api_migration.html b/docs/ncapi/c_api_migration.html
new file mode 100644 (file)
index 0000000..c562db0
--- /dev/null
@@ -0,0 +1,505 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../assets/css/style.css">
+    <script src="../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="migrating-cc-applications-from-ncapi-v1-to-ncapi-v2">Migrating C/C++ Applications from NCAPI v1 to NCAPI v2</h1>
+
+<h4 id="sections">Sections:</h4>
+
+<ul>
+  <li><a href="#Changes">Significant Changes</a></li>
+  <li><a href="#API">Equivalent API Calls</a></li>
+  <li><a href="#Examples">Example Code Comparison</a></li>
+</ul>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v2 Documentation</th>
+      <th>NCAPI v1 Documentation</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncapi2/c_api/readme.html">C API v2</a></td>
+      <td><a href="ncapi1/c_api/readme.html">C API v1</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p><a name="Changes"></a></p>
+<h1 id="significant-changes">Significant Changes</h1>
+
+<h2 id="fifo-queues">FIFO queues</h2>
+
+<p>In the Intel® Movidius™ Neural Compute SDK (Intel® Movidius NCSDK) v1, <a href="ncapi1/c_api/mvncLoadTensor.html">mvncLoadTensor()</a> was used to load an input tensor to a neural compute device and trigger an inference. <a href="ncapi1/c_api/mvncGetResult.html">mvncGetResult()</a> was used to read the output inference result.</p>
+
+<p>NCAPI v2 introduced FIFO queues for input and output. This allows multiple inputs to be queued for inference and allows multiple graphs to read from the same input queue. FIFO usage is required by the NCAPI v2.</p>
+
+<p>Typical FIFO usage through the API is as follows:</p>
+<ol>
+  <li>Create pointers to <a href="ncapi2/c_api/ncFifoHandle_t.html">ncFifoHandle_t</a> structs for input and output FIFOs.</li>
+  <li>Allocate a graph and initialize and allocate the associated FIFOs with <a href="ncapi2/c_api/ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a> or <a href="ncapi2/c_api/ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a>.</li>
+  <li>Add input tensors to the input FIFO and queue an inference with <a href="ncapi2/c_api/ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a>.</li>
+  <li>Read the inference result from the output FIFO with <a href="ncapi2/c_api/ncFifoReadElem.html">ncFifoReadElem()</a>.</li>
+  <li>After usage, free FIFO resources with <a href="ncapi2/c_api/ncFifoDestroy.html">ncFifoDestroy()</a>.</li>
+</ol>
+
+<p>See the <a href="#Example">Example Code Comparison</a> section below for example FIFO usage.</p>
+
+<h2 id="inputoutput-data-types">Input/output data types</h2>
+
+<p>In NCAPI v1, input data for inferences had to be 16 bit floating point data type.</p>
+
+<p>In NCAPI v2, input data for inferences can be 16 bit or 32 bit floating point data type. The default data type is FP32. The data type is set for each FIFO using <a href="ncapi2/c_api/ncFifoSetOption.html">ncFifoSetOption()</a> with <a href="ncapi2/c_api/ncFifoDataType_t.html">ncFifoDataType_t</a> or when creating FIFOs with <a href="ncapi2/c_api/ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a>.</p>
+
+<p>Note: If the input FIFO <a href="ncapi2/c_api/ncFifoDataType_t.html">ncFifoDataType_t</a> is configured to FP32, the API will convert the data to the FP16 data type automatically when performing inferences. If the output FIFO <a href="ncapi2/c_api/ncFifoDataType_t.html">ncFifoDataType_t</a> is configured to 32FP, the API will convert the output back to the FP32 data type.</p>
+
+<h2 id="other-changes">Other changes</h2>
+<p>Most function names and signatures were updated. Please reference the <a href="ncapi2/c_api/readme.html">NCAPI v2</a> documentation for correct usage.</p>
+
+<p><a href="#Top">Top</a></p>
+
+<p><a name="API"></a></p>
+<h1 id="equivalent-api-calls">Equivalent API Calls</h1>
+
+<h3 id="enumerations">Enumerations</h3>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v1</th>
+      <th>NCAPI v2</th>
+      <th>Notes</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncStatus.html">mvncStatus</a></td>
+      <td><a href="ncapi2/c_api/ncStatus_t.html">ncStatus_t</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncDeviceOptions.html">mvncDeviceOptions</a></td>
+      <td><a href="ncapi2/c_api/ncDeviceOption_t.html">ncDeviceOption_t</a></td>
+      <td>There are new options in NCAPI v2.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncGlobalOptions.html">mvncGlobalOptions</a></td>
+      <td><a href="ncapi2/c_api/ncGlobalOption_t.html">ncGlobalOption_t</a></td>
+      <td>There are new options in NCAPI v2.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncGraphOptions.html">mvncGraphOptions</a></td>
+      <td><a href="ncapi2/c_api/ncGraphOption_t.html">ncGraphOption_t</a></td>
+      <td>There are new options in NCAPI v2.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncFifoOption_t.html">ncFifoOption_t</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing options for FIFO queues.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncDeviceState_t.html">ncDeviceState_t</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing possible device states.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncGraphState_t.html">ncGraphState_t</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing possible graph states.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncFifoState_t.html">ncFifoState_t</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing possible FIFO states.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncFifoType_t.html">ncFifoType_t</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing possible FIFO types (i.e. read-only, write-only).</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncFifoDataType_t.html">ncFifoDataType_t</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing possible FIFO data types.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncDeviceHwVersion_t.html">ncDeviceHwVersion_t</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing device hardware versions.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h3 id="structs">Structs</h3>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v1</th>
+      <th>NCAPI v2</th>
+      <th>Notes</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncDeviceHandle_t.html">struct ncDeviceHandle_t</a></td>
+      <td>This is a new struct in NCAPI v2 that is used to point to a device.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncGraphHandle_t.html">struct ncGraphHandle_t</a></td>
+      <td>This is a new struct in NCAPI v2 that is used to point to a graph.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncFifoHandle_t.html">struct ncFifoHandle_t</a></td>
+      <td>This is a new struct in NCAPI v2 that is used to point to a FIFO.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncTensorDescriptor_t.html">struct ncTensorDescriptor_t</a></td>
+      <td>This is a new struct in NCAPI v2 that describes graph inputs and outputs.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h3 id="functions">Functions</h3>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v1</th>
+      <th>NCAPI v2</th>
+      <th>Notes</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncGetGlobalOption.html">mvncGetGlobalOption()</a></td>
+      <td><a href="ncapi2/c_api/ncGlobalGetOption.html">ncGlobalGetOption()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncSetGlobalOption.html">mvncSetGlobalOption()</a></td>
+      <td><a href="ncapi2/c_api/ncGlobalSetOption.html">ncGlobalSetOption()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncGetDeviceName.html">mvncGetDeviceName()</a></td>
+      <td><em>n/a</em></td>
+      <td>In NCAPI v2, select a device by zero-based index when calling <a href="ncapi2/c_api/ncDeviceCreate.html">ncDeviceCreate()</a>. After creating the device handle, you get can get the device name with <a href="ncapi2/c_api/ncDeviceGetOption.html">ncDeviceGetOption()</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncOpenDevice.html">mvncOpenDevice()</a></td>
+      <td><a href="ncapi2/c_api/ncDeviceCreate.html">ncDeviceCreate()</a><br />+<br /><a href="ncapi2/c_api/ncDeviceOpen.html">ncDeviceOpen()</a></td>
+      <td>In NCAPI v2 you must create a pointer to a <a href="ncapi2/c_api/ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct and pass it to <a href="ncapi2/c_api/ncDeviceCreate.html">ncDeviceCreate()</a> and then <a href="ncapi2/c_api/ncDeviceOpen.html">ncDeviceOpen()</a> before using it in any other functions.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncCloseDevice.html">mvncCloseDevice()</a></td>
+      <td><a href="ncapi2/c_api/ncDeviceClose.html">ncDeviceClose()</a><br />+<br /><a href="ncapi2/c_api/ncDeviceDestroy.html">ncDeviceDestroy()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncGetDeviceOption.html">mvncGetDeviceOption()</a></td>
+      <td><a href="ncapi2/c_api/ncDeviceGetOption.html">ncDeviceGetOption()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncSetDeviceOption.html">mvncSetDeviceOption()</a></td>
+      <td><a href="ncapi2/c_api/ncDeviceSetOption.html">ncDeviceSetOption()</a></td>
+      <td>Some device options may need to be set before calling <a href="ncapi2/c_api/ncDeviceOpen.html">ncDeviceOpen()</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncAllocateGraph.html">mvncAllocateGraph()</a></td>
+      <td><a href="ncapi2/c_api/ncGraphCreate.html">ncGraphCreate()</a><br />+<br /><a href="ncapi2/c_api/ncGraphAllocate.html">ncGraphAllocate()</a><br /><br />or<br /><a href="ncapi2/c_api/ncGraphCreate.html">ncGraphCreate()</a><br />+<br /><a href="ncapi2/c_api/ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a><br /><br />or<br /><a href="ncapi2/c_api/ncGraphCreate.html">ncGraphCreate()</a><br />+<br /><a href="ncapi2/c_api/ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a></td>
+      <td>In NCAPI v2 you must create a pointer to a <a href="ncapi2/c_api/ncGraphHandle_t.html">ncGraphHandle_t</a> struct and pass it to <a href="ncapi2/c_api/ncGraphCreate.html">ncGraphCreate()</a> before using it in any other functions.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncDeallocateGraph.html">mvncDeallocateGraph()</a></td>
+      <td><a href="ncapi2/c_api/ncGraphDestroy.html">ncGraphDestroy()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncGetGraphOption.html">mvncGetGraphOption()</a></td>
+      <td><a href="ncapi2/c_api/ncGraphGetOption.html">ncGraphGetOption()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncSetGraphOption.html">mvncSetGraphOption()</a></td>
+      <td><a href="ncapi2/c_api/ncGraphSetOption.html">ncGraphSetOption()</a></td>
+      <td>Some graph options may need to be set before calling <a href="ncapi2/c_api/ncGraphAllocate.html">ncGraphAllocate()</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncLoadTensor.html">mvncLoadTensor()</a></td>
+      <td><a href="ncapi2/c_api/ncFifoWriteElem.html">ncFifoWriteElem()</a><br />+<br /><a href="ncapi2/c_api/ncGraphQueueInference.html">ncGraphQueueInference()</a><br /><br />or<br /><a href="ncapi2/c_api/ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a></td>
+      <td>This replaces NCAPI v1’s <a href="ncapi1/c_api/mvncLoadTensor.html">mvncLoadTensor()</a> when used in conjunction with <a href="ncapi2/c_api/ncGraphQueueInference.html">ncGraphQueueInference()</a>.<br /><br />The convenience function <a href="ncapi2/c_api/ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a> can be used to combine both NCAPI v2 calls into one.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/c_api/mvncGetResult.html">mvncGetResult()</a></td>
+      <td><a href="ncapi2/c_api/ncFifoReadElem.html">ncFifoReadElem()</a></td>
+      <td>The output is read from the output FIFO specified in the call to <a href="ncapi2/c_api/ncGraphQueueInference.html">ncGraphQueueInference()</a>.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncFifoCreate.html">ncFifoCreate()</a></td>
+      <td>In NCAPI v2 you must create a pointer to an <a href="ncapi2/c_api/ncFifoHandle_t.html">ncFifoHandle_t</a> struct and pass it to <a href="ncapi2/c_api/ncFifoCreate.html">ncFifoCreate()</a> and then <a href="ncapi2/c_api/ncFifoAllocate.html">ncFifoAllocate()</a> before using it in any other functions.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncFifoAllocate.html">ncFifoAllocate()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncFifoDestroy.html">ncFifoDestroy()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncFifoSetOption.html">ncFifoSetOption()</a></td>
+      <td>All FIFO options must be set before calling <a href="ncapi2/c_api/ncFifoAllocate.html">ncFifoAllocate()</a>.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/c_api/ncFifoGetOption.html">ncFifoGetOption()</a></td>
+      <td> </td>
+    </tr>
+  </tbody>
+</table>
+
+<p><a href="#Top">Top</a></p>
+
+<p><a name="Example"></a></p>
+<h1 id="example-code-comparison">Example Code Comparison</h1>
+
+<p>NCAPI v1:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// NCAPI v1</span>
+<span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+    <span class="c1">// You can check that this return code is MVNC_OK after each API function call</span>
+    <span class="c1">// This is omitted in this example for better readability</span>
+    <span class="n">mvncStatus</span> <span class="n">retCode</span><span class="p">;</span>
+    
+    <span class="c1">// Initialize and open a device</span>
+    <span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">NAME_SIZE</span> <span class="o">=</span> <span class="mi">100</span><span class="p">;</span>
+    <span class="kt">char</span> <span class="n">deviceName</span><span class="p">[</span><span class="n">NAME_SIZE</span><span class="p">];</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncGetDeviceName</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">deviceName</span><span class="p">,</span> <span class="n">NAME_SIZE</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncOpenDevice</span><span class="p">(</span><span class="n">deviceName</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+    
+    <span class="c1">// Read a graph from file at some GRAPH_FILEPATH</span>
+    <span class="c1">// void* graphBuffer = ...</span>
+    <span class="c1">// unsigned int graphBufferLength = ...</span>
+    
+    <span class="c1">// Allocate the graph to the device</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphHandle</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncAllocateGraph</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">graphBuffer</span><span class="p">,</span> <span class="n">graphBufferLength</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphBuffer</span><span class="p">)</span>
+    
+    <span class="c1">// Read and pre-process input (16 bit floating point data type required)</span>
+    <span class="c1">// void* imageBuffer = ...</span>
+    <span class="c1">// unsigned int imageBufferLength = ...</span>
+    
+    <span class="cp"># Load the image to the device
+</span>    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncLoadTensor</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">imageBuffer</span><span class="p">,</span> <span class="n">imageBufferLength</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">imageBuffer</span><span class="p">);</span>
+    
+    <span class="c1">// Get the results from the device</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">resultData</span><span class="p">;</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">userParam</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">resultDataLength</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncGetResult</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">resultData</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">resultDataLength</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">userParam</span><span class="p">);</span>
+    
+    <span class="c1">// Do something with the results...</span>
+    
+    <span class="c1">// Clean up</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncDeallocateGraph</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">);</span>
+    <span class="n">graphHandle</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncCloseDevice</span><span class="p">(</span><span class="n">devHandle</span><span class="p">);</span>
+    <span class="n">deviceHandle</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+<p>NCAPI v2:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// NCAPI v2</span>
+<span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+    <span class="c1">// You can check that this return code is equal to NC_OK after each API function call</span>
+    <span class="c1">// This is omitted in this example for better readability</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionSize</span><span class="p">;</span>
+
+    <span class="c1">// Initialize and open a device</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+
+    <span class="c1">// Load a graph from file</span>
+    <span class="c1">// void* graphBuffer = ...</span>
+    <span class="c1">// unsigned int graphBufferLength = ...</span>
+
+    <span class="c1">// Initialize and allocate the graph to the device</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"graph1"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphAllocate</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="n">graphHandle</span><span class="p">,</span> <span class="n">graphBuffer</span><span class="p">,</span> <span class="n">graphBufferLength</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphBuffer</span><span class="p">);</span>
+       
+    <span class="c1">// Create an input FIFO</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inputFIFO</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"input1"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">);</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">inputDescriptor</span><span class="p">;</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">inputDescriptor</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputDescriptor</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">inputFIFO</span><span class="p">,</span> <span class="n">deviceHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputDescriptor</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+
+    <span class="c1">// Create an output FIFO    </span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outputFIFO</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"output1"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_RO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">);</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">outputDescriptor</span><span class="p">;</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">inputDescriptor</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputDescriptor</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">outputFIFO</span><span class="p">,</span> <span class="n">deviceHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputDescriptor</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+
+    <span class="c1">// Read and preprocess input...</span>
+    <span class="c1">// float* imageBuffer = ...</span>
+    <span class="c1">// unsigned int imageBufferLength = ...</span>
+
+    <span class="c1">// Write the image to the input FIFO    </span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoWriteElem</span><span class="p">(</span><span class="n">inputFIFO</span><span class="p">,</span> <span class="n">imageBuffer</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">imageBufferLength</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">imageBuffer</span><span class="p">);</span>
+    
+    <span class="c1">// Queue the inference</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphQueueInference</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
+
+    <span class="c1">// Get the results from the output FIFO</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">result</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">fifoOutputSize</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionDataLen</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>
+    <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_FIFO_ELEMENT_DATA_SIZE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionDataLen</span><span class="p">);</span>
+    <span class="n">result</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>    
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoReadElem</span><span class="p">(</span><span class="n">outputFIFO</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+
+    <span class="c1">// Do something with the results...</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">result</span><span class="p">);</span>
+    
+    <span class="c1">// Clean up</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+<p>NCAPI v2 with convenience functions:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// NCAPI v2</span>
+<span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+    <span class="c1">// You can check that this return code is equal to NC_OK after each API function call</span>
+    <span class="c1">// This is omitted in this example for better readability</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+
+    <span class="c1">// Initialize and open a device</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+
+    <span class="c1">// Load a graph from file</span>
+    <span class="c1">// void* graphBuffer = ...</span>
+    <span class="c1">// unsigned int graphBufferLength = ...</span>
+    
+    <span class="c1">// Initialize the graph</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"graph1"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+       
+    <span class="c1">// CONVENIENCE FUNCTION: Allocate the graph to the device and create input/output FIFOs with default options</span>
+    <span class="c1">// Alternatively, use ncGraphAllocateWithFifosEx() to do this with explicit FIFO options</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inputFIFO</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outputFIFO</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphAllocateWithFifos</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="n">graphHandle</span><span class="p">,</span> <span class="n">graphBuffer</span><span class="p">,</span> <span class="n">graphBufferLength</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphBuffer</span><span class="p">);</span>
+
+    <span class="c1">// Read and preprocess input...</span>
+    <span class="c1">// float* imageBuffer = ...</span>
+    <span class="c1">// unsigned int imageBufferLength = ...</span>
+
+    <span class="c1">// Write the image to the input FIFO and queue the inference</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphQueueInferenceWithFifoElem</span><span class="p">(</span>
+                    <span class="n">graphHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">,</span>
+                    <span class="n">imageBuffer</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">imageBufferLength</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>    
+    
+    <span class="c1">// Get the results from the output FIFO</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">result</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">fifoOutputSize</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionDataLen</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>
+    <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_FIFO_ELEMENT_DATA_SIZE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionDataLen</span><span class="p">);</span>
+    <span class="n">result</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>    
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoReadElem</span><span class="p">(</span><span class="n">outputFIFO</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+
+    <span class="c1">// Do something with the results...</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">result</span><span class="p">);</span>
+
+    <span class="c1">// Clean up</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+<p><a href="#Top">Top</a></p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncAllocateGraph.html b/docs/ncapi/ncapi1/c_api/mvncAllocateGraph.html
new file mode 100644 (file)
index 0000000..9fc26da
--- /dev/null
@@ -0,0 +1,170 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncallocategraph">mvncAllocateGraph()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncOpenDevice.html">mvncOpenDevice</a>, <a href="mvncDeallocateGraph.html">mvncDeallocateGraph</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function allocates a graph on the specified device and creates a handle to the graph that can be passed to other API functions such as mvncLoadTensor() and mvncGetResult(). When the caller is done with the graph, the mvncDeallocateGraph() function should be called to free the resources associated with the graph.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncAllocateGraph</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="kt">void</span> <span class="o">**</span><span class="n">graphHandle</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">graphFile</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphFileLength</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td>void*</td>
+      <td>The deviceHandle pointer to the opaque device datatype (which was created via mvncOpenDevice()) on which the graph should be allocated.</td>
+    </tr>
+    <tr>
+      <td>graphHandle</td>
+      <td>void**</td>
+      <td>Address of a pointer that will be set to point to an opaque graph datatype. Upon successful return, this graphHandle can be passed to other API funtions.</td>
+    </tr>
+    <tr>
+      <td>graphFile</td>
+      <td>const void*</td>
+      <td>Pointer to a buffer that contains the contents of a graph file. The graph file is a compiled neural network file that gets created by the MvNCCompile SDK tool.</td>
+    </tr>
+    <tr>
+      <td>graphFileLength</td>
+      <td>unsigned int</td>
+      <td>The number of bytes allocated for the buffer that graphFile points to.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+<ul>
+  <li>Be sure to call mvncDeallocateGraph() for the graphHandle returned from this function.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
+<span class="c1">// Graph file name</span>
+<span class="cp">#define GRAPH_FILE_NAME "graphfile"
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">;</span> 
+    
+    <span class="c1">//</span>
+    <span class="c1">// Assume NCS device opened here and deviceHandle is valid now.</span>
+    <span class="c1">//</span>
+    
+    <span class="c1">// Now read in a graph file so graphFileBuf will point to the </span>
+    <span class="c1">// bytes of the file in a memory buffer and graphFileLen will be</span>
+    <span class="c1">// set to the number of bytes in the graph file and memory buffer.</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphFileLen</span><span class="p">;</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphFileBuf</span> <span class="o">=</span> <span class="n">LoadFile</span><span class="p">(</span><span class="n">GRAPH_FILE_NAME</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphFileLen</span><span class="p">);</span>
+
+    <span class="c1">// Allocate the graph</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncAllocateGraph</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">graphFileBuf</span><span class="p">,</span> <span class="n">graphFileLen</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Error allocating graph</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Could not allocate graph for file: %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">GRAPH_FILE_NAME</span><span class="p">);</span> 
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>   <span class="c1">// Successfully allocated graph. Now graphHandle is ready to go.  </span>
+        <span class="c1">// Use graphHandle for other API calls and call mvncDeallocateGraph</span>
+        <span class="c1">// when done with it.</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully allocated graph for %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">GRAPH_FILE_NAME</span><span class="p">);</span>
+        
+        <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncDeallocateGraph</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">);</span>
+        <span class="n">graphHandle</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="p">}</span>
+    
+    <span class="n">free</span><span class="p">(</span><span class="n">graphFileBuf</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncCloseDevice</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">deviceHandle</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+<span class="p">}</span>
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncCloseDevice.html b/docs/ncapi/ncapi1/c_api/mvncCloseDevice.html
new file mode 100644 (file)
index 0000000..0289371
--- /dev/null
@@ -0,0 +1,148 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncclosedevice">mvncCloseDevice()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncOpenDevice.html">mvncOpenDevice</a>, <a href="mvncGetDeviceOption.html">mvncGetDeviceOption</a>, <a href="mvncSetDeviceOption.html">mvncSetDeviceOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to cease communication and reset the device.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncCloseDevice</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">deviceHandle</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td>void*</td>
+      <td>Pointer to the opaque NCS device structure that was allocated and returned from the mvncOpenDevice function.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+</span>
+<span class="k">extern</span> <span class="s">"C"</span> 
+<span class="p">{</span>
+<span class="cp">#include &lt;mvnc.h&gt;
+</span><span class="p">}</span>
+<span class="c1">// Somewhat arbitrary buffer size for the device name.</span>
+<span class="cp">#define NAME_SIZE 100
+</span><span class="kt">int</span> <span class="n">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">mvncStatus</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="kt">void</span> <span class="o">*</span><span class="n">deviceHandle</span><span class="p">;</span>
+    <span class="kt">char</span> <span class="n">devName</span><span class="p">[</span><span class="n">NAME_SIZE</span><span class="p">];</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncGetDeviceName</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">devName</span><span class="p">,</span> <span class="n">NAME_SIZE</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// failed to get device name, maybe none plugged in.</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"No NCS devices found</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    
+    <span class="c1">// Try to open the NCS device via the device name.</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncOpenDevice</span><span class="p">(</span><span class="n">devName</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Failed to open the device.  </span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Could not open NCS device</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    
+    <span class="c1">// deviceHandle is ready to use now.  </span>
+    <span class="c1">// Pass it to other NC API calls as needed and close it when finished.</span>
+    <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully opened NCS device!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+    
+    <span class="c1">// Close the device previously opened by mvncOpenDevice().</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncCloseDevice</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncDeallocateGraph.html b/docs/ncapi/ncapi1/c_api/mvncDeallocateGraph.html
new file mode 100644 (file)
index 0000000..a65d415
--- /dev/null
@@ -0,0 +1,154 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncdeallocategraph">mvncDeallocateGraph()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncOpenDevice.html">mvncOpenDevice</a>, <a href="mvncAllocateGraph.html">mvncAllocateGraph</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function deallocates a graph that was previously allocated with mvncAllocateGraph(). After successful return from this function, the passed graphHandle will be invalid and should not be used.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncDeallocateGraph</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">graphHandle</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphHandle</td>
+      <td>void**</td>
+      <td>Pointer to opaque graph data type that was initialized with the mvncAllocateGraph() function.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+<p>Using a deallocated graph handle can lead to hard-to-find bugs. To prevent this, it’s good practice to set the handle to NULL (or nullptr for C++ 11) after deallocating, as shown in this code snippet:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncDeallocateGraph</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">);</span>
+<span class="n">graphHandle</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+</code></pre></div></div>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// Graph file name</span>
+<span class="cp">#define GRAPH_FILE_NAME "graphfile"
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">;</span> 
+    
+    <span class="p">.</span>
+    <span class="p">.</span>
+    <span class="p">.</span>
+    
+    <span class="c1">//</span>
+    <span class="c1">// Assume NCS device opened here and deviceHandle is valid now</span>
+    <span class="c1">// and the graph file is in graphFileBuf and length in bytes  </span>
+    <span class="c1">// is in graphFileLen.</span>
+    <span class="c1">//</span>
+
+    <span class="c1">// Allocate the graph</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncAllocateGraph</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">graphFileBuf</span><span class="p">,</span> <span class="n">graphFileLen</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Error allocating graph</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Could not allocate graph for file: %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">GRAPH_FILE_NAME</span><span class="p">);</span> 
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>   <span class="c1">// Successfully allocated graph. Now graphHandle is ready to go.  </span>
+        <span class="c1">// Use graphHandle for other API calls, and call mvncDeallocateGraph</span>
+        <span class="c1">// when done with it.</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully allocated graph for %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">GRAPH_FILE_NAME</span><span class="p">);</span>
+        
+        <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncDeallocateGraph</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">);</span>
+        <span class="n">graphHandle</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="p">}</span>
+<span class="p">.</span>
+<span class="p">.</span>
+<span class="p">.</span>
+
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncDeviceOptions.html b/docs/ncapi/ncapi1/c_api/mvncDeviceOptions.html
new file mode 100644 (file)
index 0000000..a86caf5
--- /dev/null
@@ -0,0 +1,95 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncdeviceoptions-enumeration">mvncDeviceOptions enumeration</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value/s</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncGetDeviceOption.html">mvncGetDeviceOption</a>, <a href="mvncSetDeviceOption.html">mvncSetDeviceOption</a>, <a href="mvncOpenDevice.html">mvncOpenDevice</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This enumeration is used to specify an option on the Intel® Movidius™ NCS device that can be written or read via mvncGetDeviceOption() and mvncSetDeviceOption(). The table below provides details on the meaning of each of the values in the enumeration.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Get/Set</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>MVNC_THERMAL_THROTTLING_LEVEL</td>
+      <td>int</td>
+      <td>1, 2</td>
+      <td>get</td>
+      <td>1: if lower guard temperature threshold of chip sensor is reached. This indicates short throttling time is in action between inferences to protect the device. <br />2: if upper guard temperature of chip sensor is reached. This indicates long throttling time is in action between inferences to protect the device.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncGetDeviceName.html b/docs/ncapi/ncapi1/c_api/mvncGetDeviceName.html
new file mode 100644 (file)
index 0000000..2f3439c
--- /dev/null
@@ -0,0 +1,149 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncgetdevicename">mvncGetDeviceName()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncOpenDevice.html">mvncOpenDevice</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to get the name of a particular Intel® Movidius™ NCS device. Typical usage is to call the function repeatedly, starting with index = 0, and incrementing the index each time until an error is returned. These successive calls will give you the names of all the devices in the system.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncGetDeviceName</span><span class="p">(</span><span class="kt">int</span> <span class="n">index</span><span class="p">,</span> <span class="kt">char</span><span class="o">*</span> <span class="n">name</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">nameSize</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>index</td>
+      <td>int</td>
+      <td>Index of the device for which the name should be retrieved.</td>
+    </tr>
+    <tr>
+      <td>name</td>
+      <td>char*</td>
+      <td>Pointer to a character buffer into which the name will be copied. This buffer should be allocated by the caller.</td>
+    </tr>
+    <tr>
+      <td>nameSize</td>
+      <td>unsigned int</td>
+      <td>The number of characters allocated to the buffer pointed to by the name parameter.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<p>The following example shows how to get the name of all Intel® Movidius™ NCS devices attached to the system. mvncGetDeviceName is called repeatedly until it returns MVNC_DEVICE_NOT_FOUND.</p>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+</span><span class="k">extern</span> <span class="s">"C"</span> 
+<span class="p">{</span>
+<span class="cp">#include &lt;mvnc.h&gt;
+</span><span class="p">}</span>
+<span class="c1">// somewhat arbitrary buffer size for the device name</span>
+<span class="cp">#define NAME_SIZE 100
+</span><span class="kt">int</span> <span class="n">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">mvncStatus</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="kt">int</span> <span class="n">deviceCount</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">char</span> <span class="n">devName</span><span class="p">[</span><span class="n">NAME_SIZE</span><span class="p">];</span>
+<span class="err">   </span> <span class="k">while</span> <span class="p">((</span><span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncGetDeviceName</span><span class="p">(</span><span class="n">deviceCount</span><span class="p">,</span> <span class="n">devName</span><span class="p">,</span> <span class="n">NAME_SIZE</span><span class="p">))</span> <span class="o">!=</span> <span class="n">MVNC_DEVICE_NOT_FOUND</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Found NCS device named: </span><span class="se">\"</span><span class="s">%s</span><span class="se">\"\n</span><span class="s">"</span><span class="p">,</span> <span class="n">devName</span><span class="p">);</span><span class="err"> </span>
+        <span class="n">deviceCount</span><span class="o">++</span><span class="p">;</span>
+    <span class="p">}</span>
+    <span class="n">printf</span><span class="p">(</span><span class="s">"Total number of NCS devices found: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">deviceCount</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+<p>Output from the example code above with two Intel® Movidius™ NCS devices in the system.</p>
+
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Found NCS device named: "2.3"
+Found NCS device named: "1"
+Total number of NCS devices found: 2
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncGetDeviceOption.html b/docs/ncapi/ncapi1/c_api/mvncGetDeviceOption.html
new file mode 100644 (file)
index 0000000..90db78b
--- /dev/null
@@ -0,0 +1,128 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncgetdeviceoption">mvncGetDeviceOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncOpenDevice.html">mvncOpenDevice</a>, <a href="mvncDeviceOptions.html">mvncDeviceOptions</a>, <a href="mvncSetDeviceOption.html">mvncSetDeviceOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function gets the current value of an option for an Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) device. The available options and their data types can be found in the <a href="mvncDeviceOptions.html">DeviceOptions</a> enumeration documentation.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncGetDeviceOption</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="o">*</span><span class="n">datalength</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td>void*</td>
+      <td>Pointer to opaque device data type that was initialized with the mvncOpenDevice() function. This specifies which NCS device’s option will be retrieved.</td>
+    </tr>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the DeviceOptions enumeration that specifies which option will be retrieved.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>void*</td>
+      <td>For pointer option types, address of a pointer that will be set to point to a buffer containing the option value. For other types, pointer to a buffer where the value of the option will be copied. The type of data this points to will depend on the option that is specified. Check mvncDeviceOptions for the data types that each option requires.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int*</td>
+      <td>Pointer to an unsigned int which must point to the size, in bytes, of the buffer allocated to the data parameter when called. Upon successfull return, it will be set to the number of bytes copied to the data buffer.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">TBD</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncGetGlobalOption.html b/docs/ncapi/ncapi1/c_api/mvncGetGlobalOption.html
new file mode 100644 (file)
index 0000000..6b03bb7
--- /dev/null
@@ -0,0 +1,126 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncgetglobaloption">mvncGetGlobalOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.09</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncGlobalOptions.html">mvncGlobalOptions</a>, <a href="mvncSetGlobalOption.html">mvncSetGlobalOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function gets the current value of an option that is global to the SDK. The available options and their data types can be found in the <a href="mvncGlobalOptions.html">mvncGlobalOptions</a> enumeration documentation.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncGetGlobalOption</span><span class="p">(</span><span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="o">*</span><span class="n">datalength</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the GlobalOptions enumeration that specifies which option will be retrieved.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>void*</td>
+      <td>For pointer option types, address of a pointer that will be set to point to a buffer containing the option value. For other types, pointer to a buffer where the value of the option will be copied. The type of data this points to will depend on the option that is specified. Check mvncGlobalOptions for the data types that each option requires.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int*</td>
+      <td>Pointer to an unsigned int which must point to the size, in bytes, of the buffer allocated to the data parameter when called. Upon successfull return, it will be set to the number of bytes copied to the data buffer.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">int</span> <span class="n">len</span><span class="p">;</span>
+<span class="kt">int</span> <span class="n">loggingLevel</span><span class="p">;</span>
+<span class="n">status</span> <span class="o">=</span> <span class="n">mvncGetGlobalOption</span><span class="p">(</span><span class="n">MVNC_LOGLEVEL</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">loggingLevel</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">len</span><span class="p">);</span>
+<span class="c1">// loggingLevel has the option value now.</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncGetGraphOption.html b/docs/ncapi/ncapi1/c_api/mvncGetGraphOption.html
new file mode 100644 (file)
index 0000000..49f5c6b
--- /dev/null
@@ -0,0 +1,153 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncgetgraphoption">mvncGetGraphOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncAllocateGraph.html">mvncAllocateGraph</a>, <a href="mvncGraphOptions.html">mvncGraphOptions</a>, <a href="mvncSetGraphOption.html">mvncSetGraphOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function gets the current value of an option for a graph. The available options can be found in the GraphOptions enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncGetGraphOption</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">graphHandle</span><span class="p">,</span> <span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="o">*</span><span class="n">datalength</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphHandle</td>
+      <td>void*</td>
+      <td>Pointer to opaque graph data type that was initialized with the mvncAllocateGraph() function, which represents the neural network. This specifies which graph’s option value will be retrieved.</td>
+    </tr>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the GraphOptions enumeration that specifies which option will be retrieved.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>void*</td>
+      <td>For pointer option types, address of a pointer that will be set to point to a buffer containing the option value. For other types, pointer to a buffer where the value of the option will be copied. The type of data this points to will depend on the option that is specified. Check mvncGraphOptions for the data types that each option requires.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int*</td>
+      <td>Pointer to an unsigned int, which must point to the size, in bytes, of the buffer allocated to the data parameter when called. Upon successfull return, it will be set to the number of bytes copied to the data buffer.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">.</span>
+<span class="p">.</span>
+<span class="p">.</span>
+    <span class="c1">// Open device to get device handle, </span>
+    <span class="c1">// allocate the graph to get graph handle.</span>
+
+    <span class="c1">// Set the graph option for blocking calls</span>
+    <span class="kt">int</span> <span class="n">dontBlockValue</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">sizeOfValue</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncGetGraphOption</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">MVNC_DONTBLOCK</span><span class="p">,</span> <span class="p">(</span><span class="kt">void</span><span class="o">**</span><span class="p">)(</span><span class="o">&amp;</span><span class="n">dontBlockValue</span><span class="p">),</span> <span class="o">&amp;</span><span class="n">sizeOfValue</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">==</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully got graph option, value is: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">dontBlockValue</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Could not get graph option</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error returned from mvncGetGraphOption: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="c1">// Use graph, deallocate graph, close device, etc.</span>
+    
+    <span class="p">.</span>
+    <span class="p">.</span>
+    <span class="p">.</span>
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncGetResult.html b/docs/ncapi/ncapi1/c_api/mvncGetResult.html
new file mode 100644 (file)
index 0000000..a80a1b9
--- /dev/null
@@ -0,0 +1,197 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncgetresult">mvncGetResult()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncOpenDevice.html">mvncOpenDevice</a>, <a href="mvncAllocateGraph.html">mvncAllocateGraph</a>, <a href="mvncLoadTensor.html">mvncLoadTensor</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function retrieves the result of an inference that was initiated via LoadTensor() on the specified graph.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncGetResult</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">graphHandle</span><span class="p">,</span> <span class="kt">void</span> <span class="o">**</span><span class="n">outputData</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="o">*</span><span class="n">outputDataLength</span><span class="p">,</span> <span class="kt">void</span> <span class="o">**</span><span class="n">userParam</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphHandle</td>
+      <td>void*</td>
+      <td>Pointer to opaque graph data type that was initialized with the mvncAllocateGraph() function that represents the neural network for which an inference was initiated.</td>
+    </tr>
+    <tr>
+      <td>outputData</td>
+      <td>void**</td>
+      <td>Address of the pointer that will be set to a buffer of 16-bit floats, which contain the result of the inference. The buffer will contain one 16-bit float for each network category, the values of which are the results of the output node. Typically these values are the probabilities that an image belongs to the category.</td>
+    </tr>
+    <tr>
+      <td>outputDataLength</td>
+      <td>unsigned int*</td>
+      <td>Pointer to an unsigned int that will be set to the number of bytes in the outputData buffer.</td>
+    </tr>
+    <tr>
+      <td>userParam</td>
+      <td>void**</td>
+      <td>Address of a pointer that will be set to the user parameter for this inference. This corresponds to the userParam that was passed to the LoadTensor() function, which initiated the inference.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">.</span>
+<span class="p">.</span>
+<span class="p">.</span>
+
+<span class="c1">// Use a 16-bit unsigned type to represent half precision floats since C++ has no </span>
+<span class="c1">// built-in support for 16-bit floats.</span>
+<span class="k">typedef</span> <span class="kt">unsigned</span> <span class="kt">short</span> <span class="n">half</span><span class="p">;</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+<span class="p">.</span>
+<span class="p">.</span>
+<span class="p">.</span>
+    <span class="c1">//</span>
+    <span class="c1">// Open NCS device and set deviceHandle to the valid handle.</span>
+    <span class="c1">//</span>
+    
+    <span class="c1">//</span>
+    <span class="c1">// Read graph from disk and call mvncAllocateGraph to set graphHandle appropriately.</span>
+    <span class="c1">//</span>
+
+    <span class="c1">//</span>
+    <span class="c1">// Load an image.png from disk and preprocess it to match network </span>
+    <span class="c1">// requirements so that imageBufFp16 list to 16-bit floats.</span>
+    <span class="c1">//</span>
+    
+    <span class="c1">// Start the inference with call to mvncLoadTensor().</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncLoadTensor</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">imageBufFp16</span><span class="p">,</span> <span class="n">lenBufFp16</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">==</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// The inference has been started, now call mvncGetResult() for the</span>
+        <span class="c1">// inference result. </span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully loaded the tensor for image %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="s">"image.png"</span><span class="p">);</span>
+            
+        <span class="kt">void</span><span class="o">*</span> <span class="n">resultData16</span><span class="p">;</span>
+        <span class="kt">void</span><span class="o">*</span> <span class="n">userParam</span><span class="p">;</span>
+        <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">lenResultData</span><span class="p">;</span>
+        <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncGetResult</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">resultData16</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">lenResultData</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">userParam</span><span class="p">);</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">==</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+        <span class="p">{</span>   <span class="c1">// Successfully got the result. The inference result is in the buffer pointed to by resultData.</span>
+            <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully got the inference result for image %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">IMAGE_FILE_NAME</span><span class="p">);</span>
+            <span class="n">printf</span><span class="p">(</span><span class="s">"resultData is %d bytes which is %d 16-bit floats.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">lenResultData</span><span class="p">,</span> <span class="n">lenResultData</span><span class="o">/</span><span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="k">sizeof</span><span class="p">(</span><span class="n">half</span><span class="p">));</span>
+                
+            <span class="c1">// convert half precision floats to full floats</span>
+            <span class="kt">int</span> <span class="n">numResults</span> <span class="o">=</span> <span class="n">lenResultData</span> <span class="o">/</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">half</span><span class="p">);</span>
+            <span class="kt">float</span><span class="o">*</span> <span class="n">resultData32</span><span class="p">;</span>
+            <span class="n">resultData32</span> <span class="o">=</span> <span class="p">(</span><span class="kt">float</span><span class="o">*</span><span class="p">)</span><span class="n">malloc</span><span class="p">(</span><span class="n">numResults</span> <span class="o">*</span> <span class="k">sizeof</span><span class="p">(</span><span class="o">*</span><span class="n">resultData32</span><span class="p">));</span>
+            <span class="n">fp16tofloat</span><span class="p">(</span><span class="n">resultData32</span><span class="p">,</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="kt">char</span><span class="o">*</span><span class="p">)</span><span class="n">resultData16</span><span class="p">,</span> <span class="n">numResults</span><span class="p">);</span>
+
+            <span class="kt">float</span> <span class="n">maxResult</span> <span class="o">=</span> <span class="mi">0</span><span class="p">.</span><span class="mi">0</span><span class="p">;</span>
+            <span class="kt">int</span> <span class="n">maxIndex</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
+            <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">index</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">index</span> <span class="o">&lt;</span> <span class="n">numResults</span><span class="p">;</span> <span class="n">index</span><span class="o">++</span><span class="p">)</span>
+            <span class="p">{</span>
+                <span class="n">printf</span><span class="p">(</span><span class="s">"Category %d is: %f</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">index</span><span class="p">,</span> <span class="n">resultData32</span><span class="p">[</span><span class="n">index</span><span class="p">]);</span>
+                <span class="k">if</span> <span class="p">(</span><span class="n">resultData32</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> <span class="o">&gt;</span> <span class="n">maxResult</span><span class="p">)</span>
+                <span class="p">{</span>
+                    <span class="n">maxResult</span> <span class="o">=</span> <span class="n">resultData32</span><span class="p">[</span><span class="n">index</span><span class="p">];</span>
+                    <span class="n">maxIndex</span> <span class="o">=</span> <span class="n">index</span><span class="p">;</span>
+                <span class="p">}</span>
+            <span class="p">}</span>
+            <span class="n">printf</span><span class="p">(</span><span class="s">"index of top result is: %d - probability of top result is: %f</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">maxIndex</span><span class="p">,</span> <span class="n">resultData32</span><span class="p">[</span><span class="n">maxIndex</span><span class="p">]);</span>
+            <span class="n">free</span><span class="p">(</span><span class="n">resultData32</span><span class="p">);</span>
+        <span class="p">}</span> 
+    <span class="p">}</span>
+
+    <span class="c1">// </span>
+    <span class="c1">// Call mvncDeallocateGraph to free the resources tied to graphHandle.</span>
+    <span class="c1">// Close the device with mvncCloseDevice().</span>
+    <span class="c1">// </span>
+<span class="p">}</span>
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncGlobalOptions.html b/docs/ncapi/ncapi1/c_api/mvncGlobalOptions.html
new file mode 100644 (file)
index 0000000..377095c
--- /dev/null
@@ -0,0 +1,95 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncglobaloptions-enumeration">mvncGlobalOptions enumeration</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value/s</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.09</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncGetGlobalOption.html">mvncGetGlobalOption</a>, <a href="mvncSetGlobalOption.html">mvncSetGlobalOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This enumeration is used to specify a global option that can be written or read via mvncGetGlobalOption() and mvncSetGlobalOption().  The table below provides details on the meaning of each of the values in the enumeration.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Get/Set</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>MVNC_LOGLEVEL</td>
+      <td>int</td>
+      <td>0, 1, 2</td>
+      <td>get, set</td>
+      <td>The logging level for application  Value meanings are: <br />0: log nothing (default)<br />1: log errors only<br />2: log all, verbose logging.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncGraphOptions.html b/docs/ncapi/ncapi1/c_api/mvncGraphOptions.html
new file mode 100644 (file)
index 0000000..2bdfd70
--- /dev/null
@@ -0,0 +1,109 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncgraphoptions-enumeration">mvncGraphOptions enumeration</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value/s</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncGetGraphOption.html">mvncGetGraphOption</a>, <a href="mvncSetGraphOption.html">mvncSetGraphOption</a>, <a href="mvncAllocateGraph.html">mvncAllocateGraph</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This enumeration is used to specify an option on the graph that can be written or read via mvncGetGraphOption() and mvncSetGraphOption(). The table below provides details on the meaning of each of the values in the enumeration.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Get/Set</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>MVNC_DONT_BLOCK</td>
+      <td>int</td>
+      <td>0, 1</td>
+      <td>get, set</td>
+      <td>0: Calls to mvncLoadTensor and mvncGetResult will block (won’t return until the action is completed) (Default)<br />1: Calls to those functions don’t block (they will return immediately).  If the action coudn’t be completed the return value will indicate why.  mvncLoadTensor() will return MVNC_BUSY when the NCS isn’t able to perform the action because its busy, try again later.  mvncGetResult() will return MVNC_NO_DATA unless there is an inference that is ready to be returned.  In this case try again later and when there is a completed inference the results will be returned.</td>
+    </tr>
+    <tr>
+      <td>MVNC_TIME_TAKEN</td>
+      <td>float*</td>
+      <td>any</td>
+      <td>get</td>
+      <td>An array containing inference time per graph layer for the last inference returned by mvncGetResult.</td>
+    </tr>
+    <tr>
+      <td>MVNC_DEBUG_INFO</td>
+      <td>char*</td>
+      <td>any</td>
+      <td>get</td>
+      <td>A string that provides more details when the result of a function call was MVNC_MYRIADERROR.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncLoadTensor.html b/docs/ncapi/ncapi1/c_api/mvncLoadTensor.html
new file mode 100644 (file)
index 0000000..2ee4989
--- /dev/null
@@ -0,0 +1,182 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncloadtensor">mvncLoadTensor()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncOpenDevice.html">mvncOpenDevice</a>, <a href="mvncAllocateGraph.html">mvncAllocateGraph</a>, <a href="mvncGetResult.html">mvncGetResult</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function initiates an inference on the specified graph via the associated Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) device. After calling this function, use the mvncGetResult() function to retrieve the inference result.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncLoadTensor</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">graphHandle</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">inputTensor</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">inputTensorLength</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">userParam</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphHandle</td>
+      <td>void*</td>
+      <td>Pointer to opaque graph data type that was initialized with the mvncAllocateGraph() function that represents the neural network for which an inference will be initiated.</td>
+    </tr>
+    <tr>
+      <td>inputTensor</td>
+      <td>const void*</td>
+      <td>Pointer to tensor data buffer, which contains 16-bit half precision floats (per IEEE 754 half precision binary floating-point format: binary16). The values in the buffer are dependent on the neural network (graph), but are typically representations of each color channel of each pixel of an image.</td>
+    </tr>
+    <tr>
+      <td>inputTensorLength</td>
+      <td>unsigned int</td>
+      <td>The length, in bytes, of the buffer pointed to by the inputTensor parameter.</td>
+    </tr>
+    <tr>
+      <td>userParam</td>
+      <td>void*</td>
+      <td>Pointer to user data that will be returned along with the inference result from the GetResult() function.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">.</span>
+<span class="p">.</span>
+<span class="p">.</span>
+
+<span class="c1">// Use a 16-bit unsigned type to represent half precision floats, since C++ has no </span>
+<span class="c1">// built-in support for 16-bit floats.</span>
+<span class="k">typedef</span> <span class="kt">unsigned</span> <span class="kt">short</span> <span class="n">half</span><span class="p">;</span>
+
+<span class="c1">// GoogleNet image dimensions and network mean values for each channel. This information is specific </span>
+<span class="c1">// for each network, and usually available from network creators.</span>
+<span class="k">const</span> <span class="kt">int</span> <span class="n">networkDim</span> <span class="o">=</span> <span class="mi">224</span><span class="p">;</span>
+<span class="kt">float</span> <span class="n">networkMean</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span><span class="mi">0</span><span class="p">.</span><span class="mi">40787054</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">.</span><span class="mi">45752458</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">.</span><span class="mi">48109378</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">};</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+<span class="p">.</span>
+<span class="p">.</span>
+<span class="p">.</span>
+    <span class="c1">//</span>
+    <span class="c1">// Open NCS device and set deviceHandle to the valid handle.</span>
+    <span class="c1">//</span>
+    
+    <span class="c1">//</span>
+    <span class="c1">// Read graph from disk and call mvncAllocateGraph to set graphHandle appropriately.</span>
+    <span class="c1">//</span>
+
+    <span class="c1">//</span>
+    <span class="c1">// Load an image from disk.</span>
+    <span class="c1">// LoadImage will read image from disk, convert channels to floats.</span>
+    <span class="c1">// Subtract network mean for each value in each channel. Then convert</span>
+    <span class="c1">// floats to half precision floats.</span>
+    <span class="c1">// Return pointer to the buffer of half precision floats. </span>
+    <span class="n">half</span><span class="o">*</span> <span class="n">imageBufFp16</span> <span class="o">=</span> <span class="n">LoadImage</span><span class="p">(</span><span class="s">"image.png"</span><span class="p">,</span> <span class="n">networkDim</span><span class="p">,</span> <span class="n">networkMean</span><span class="p">);</span>
+        
+    <span class="c1">// Calculate the length of the buffer that contains the half precision floats.</span>
+    <span class="c1">// 3 channels * width * height * sizeof a 16-bit float </span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">lenBufFp16</span> <span class="o">=</span> <span class="mi">3</span><span class="o">*</span><span class="n">networkDim</span><span class="o">*</span><span class="n">networkDim</span><span class="o">*</span><span class="k">sizeof</span><span class="p">(</span><span class="o">*</span><span class="n">imageBufFp16</span><span class="p">);</span>
+
+    <span class="c1">// Start the inference with mvncLoadTensor()</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncLoadTensor</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">imageBufFp16</span><span class="p">,</span> <span class="n">lenBufFp16</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">==</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// The inference has been started, now call mvncGetResult() for the</span>
+        <span class="c1">// inference result. </span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully loaded the tensor for image %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="s">"image.png"</span><span class="p">);</span>
+     
+        <span class="c1">// Here mvncGetResult() can be called to get the result of the inference</span>
+        <span class="c1">// that was started with mvncLoadTensor() above.</span>
+    <span class="p">}</span>
+
+    <span class="c1">// </span>
+    <span class="c1">// Call mvncDeallocateGraph to free the resources tied to graphHandle.</span>
+    <span class="c1">// Close the device with mvncCloseDevice().</span>
+    <span class="c1">// </span>
+<span class="p">}</span>
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncOpenDevice.html b/docs/ncapi/ncapi1/c_api/mvncOpenDevice.html
new file mode 100644 (file)
index 0000000..7deaab4
--- /dev/null
@@ -0,0 +1,155 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncopendevice">mvncOpenDevice()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncCloseDevice.html">mvncCloseDevice</a>, <a href="mvncGetDeviceName.html">mvncGetDeviceName</a> <a href="mvncGetDeviceOption.html">mvncGetDeviceOption</a>, <a href="mvncSetDeviceOption.html">mvncSetDeviceOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to initialize the Intel® Movidius™ NCS device and return a device handle that can be passed to other API functions.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncOpenDevice</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="kt">void</span> <span class="o">**</span><span class="n">deviceHandle</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>name</td>
+      <td>const char*</td>
+      <td>Pointer to a constant array of chars that contains the name of the device to open. This value is obtained from mvncGetDeviceName.</td>
+    </tr>
+    <tr>
+      <td>deviceHandle</td>
+      <td>void**</td>
+      <td>Address of a pointer that will be set to point to an opaque structure representing an NCS device.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<p>In the example below, the code gets the name of the first device and then calls mvncOpenDevice to open the device and set the deviceHandle variable for use to other API calls that expect a device handle for an open device.</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+</span>
+<span class="k">extern</span> <span class="s">"C"</span> 
+<span class="p">{</span>
+<span class="cp">#include &lt;mvnc.h&gt;
+</span><span class="p">}</span>
+<span class="c1">// Somewhat arbitrary buffer size for the device name.</span>
+<span class="cp">#define NAME_SIZE 100
+</span><span class="kt">int</span> <span class="n">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">mvncStatus</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="kt">void</span> <span class="o">*</span><span class="n">deviceHandle</span><span class="p">;</span>
+    <span class="kt">char</span> <span class="n">devName</span><span class="p">[</span><span class="n">NAME_SIZE</span><span class="p">];</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncGetDeviceName</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">devName</span><span class="p">,</span> <span class="n">NAME_SIZE</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// If failed to get device name, may be none plugged in.</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"No NCS devices found</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    
+    <span class="c1">// Try to open the NCS device via the device name.</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncOpenDevice</span><span class="p">(</span><span class="n">devName</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Failed to open the device.  </span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Could not open NCS device</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    
+    <span class="c1">// deviceHandle is ready to use now.  </span>
+    <span class="c1">// Pass it to other NC API calls as needed, and close it when finished.</span>
+    <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully opened NCS device!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+    
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncCloseDevice</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+<span class="p">}</span>
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncSetDeviceOption.html b/docs/ncapi/ncapi1/c_api/mvncSetDeviceOption.html
new file mode 100644 (file)
index 0000000..9d25a38
--- /dev/null
@@ -0,0 +1,128 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncsetdeviceoption">mvncSetDeviceOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncOpenDevice.html">mvncOpenDevice</a>, <a href="mvncDeviceOptions.html">mvncDeviceOptions</a>, <a href="mvncGetDeviceOption.html">mvncGetDeviceOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function sets an option for a specific Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) device. The available options can be found in the <a href="mvncDeviceOptions.html">DeviceOptions</a> enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncSetDeviceOption</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">datalength</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td>void*</td>
+      <td>Pointer to opaque device data type that was initialized with the mvncOpenDevice() function. This specifies which device’s option will be set.</td>
+    </tr>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the DeviceOptions enumeration that specifies which option will be set.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>const void*</td>
+      <td>Pointer to the data for the new value for the option. The type of data this points to depends on the option that is being set. Check mvncDeviceOptions for the data types that each option requires.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int</td>
+      <td>An unsigned int that contains the length, in bytes, of the buffer that the data parameter points to.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">TBD</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncSetGlobalOption.html b/docs/ncapi/ncapi1/c_api/mvncSetGlobalOption.html
new file mode 100644 (file)
index 0000000..724b672
--- /dev/null
@@ -0,0 +1,125 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncsetglobaloption">mvncSetGlobalOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.09</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncGlobalOptions.html">mvncGlobalOptions</a>, <a href="mvncGetGlobalOption.html">mvncGetGlobalOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function sets an option that is global for an application using the SDK.  The available options can be found in the <a href="mvncGlobalOptions.html">mvncGlobalOptions</a> enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncSetGlobalOption</span><span class="p">(</span><span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">datalength</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the mvncGlobalOptions enumeration that specifies which option will be set.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>const void*</td>
+      <td>Pointer to the data for the new value for the option.  The type of data this points to depends on the option that is being set.  Check mvncGlobalOptions for the data types that each option requires.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int</td>
+      <td>An unsigned int that contains the length, in bytes, of the buffer that the data parameter points to.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">int</span> <span class="n">logLevel</span> <span class="o">=</span> <span class="mi">3</span><span class="p">;</span>
+<span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncSetGlobalOption</span><span class="p">(</span><span class="n">MVNC_LOGLEVEL</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">logLevel</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">int</span><span class="p">));</span>
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncSetGraphOption.html b/docs/ncapi/ncapi1/c_api/mvncSetGraphOption.html
new file mode 100644 (file)
index 0000000..5629881
--- /dev/null
@@ -0,0 +1,165 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncsetgraphoption">mvncSetGraphOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Return</td>
+      <td><a href="mvncStatus.html">mvncStatus</a></td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="mvncAllocateGraph.html">mvncAllocateGraph</a>, <a href="mvncGraphOptions.html">mvncGraphOptions</a>, <a href="mvncGetGraphOption.html">mvncGetGraphOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function sets an option of a graph.  The available options can be found in the GraphOptions enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncStatus</span> <span class="n">mvncSetGraphOption</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">graphHandle</span><span class="p">,</span> <span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">datalength</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphHandle</td>
+      <td>void*</td>
+      <td>Pointer to opaque graph data type that was initialized with the mvncAllocateGraph() function that represents the neural network.  This specifies which graph’s option will be set.</td>
+    </tr>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the GraphOptions enumeration that specifies which option will be set.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>const void*</td>
+      <td>Pointer to the data for the new value for the option.  The type of data this points to depends on the option that is being set.  Check mvncGraphOptions for the data types that each option requires.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int</td>
+      <td>An unsigned int that contains the length, in bytes, of the buffer that the data parameter points to.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>This function returns an appropriate value from the <a href="mvncStatus.html">mvncStatus</a> enumeration.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">.</span>
+<span class="p">.</span>
+<span class="p">.</span>
+    <span class="c1">// Open NCS device to initialize deviceHandle.</span>
+    <span class="c1">// Read compiled graph file into graphFileBuf and put length of it in graphFileLen</span>
+
+    <span class="c1">// Allocate the graph</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncAllocateGraph</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">graphFileBuf</span><span class="p">,</span> <span class="n">graphFileLen</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Error allocating graph</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Could not allocate graph for file: %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">GRAPH_FILE_NAME</span><span class="p">);</span> 
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>   <span class="c1">// Successfully allocated graph. Now graphHandle is ready to go.  </span>
+        <span class="c1">// Use graphHandle for other API calls and call mvncDeallocateGraph</span>
+        <span class="c1">// when done with it.</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully allocated graph for %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">GRAPH_FILE_NAME</span><span class="p">);</span>
+        
+        <span class="c1">// Set the graph option for blocking calls</span>
+        <span class="kt">int</span> <span class="n">dontBlockValue</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+        <span class="n">retCode</span> <span class="o">=</span> <span class="n">mvncSetGraphOption</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">MVNC_DONTBLOCK</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dontBlockValue</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">int</span><span class="p">));</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">==</span> <span class="n">MVNC_OK</span><span class="p">)</span>
+        <span class="p">{</span>
+            <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully set graph option</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+        <span class="p">}</span>
+        <span class="k">else</span>
+        <span class="p">{</span>
+            <span class="n">printf</span><span class="p">(</span><span class="s">"Could not set graph option</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+            <span class="n">printf</span><span class="p">(</span><span class="s">"Error returned from mvncSetGraphOption: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="p">}</span>
+
+        <span class="c1">// Use graphHandle here with the option set above.</span>
+        <span class="c1">// Then deallocate the graph and close the device.</span>
+    <span class="p">}</span>
+<span class="p">.</span>
+<span class="p">.</span>
+<span class="p">.</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/mvncStatus.html b/docs/ncapi/ncapi1/c_api/mvncStatus.html
new file mode 100644 (file)
index 0000000..95acf46
--- /dev/null
@@ -0,0 +1,132 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncstatus-enumeration">mvncStatus enumeration</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value/s</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td> </td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>A value from this enumeration is returned from most of the C API functions.  The table below provides details on the meaning of each of the values in the enumeration.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>constant</th>
+      <th>description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>MVNC_OK</td>
+      <td>The function call worked as expected.</td>
+    </tr>
+    <tr>
+      <td>MVNC_BUSY</td>
+      <td>The device is busy, retry later.</td>
+    </tr>
+    <tr>
+      <td>MVNC_ERROR</td>
+      <td>An unexpected error was encountered during the function call.</td>
+    </tr>
+    <tr>
+      <td>MVNC_OUT_OF_MEMORY</td>
+      <td>The host is out of memory.</td>
+    </tr>
+    <tr>
+      <td>MVNC_DEVICE_NOT_FOUND</td>
+      <td>There is no device at the given index or name.</td>
+    </tr>
+    <tr>
+      <td>MVNC_INVALID_PARAMETERS</td>
+      <td>At least one of the given parameters is invalid in the context of the function call.</td>
+    </tr>
+    <tr>
+      <td>MVNC_TIMEOUT</td>
+      <td>Timeout in the communication with the device.</td>
+    </tr>
+    <tr>
+      <td>MVNC_MVCMD_NOT_FOUND</td>
+      <td>The file named MvNCAPI.mvcmd should be installed in the mvnc directory. This message may mean that the installation failed.</td>
+    </tr>
+    <tr>
+      <td>MVNC_NO_DATA</td>
+      <td>No data to return.</td>
+    </tr>
+    <tr>
+      <td>MVNC_GONE</td>
+      <td>The graph or device has been closed during the operation.</td>
+    </tr>
+    <tr>
+      <td>MVNC_UNSUPPORTED_GRAPH_FILE</td>
+      <td>The graph file may have been created with an incompatible prior version of the Toolkit. Try to recompile the graph file with the version of the Toolkit that corresponds to the API version.</td>
+    </tr>
+    <tr>
+      <td>MVNC_MYRIAD_ERROR</td>
+      <td>An error has been reported by Intel® Movidius™ VPU. Use MVNC_DEBUGINFO to get more information.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/c_api/readme.html b/docs/ncapi/ncapi1/c_api/readme.html
new file mode 100644 (file)
index 0000000..2b7110c
--- /dev/null
@@ -0,0 +1,75 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="intel-movidius-neural-compute-sdk-c-api">Intel® Movidius™ Neural Compute SDK C API</h1>
+
+<p>The SDK comes with a C language API that enables developers to create applications in C or C++ that utilize hardware-accelerated Deep Neural Networks via the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS). The C API is provided as a header file (mvnc.h) and an associated library file (libmvnc.so), both of which are placed on the development computer when the SDK is installed. Details of the C API are provided below and within the documentation avilable via the link in each line.</p>
+
+<h2 id="enumerations">Enumerations</h2>
+<ul>
+  <li><a href="mvncStatus.html">mvncStatus</a>: Contains possible return values for API functions.</li>
+  <li><a href="mvncDeviceOptions.html">mvncDeviceOptions</a>: Contains all possible options to get/set for an Intel® Movidius™ NCS device, and their data types.</li>
+  <li><a href="mvncGraphOptions.html">mvncGraphOptions</a>: Contains all possible options to get/set for a graph, and their data types.</li>
+  <li><a href="mvncGlobalOptions.html">mvncGlobalOptions</a>: Contains all possible global options to get/set, and their data types.</li>
+</ul>
+
+<h2 id="functions">Functions</h2>
+<ul>
+  <li><a href="mvncGetDeviceName.html">mvncGetDeviceName</a>: Retrieves the name of an Intel® Movidius™ NCS device that can be opened.</li>
+  <li><a href="mvncOpenDevice.html">mvncOpenDevice</a>: Opens an Intel® Movidius™ NCS device for use by the application.</li>
+  <li><a href="mvncAllocateGraph.html">mvncAllocateGraph</a>: Allocates a graph for a specific Intel® Movidius™ NCS device in preparation for computing inferences.</li>
+  <li><a href="mvncDeallocateGraph.html">mvncDeallocateGraph</a>: Deallocates and frees resouces associated with a graph.</li>
+  <li><a href="mvncLoadTensor.html">mvncLoadTensor</a>: Initiates an inference by providing input to the neural network.</li>
+  <li><a href="mvncGetResult.html">mvncGetResult</a>: Retrieves the result of an inference that was previously initiated.</li>
+  <li><a href="mvncSetGraphOption.html">mvncSetGraphOption</a>: Sets an option for a graph.</li>
+  <li><a href="mvncGetGraphOption.html">mvncGetGraphOption</a>: Retrieves the current value of an option for a graph.</li>
+  <li><a href="mvncSetDeviceOption.html">mvncSetDeviceOption</a>: Sets an option for an Intel® Movidius™ NCS device.</li>
+  <li><a href="mvncGetDeviceOption.html">mvncGetDeviceOption</a>: Retrieves the current value of an option for an Intel® Movidius™ NCS device.</li>
+  <li><a href="mvncSetGlobalOption.html">mvncSetGlobalOption</a>: Sets a global option for an application.</li>
+  <li><a href="mvncGetGlobalOption.html">mvncGetGlobalOption</a>: Retrieves the current value of a global option for an application.</li>
+  <li><a href="mvncCloseDevice.html">mvncCloseDevice</a>: Closes a previously opened Intel® Movidius™ NCS device.</li>
+</ul>
+
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Device.AllocateGraph.html b/docs/ncapi/ncapi1/py_api/Device.AllocateGraph.html
new file mode 100644 (file)
index 0000000..32e4f26
--- /dev/null
@@ -0,0 +1,126 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="deviceallocategraph">Device.AllocateGraph()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.html">Graph</a><br /><a href="Graph.DeallocateGraph.html">Graph.DeallocateGraph()</a><br /></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to create an instance of a Graph that represents a neural network, which can be used to infer results via methods Graph.LoadTensor() and Graph.GetResult().</p>
+
+<h2 id="syntax">Syntax</h2>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">dev</span><span class="o">.</span><span class="n">AllocateGraph</span><span class="p">(</span><span class="n">graphPath</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphPath</td>
+      <td>A string that is the path to the graph file. The graph file must have been created with the NC SDK graph compiler.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>Returns an instance of a Graph object that is ready to use.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+<p>After the Graph that is created is no longer needed, Graph.DeallocateGraph() must be called to free the graph resources.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
+<span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span> <span class="k">as</span> <span class="n">ncs</span>
+<span class="c"># Enumerate Devices</span>
+<span class="n">device_List</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">Enumerate</span><span class="p">()</span>
+
+<span class="c"># Initialize and open the first device</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_List</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+<span class="n">device</span><span class="o">.</span><span class="n">OpenDevice</span><span class="p">()</span>
+
+<span class="c"># Allocate a graph on the device by specifying the path to a graph file </span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">device</span><span class="o">.</span><span class="n">AllocateGraph</span><span class="p">(</span><span class="s">"../networks/myNetwork/graph"</span><span class="p">)</span>
+
+<span class="c"># Use graph here</span>
+
+<span class="c"># Deallocate the graph to free resources</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">DeallocateGraph</span><span class="p">()</span>
+
+<span class="c">#close device</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Device.CloseDevice.html b/docs/ncapi/ncapi1/py_api/Device.CloseDevice.html
new file mode 100644 (file)
index 0000000..4173948
--- /dev/null
@@ -0,0 +1,105 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="deviceclosedevice">Device.CloseDevice()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.__init__.html">Device.__init__()</a> <br /><a href="Device.OpenDevice.html">Device.OpenDevice()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to cease communication and reset the device.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">dev</span><span class="o">.</span><span class="n">CloseDevice</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>None.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<pre><code class="language-Python"># Open and close the first NCS device
+import mvnc.mvncapi as ncs
+
+deviceNames = ncs.EnumerateDevices()
+firstDevice = ncs.Device(deviceNames[0])
+
+# Open the device
+firstDevice.OpenDevice()
+
+# Use device here
+
+# Close the device 
+firstDevice.CloseDevice()
+</code></pre>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Device.GetDeviceOption.html b/docs/ncapi/ncapi1/py_api/Device.GetDeviceOption.html
new file mode 100644 (file)
index 0000000..4c892fd
--- /dev/null
@@ -0,0 +1,113 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="devicegetdeviceoption">Device.GetDeviceOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.SetDeviceOption.html">Device.SetDeviceOption()</a> <br /><a href="DeviceOption.html">DeviceOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to get an option for the device. The options can be found in the <a href="DeviceOption.html">DeviceOption</a> enumeration table.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">GetDeviceOption</span><span class="p">(</span><span class="n">option</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>Member of the DeviceOption enumeration that specifies which option to get.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>The value for the specified device option. The type of the returned value depends on the option specified. See the <a href="DeviceOption.html">DeviceOption</a> enumeration for the type that will be returned for each option.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">mvnc.mvncapi</span> <span class="k">as</span> <span class="n">ncs</span>
+
+<span class="c"># Initialize and open device</span>
+
+<span class="c"># Get the device option THERMAL_THROTTLING_LEVEL</span>
+<span class="n">optionValue</span> <span class="o">=</span> <span class="n">device</span><span class="o">.</span><span class="n">GetDeviceOption</span><span class="p">(</span><span class="n">mvnc</span><span class="o">.</span><span class="n">DeviceOption</span><span class="o">.</span><span class="n">THERMAL_THROTTLING_LEVEL</span><span class="p">)</span>
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Device.OpenDevice.html b/docs/ncapi/ncapi1/py_api/Device.OpenDevice.html
new file mode 100644 (file)
index 0000000..75e5545
--- /dev/null
@@ -0,0 +1,118 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="deviceopendevice">Device.OpenDevice()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.__init__.html">Device.__init__()</a> <br /><a href="Device.CloseDevice.html">Device.CloseDevice()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to initialize the device.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">OpenDevice</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>None.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#############################################</span>
+<span class="c"># Open first device only</span>
+<span class="kn">import</span> <span class="nn">mvnc.mvncapi</span> <span class="k">as</span> <span class="n">ncs</span>
+<span class="n">deviceNames</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">EnumerateDevices</span><span class="p">()</span>
+<span class="n">firstDevice</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">deviceNames</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+<span class="n">firstDevice</span><span class="o">.</span><span class="n">OpenDevice</span><span class="p">()</span>
+<span class="c"># Use device</span>
+<span class="n">firstDevice</span><span class="o">.</span><span class="n">CloseDevice</span><span class="p">()</span>
+<span class="c">#############################################</span>
+
+
+<span class="c">#############################################</span>
+<span class="c"># Open all devices</span>
+<span class="kn">import</span> <span class="nn">mvnc.mvncapi</span> <span class="k">as</span> <span class="n">ncs</span>
+<span class="n">devices</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">EnumerateDevices</span><span class="p">()</span>
+<span class="n">devlist</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
+<span class="k">for</span> <span class="n">devnum</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">devices</span><span class="p">)):</span>
+    <span class="n">devlist</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ncs</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">devices</span><span class="p">[</span><span class="n">devnum</span><span class="p">]))</span>
+    <span class="n">devlist</span><span class="p">[</span><span class="n">devnum</span><span class="p">]</span><span class="o">.</span><span class="n">OpenDevice</span><span class="p">()</span>
+<span class="c">#</span>
+<span class="c"># Use devices in devlist</span>
+<span class="c">#</span>
+<span class="k">for</span> <span class="n">dev</span> <span class="ow">in</span> <span class="n">devList</span><span class="p">:</span>
+    <span class="n">dev</span><span class="o">.</span><span class="n">CloseDevice</span><span class="p">()</span>
+<span class="c">#############################################</span>
+    
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Device.SetDeviceOption.html b/docs/ncapi/ncapi1/py_api/Device.SetDeviceOption.html
new file mode 100644 (file)
index 0000000..caa0259
--- /dev/null
@@ -0,0 +1,112 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="devicesetdeviceoption">Device.SetDeviceOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.GetDeviceOption.html">Device.GetDeviceOption()</a> <br /><a href="DeviceOption.html">DeviceOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to set an option for the device. The options can be found in the <a href="DeviceOption.html">DeviceOption</a> enumeration class.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">SetDeviceOption</span><span class="p">(</span><span class="n">option</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>Member of the DeviceOption enumeration class that specifies which device option to set.</td>
+    </tr>
+    <tr>
+      <td>value</td>
+      <td>The new value to which the device option will be set. The type to pass for this parameter depends on which option is being set. See the <a href="DeviceOption.html">DeviceOption</a> enumeration class for the types that correspond to each option.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Device.__init__.html b/docs/ncapi/ncapi1/py_api/Device.__init__.html
new file mode 100644 (file)
index 0000000..49124d9
--- /dev/null
@@ -0,0 +1,117 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="device__init__">Device.__init__()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td> </td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to initialize a device object.</p>
+
+<h2 id="syntax">Syntax</h2>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvnc</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="s">"device name here"</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceName</td>
+      <td>The name of the device to initialize. This must come from calling mvncapi module function EnumerateDevices().</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">mvnc.mvncapi</span> <span class="k">as</span> <span class="n">ncs</span>
+
+<span class="c"># Enumerate devices</span>
+<span class="n">deviceNames</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">EnumerateDevices</span><span class="p">()</span>
+
+<span class="c"># Create and init a device instance</span>
+<span class="n">ncsDevice</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">deviceNames</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+<span class="c"># Open device, use device, close device</span>
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Device.html b/docs/ncapi/ncapi1/py_api/Device.html
new file mode 100644 (file)
index 0000000..c9d3a76
--- /dev/null
@@ -0,0 +1,62 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="device-class">Device Class</h1>
+
+<p>The Device class represents the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) device. Typically one instance of this class is created for each physical NCS device that is plugged into the system, so multiple instances may exist if you have multiple devices attached to your system.</p>
+
+<h2 id="usage">Usage</h2>
+<p>To use the Device class, you must create and initialize it by name. The valid names to use can be determined by calling the mvncapi module function EnumerateDevices(). Once you have successfully created an instance of this class, the typical usage is to call OpenDevice(), AllocateGraph(), use the graph, and CloseDevice().</p>
+
+<h2 id="device-methods">Device methods</h2>
+<ul>
+  <li><a href="Device.__init__.html">__init__</a></li>
+  <li><a href="Device.OpenDevice.html">OpenDevice</a></li>
+  <li><a href="Device.CloseDevice.html">CloseDevice</a></li>
+  <li><a href="Device.SetDeviceOption.html">SetDeviceOption</a></li>
+  <li><a href="Device.GetDeviceOption.html">GetDeviceOption</a></li>
+  <li><a href="Device.AllocateGraph.html">AllocateGraph</a></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/DeviceOption.html b/docs/ncapi/ncapi1/py_api/DeviceOption.html
new file mode 100644 (file)
index 0000000..f6b583b
--- /dev/null
@@ -0,0 +1,99 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="deviceoption-enumeration-class">DeviceOption Enumeration Class</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.SetDeviceOption.html">Device.SetDeviceOption()</a> <br /><a href="Device.GetDeviceOption.html">Device.GetDeviceOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>The DeviceOption class is an enumeration class that defines the options that are passed to and received from the SetDeviceOption and the GetDeviceOption functions.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>enum</th>
+      <th>option type</th>
+      <th>possible values</th>
+      <th>get/set</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>THERMAL_THROTTLING_LEVEL</td>
+      <td>int</td>
+      <td>1, 2</td>
+      <td>get</td>
+      <td>1: if lower guard temperature threshold of chip sensor is reached. This indicates short throttling time is in action between inferences to protect the device. <br />2: if upper guard temperature of chip sensor is reached. This indicates long throttling time is in action between inferences to protect the device.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/EnumerateDevices.html b/docs/ncapi/ncapi1/py_api/EnumerateDevices.html
new file mode 100644 (file)
index 0000000..aab816b
--- /dev/null
@@ -0,0 +1,107 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enumeratedevices">EnumerateDevices()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to get a list of the names of the devices present in the system. Each of the names returned can be used to create an instance of the Device class.</p>
+
+<h2 id="syntax">Syntax</h2>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">deviceNames</span> <span class="o">=</span> <span class="n">EnumerateDevices</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>An array of device names, each of which can be used to create a new instance of the Device class.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<pre><code class="language-Python">import mvnc.mvncapi as ncs
+deviceNames = ncs.EnumerateDevices()
+if len(deviceNames) == 0:
+       print("Error - No devices detected.")
+       quit()
+
+# Open first NCS device found
+device = ncs.Device(deviceNames[0])    
+       
+# Allocate graph / otherwise use device as needed
+
+# Deallocate graph if allocated
+
+device.CloseDevice()
+</code></pre>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/GetGlobalOption.html b/docs/ncapi/ncapi1/py_api/GetGlobalOption.html
new file mode 100644 (file)
index 0000000..3b244cf
--- /dev/null
@@ -0,0 +1,113 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="getglobaloption">GetGlobalOption</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="GlobalOption.html">GlobalOption</a><br /><a href="SetGlobalOption.html">SetGlobalOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to get a Global option. The available options can be found in the <a href="GlobalOption.html">GlobalOption</a> enumeration section.</p>
+
+<h2 id="syntax">Syntax</h2>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">value</span> <span class="o">=</span> <span class="n">GetGlobalOption</span><span class="p">(</span><span class="n">option</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>Member of the GlobalOption enumeration that specifies which option to get.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>The value for the specified option. The type of the returned value depends on the option specified. See the <a href="GlobalOption.html">GlobalOption</a> enumeration for the type that will be returned for each option.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<pre><code class="language-Python">from mvnc import mvncapi as mvnc
+
+# Get current logging level Global Option
+logLevel = mvnc.GetGlobalOption(mvnc.GlobalOption.LOGLEVEL)
+
+print("The current global logging level is: ", logLevel)
+</code></pre>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/GlobalOption.html b/docs/ncapi/ncapi1/py_api/GlobalOption.html
new file mode 100644 (file)
index 0000000..7949cf3
--- /dev/null
@@ -0,0 +1,99 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="globaloption-enumeration-class">GlobalOption Enumeration Class</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="SetGlobalOption.html">SetGlobalOption()</a> <br /><a href="GetGlobalOption.html">GetGlobalOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>The GlobalOption class is an enumeration class that defines the options that are passed to and received from the SetGlobalOption and the GetGlobalOption functions.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>enum</th>
+      <th>option type</th>
+      <th>possible values</th>
+      <th>get/set</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>LOGLEVEL</td>
+      <td>int</td>
+      <td>0, 1, 2</td>
+      <td>get, set</td>
+      <td>0 = Nothing is printed (default) <br />1 = Print errors only <br />2 = Verbose</td>
+    </tr>
+  </tbody>
+</table>
+
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Graph.DeallocateGraph.html b/docs/ncapi/ncapi1/py_api/Graph.DeallocateGraph.html
new file mode 100644 (file)
index 0000000..18ad684
--- /dev/null
@@ -0,0 +1,111 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphdeallocategraph">Graph.DeallocateGraph()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.AllocateGraph.html">Device.AllocateGraph()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to deallocate a graph that was allocated for an Intel® Movidius™ NCS device with the Device.AllocateGraph() method.  This should be called for every graph that is created to free resources associated with the graph.</p>
+
+<h2 id="syntax">Syntax</h2>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">graph</span><span class="o">.</span><span class="n">DeallocateGraph</span><span class="p">()</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>None.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+<p>The Graph class can only be created via the Device.AllocateGraph() function.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
+<span class="kn">import</span> <span class="nn">mvnc.mvncapi</span> <span class="k">as</span> <span class="n">ncs</span>
+<span class="n">deviceNames</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">EnumerateDevices</span><span class="p">()</span>
+<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">deviceNames</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+       <span class="k">print</span><span class="p">(</span><span class="s">"Error - No devices detected."</span><span class="p">)</span>
+       <span class="n">quit</span><span class="p">()</span>
+
+<span class="c"># Open first NCS device found</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvnc</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">devices</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+<span class="c"># Allocate the graph </span>
+<span class="n">device</span><span class="o">.</span><span class="n">AllocateGraph</span><span class="p">(</span><span class="s">"my_graph"</span><span class="p">)</span>
+
+<span class="c"># Use device here</span>
+
+<span class="n">graph</span><span class="o">.</span><span class="n">DeallocateGraph</span><span class="p">()</span>
+
+<span class="n">device</span><span class="o">.</span><span class="n">CloseDevice</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Graph.GetGraphOption.html b/docs/ncapi/ncapi1/py_api/Graph.GetGraphOption.html
new file mode 100644 (file)
index 0000000..84d1b1e
--- /dev/null
@@ -0,0 +1,122 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphgetgraphoption">Graph.GetGraphOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.SetGraphOption.html">Graph.SetGraphOption()</a> <br /><a href="GraphOption.html">GraphOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to get a graph option. The available options can be found in <a href="GraphOption.html">GraphOption</a> enumeration class.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">value</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">GetGraphOption</span><span class="p">(</span><span class="n">option</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>A value from the GraphOption enumeration to specify which option’s value should be returned.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>The value for the specified GraphOption is returned. The type of the returned value depends on the option specified. See the <a href="GraphOption.html">GraphOption</a> class for the value types for each option.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">mvnc.mvncapi</span> <span class="k">as</span> <span class="n">ncs</span>
+<span class="n">deviceNames</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">EnumerateDevices</span><span class="p">()</span>
+<span class="n">ncsDevice</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">deviceNames</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+<span class="n">ncsDevice</span><span class="o">.</span><span class="n">OpenDevice</span><span class="p">()</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">ncsDevice</span><span class="o">.</span><span class="n">AllocateGraph</span><span class="p">(</span><span class="s">"../networks/myNetwork/graph"</span><span class="p">)</span>
+
+<span class="c"># Get the graph option</span>
+<span class="n">optionValue</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">GetGraphOption</span><span class="p">(</span><span class="n">mvnc</span><span class="o">.</span><span class="n">GraphOption</span><span class="o">.</span><span class="n">DONTBLOCK</span><span class="p">)</span>
+
+<span class="c"># Use device here</span>
+
+<span class="n">graph</span><span class="o">.</span><span class="n">DeallocateGraph</span><span class="p">()</span>
+<span class="n">ncsDevice</span><span class="o">.</span><span class="n">CloseDevice</span><span class="p">()</span>    
+
+
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Graph.GetResult.html b/docs/ncapi/ncapi1/py_api/Graph.GetResult.html
new file mode 100644 (file)
index 0000000..da520b9
--- /dev/null
@@ -0,0 +1,101 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphgetresult">Graph.GetResult()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.LoadTensor.html">Graph.LoadTensor()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function retrieves the result of an inference that was initiated via Graph.LoadTensor() on the specified graph.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">inferenceResult</span><span class="p">,</span> <span class="n">userObj</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">GetResult</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>The inference result and user object that was specified in the Graph.LoadTensor() call that initiated this inference.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
+<span class="c"># Open NCS device and allocate a graph</span>
+
+<span class="n">graph</span><span class="o">.</span><span class="n">LoadTensor</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">float16</span><span class="p">),</span> <span class="s">"user object for this inference"</span><span class="p">)</span>
+<span class="n">inferenceResult</span><span class="p">,</span> <span class="n">userObj</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">GetResult</span><span class="p">()</span>
+
+<span class="c"># Deallocate graph</span>
+<span class="c"># Close device</span>
+
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Graph.LoadTensor.html b/docs/ncapi/ncapi1/py_api/Graph.LoadTensor.html
new file mode 100644 (file)
index 0000000..c26a6ea
--- /dev/null
@@ -0,0 +1,123 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphloadtensor">Graph.LoadTensor()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.GetResult.html">Graph.GetResult()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function initiates an inference on the specified graph via the associated Intel® Movidius™ NCS device. After calling this function, use the Graph.GetResult() function to retrieve the inference result.</p>
+
+<h2 id="syntax">Syntax</h2>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">graph</span><span class="o">.</span><span class="n">LoadTensor</span><span class="p">(</span><span class="n">inputTensor</span><span class="p">,</span> <span class="n">userObject</span><span class="p">)</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Description</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>inputTensor</td>
+      <td>Input data on which an inference will be run. The data must be passed in a numpy ndarray of half precision floats (float 16).</td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td>userObject</td>
+      <td>A user-defined parameter that is returned by the GetResult function along with the inference result for this tensor.</td>
+      <td> </td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>Returns True if the function works, False if not. When the graph is in non-blocking mode (GraphOption.DONTBLOCK), this function will return False if the device is busy.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
+<span class="c"># Enumerate Device</span>
+<span class="c"># Open Device, # Allocate Graph, # Set Graph Option</span>
+<span class="c"># Read an image, resize the image and adjust for mean if necessary to match the network expected size</span>
+
+<span class="k">if</span> <span class="p">(</span><span class="n">graph</span><span class="o">.</span><span class="n">LoadTensor</span><span class="p">(</span><span class="n">img</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">float16</span><span class="p">),</span> <span class="s">'user object'</span><span class="p">)):</span>
+    <span class="k">print</span><span class="p">(</span><span class="s">"LoadTensor success"</span><span class="p">)</span>
+    <span class="n">output</span><span class="p">,</span> <span class="n">userobj</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">GetResult</span><span class="p">()</span>
+
+<span class="c"># Deallocate the graph and Close the device</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Graph.SetGraphOption.html b/docs/ncapi/ncapi1/py_api/Graph.SetGraphOption.html
new file mode 100644 (file)
index 0000000..b338d70
--- /dev/null
@@ -0,0 +1,122 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphsetgraphoption">Graph.SetGraphOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.GetGraphOption.html">Graph.GetGraphOption()</a> <br /><a href="GraphOption.html">GraphOption</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to set a graph option. The available options can be found in the <a href="GraphOption.html">GraphOption</a> enumeration class.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">graph</span><span class="o">.</span><span class="n">SetGraphOption</span><span class="p">(</span><span class="n">option</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>Member of the GraphOption enumeration specifying which option’s value will be set.</td>
+    </tr>
+    <tr>
+      <td>value</td>
+      <td>The new value to which the specified graph option will be set. See the <a href="GraphOption.html">GraphOption</a> enumeration class for the type of value for each option.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None.</p>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">mvnc.mvncapi</span> <span class="k">as</span> <span class="n">ncs</span>
+<span class="n">deviceNames</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">EnumerateDevices</span><span class="p">()</span>
+<span class="n">ncsDevice</span> <span class="o">=</span> <span class="n">ncs</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">deviceNames</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+<span class="n">ncsDevice</span><span class="o">.</span><span class="n">OpenDevice</span><span class="p">()</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">ncsDevice</span><span class="o">.</span><span class="n">AllocateGraph</span><span class="p">(</span><span class="s">"../networks/myNetwork/graph"</span><span class="p">)</span>
+
+<span class="n">graph</span><span class="o">.</span><span class="n">SetGraphOption</span><span class="p">(</span><span class="n">mvnc</span><span class="o">.</span><span class="n">GraphOption</span><span class="o">.</span><span class="n">DONTBLOCK</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+
+<span class="c"># Use device here</span>
+
+<span class="n">graph</span><span class="o">.</span><span class="n">DeallocateGraph</span><span class="p">()</span>
+<span class="n">ncsDevice</span><span class="o">.</span><span class="n">CloseDevice</span><span class="p">()</span>    
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Graph.html b/docs/ncapi/ncapi1/py_api/Graph.html
new file mode 100644 (file)
index 0000000..0b91ae8
--- /dev/null
@@ -0,0 +1,61 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graph-class">Graph Class</h1>
+
+<p>The Graph class is a container for a neural network graph file that is associated with a particular Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) device.</p>
+
+<h2 id="usage">Usage</h2>
+<p>To use the Graph class, you must create a graph handle by calling AllocateGraph() from the Device class. The location of the graph file will be passed to AllocateGraph(), and it will return an instance of the Graph class. Once you have successfully created an instance of this class, the typical usage is to optionally get/set graph options, then call LoadTensor() and GetResult() to perform inferencing with the graph that was allocated. Finally, call DeallocateGraph() when the neural network is no longer needed.</p>
+
+<h2 id="graph-methods">Graph methods</h2>
+<ul>
+  <li><a href="Graph.DeallocateGraph.html">DeallocateGraph</a></li>
+  <li><a href="Graph.SetGraphOption.html">SetGraphOption</a></li>
+  <li><a href="Graph.GetGraphOption.html">GetGraphOption</a></li>
+  <li><a href="Graph.LoadTensor.html">LoadTensor</a></li>
+  <li><a href="Graph.GetResult.html">GetResult</a></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/GraphOption.html b/docs/ncapi/ncapi1/py_api/GraphOption.html
new file mode 100644 (file)
index 0000000..0dbe62e
--- /dev/null
@@ -0,0 +1,112 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphoption-enumeration-class">GraphOption Enumeration Class</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.SetGraphOption.html">Graph.SetGraphOption()</a> <br /><a href="Graph.GetGraphOption.html">Graph.GetGraphOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>The GraphOption class is an enumeration class that defines the options that are passed to and received from the SetDeviceOption and the GetDeviceOption functions.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>enum</th>
+      <th>option type</th>
+      <th>possible values</th>
+      <th>get/set</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>DONTBLOCK</td>
+      <td>int</td>
+      <td>0 or 1</td>
+      <td>get/set</td>
+      <td>0: Calls to Graph.LoadTensor() and Graph.GetResult() will block (won’t return until the action is completed) (Default)<br />1: Calls to those functions don’t block (they will return immediately).  If the action coudn’t be completed the return value will indicate why.  Graph.LoadTensor() will return MVNC_BUSY when the NCS isn’t able to perform the action because its busy, try again later.  Graph.GetResult() will return MVNC_NO_DATA unless there is an inference that is ready to be returned.  In this case try again later and when there is a completed inference the results will be returned.</td>
+    </tr>
+    <tr>
+      <td>TIMETAKEN</td>
+      <td>numpy float array</td>
+      <td>any</td>
+      <td>get</td>
+      <td>Return a numpy float array of inference times per layer in float data type.</td>
+    </tr>
+    <tr>
+      <td>DEBUGINFO</td>
+      <td>string</td>
+      <td>any</td>
+      <td>get</td>
+      <td>Return a string with the error text as returned by the device.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/SetGlobalOption.html b/docs/ncapi/ncapi1/py_api/SetGlobalOption.html
new file mode 100644 (file)
index 0000000..4a29123
--- /dev/null
@@ -0,0 +1,112 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="setglobaloption">SetGlobalOption</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="GlobalOption.html">GlobalOption</a><br /><a href="GetGlobalOption.html">GetGlobalOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function is used to set a Global option. The available Global options and possible values can be found in the documentation for the <a href="GlobalOption.html">GlobalOption</a> enumeration.</p>
+
+<h2 id="syntax">Syntax</h2>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">SetGlobalOption</span><span class="p">(</span><span class="n">option</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="paramerers">Paramerers</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>Member of the GlobalOptions enumeration that specifies which option to set.</td>
+    </tr>
+    <tr>
+      <td>value</td>
+      <td>The new value to which the option will be set. See the <a href="GlobalOption.html">GlobalOption</a> enumeration class for the type of value for each option.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="known-issues">Known Issues</h2>
+
+<h2 id="example">Example</h2>
+<pre><code class="language-Python">import mvnc.mvncapi as ncs
+
+# Set the global logging level to verbose
+ncs.SetGlobalOption(ncs.GlobalOption.LOGLEVEL, 2)
+</code></pre>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/Status.html b/docs/ncapi/ncapi1/py_api/Status.html
new file mode 100644 (file)
index 0000000..cafa59e
--- /dev/null
@@ -0,0 +1,137 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="status-enumeration-class">Status Enumeration Class</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>1.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td> </td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>The Status class is an enumeration class that defines status codes returned from calls to the API functions. If the underlying API returns a non-zero status, an exception is usually raised with the corresponding status. The possible status codes are shown below.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Enumeration Values</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>MVNC_OK</td>
+      <td>The function call worked as expected.</td>
+    </tr>
+    <tr>
+      <td>MVNC_BUSY</td>
+      <td>The device is busy, retry later.</td>
+    </tr>
+    <tr>
+      <td>MVNC_ERROR</td>
+      <td>An unexpected error was encountered during the function call.</td>
+    </tr>
+    <tr>
+      <td>MVNC_OUT_OF_MEMORY</td>
+      <td>The host is out of memory.</td>
+    </tr>
+    <tr>
+      <td>MVNC_DEVICE_NOT_FOUND</td>
+      <td>There is no device at the given index or name.</td>
+    </tr>
+    <tr>
+      <td>MVNC_INVALID_PARAMETERS</td>
+      <td>At least one of the given parameters is invalid in the context of the function call.</td>
+    </tr>
+    <tr>
+      <td>MVNC_TIMEOUT</td>
+      <td>Timeout in the communication with the device</td>
+    </tr>
+    <tr>
+      <td>MVNC_MVCMD_NOT_FOUND</td>
+      <td>The file named MvNCAPI.mvcmd is installed in the mvnc directory. This message means that the file has been moved or installer failed.</td>
+    </tr>
+    <tr>
+      <td>MVNC_NO_DATA</td>
+      <td>No data to return.</td>
+    </tr>
+    <tr>
+      <td>MVNC_GONE</td>
+      <td>The graph or device has been closed during the operation.</td>
+    </tr>
+    <tr>
+      <td>MVNC_UNSUPPORTED_GRAPH_FILE</td>
+      <td>The graph file is corrupt or may have been created with an incompatible prior version of the NCS toolkit. Try to recompile the graph file with the version of the toolkit that corresponds to the API version.</td>
+    </tr>
+    <tr>
+      <td>MVNC_MYRIAD_ERROR</td>
+      <td>An error has been reported by the Intel® Movidius™ VPU. Use MVNC_DEBUGINFO.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/py_api/readme.html b/docs/ncapi/ncapi1/py_api/readme.html
new file mode 100644 (file)
index 0000000..87285fa
--- /dev/null
@@ -0,0 +1,78 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="intel-movidius-neural-compute-sdk-python-api">Intel® Movidius™ Neural Compute SDK Python API</h1>
+
+<p>The Intel® Movidius™ Neural Compute SDK comes with a Python3 Language API that enables applications that utilize hardware accelerated Deep Neural Networks via the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS). The API is provided as a single Python script (mvncapi.py), which is placed on the development computer when the SDK is installed. Details of the Python API are provided below and within the documents linked from here.</p>
+
+<h2 id="class-diagram">Class Diagram</h2>
+<p>The Python class diagram follows. In this diagram, it is shown that the entire Python API is in the mvnc Python package. Within the mvnc package, there is one Python module, which is mvncapi. The mvncapi module is defined by the contents of the mvncapi.py file.</p>
+
+<p><img src="../images/python_api_class_diagram.jpg" alt="" /></p>
+
+<p>The details of the elements within the mvncapi module are provided in the lists that follow. These include module level enumerations, functions that are global to the module, and the classes defined in the module.</p>
+
+<h2 id="enumerations">Enumerations</h2>
+<ul>
+  <li><a href="GlobalOption.html">GlobalOption</a></li>
+  <li><a href="DeviceOption.html">DeviceOption</a></li>
+  <li><a href="GraphOption.html">GraphOption</a></li>
+  <li><a href="Status.html">Status</a></li>
+</ul>
+
+<h2 id="global-functions">Global Functions</h2>
+<ul>
+  <li><a href="EnumerateDevices.html">EnumerateDevices</a></li>
+  <li><a href="SetGlobalOption.html">SetGlobalOption</a></li>
+  <li><a href="GetGlobalOption.html">GetGlobalOption</a></li>
+</ul>
+
+<h2 id="classes">Classes</h2>
+<ul>
+  <li><a href="Device.html">Device</a></li>
+  <li><a href="Graph.html">Graph</a></li>
+</ul>
+
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi1/readme.html b/docs/ncapi/ncapi1/readme.html
new file mode 100644 (file)
index 0000000..fb84996
--- /dev/null
@@ -0,0 +1,47 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../assets/css/style.css">
+    <script src="../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncDeviceClose.html b/docs/ncapi/ncapi2/c_api/ncDeviceClose.html
new file mode 100644 (file)
index 0000000..5982b03
--- /dev/null
@@ -0,0 +1,137 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncdeviceclose">ncDeviceClose()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>, <a href="ncDeviceCreate.html">ncDeviceCreate()</a>, <a href="ncDeviceOpen.html">ncDeviceOpen()</a>, <a href="ncDeviceDestroy.html">ncDeviceDestroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function closes communication with a neural compute device that has been opened with <a href="ncDeviceOpen.html">ncDeviceOpen()</a>.</p>
+
+<p>Before calling this function, you must destroy all <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> structs and <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> structs that were allocated to this device.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncDeviceClose</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>*</td>
+      <td>A pointer to an <a href="ncDeviceCreate.html">initialized</a> and <a href="ncDeviceOpen.html">opened</a> ncDeviceHandle_t struct for the device that will be closed. The device state must be <a href="ncDeviceState_t.html">NC_DEVICE_OPENED</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>When the device has been successfully closed the device state will be <a href="ncDeviceState_t.html">NC_DEVICE_CLOSED</a>.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span><span class="p">;</span>
+    
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>  
+    
+    <span class="c1">// Device handle is ready to use now, pass it to other API calls as needed...</span>
+
+    <span class="c1">// Close the device</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="c1">// Failed to close the device</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"ncDeviceClose Failed [%d]: Could not close the device.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncDeviceCreate.html b/docs/ncapi/ncapi2/c_api/ncDeviceCreate.html
new file mode 100644 (file)
index 0000000..5a55b18
--- /dev/null
@@ -0,0 +1,147 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncdevicecreate">ncDeviceCreate()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>, <a href="ncDeviceOption_t.html">ncDeviceOption_t</a>, <a href="ncDeviceOpen.html">ncDeviceOpen()</a>, <a href="ncDeviceClose.html">ncDeviceClose()</a>, <a href="ncDeviceDestroy.html">ncDeviceDestroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function initializes a <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct.</p>
+
+<p>You must create a separate handle for each neural compute device. Typical multi-device usage is to call this function repeatedly, starting with index = 0 and incrementing the index each time until an error is returned.</p>
+
+<p><a href="ncDeviceDestroy.html">ncDeviceDestroy()</a> frees the memory that is allocated with this function.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="kt">int</span> <span class="n">index</span><span class="p">,</span> <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">**</span> <span class="n">deviceHandle</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>index</td>
+      <td>int</td>
+      <td>The zero-based index of a neural compute device.</td>
+    </tr>
+    <tr>
+      <td>deviceHandle</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>**</td>
+      <td>The address of a pointer to a ncDeviceHandle_t struct that will be created and initialized by this function.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct must be created and initialized with this function before being passed to any other API functions. When the device handle is properly initialized, the device state will be <a href="ncDeviceState_t.html">NC_DEVICE_CREATED</a>.</li>
+  <li>After initialization, the <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct must be passed to <a href="ncDeviceOpen.html">ncDeviceOpen()</a> before being passed to any API functions other than <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a> or <a href="ncDeviceSetOption.html">ncDeviceSetOption()</a>.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span><span class="p">;</span>
+    
+    <span class="c1">// Initialize the device handle</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="c1">// Failed to initialize the device... maybe it isn't plugged in to the host</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"ncDeviceCreate Failed [%d]: Could not initialize the device.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+        
+        <span class="c1">// Device handle is ready to use now, pass it to other API calls as needed...</span>
+            
+        <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+        <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="p">}</span>   
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncDeviceDestroy.html b/docs/ncapi/ncapi2/c_api/ncDeviceDestroy.html
new file mode 100644 (file)
index 0000000..b17aeb6
--- /dev/null
@@ -0,0 +1,130 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncdevicedestroy">ncDeviceDestroy()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>, <a href="ncDeviceCreate.html">ncDeviceCreate()</a>, <a href="ncDeviceOpen.html">ncDeviceOpen()</a>, <a href="ncDeviceClose.html">ncDeviceClose()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function destroys a handle for a neural compute device and frees associated resources. This function must be called for every device handle that was initialized with <a href="ncDeviceCreate.html">ncDeviceCreate()</a>.</p>
+
+<p>Upon successful return, the <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct pointer will be set to NULL.</p>
+
+<p>Before calling this function, you must destroy all <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> structs and <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> structs that were allocated to this device and close the device with <a href="ncDeviceClose.html">ncDeviceClose()</a>.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">**</span> <span class="n">deviceHandle</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>**</td>
+      <td>The address of a pointer to an <a href="ncDeviceCreate.html">initialized</a> ncDeviceHandle_t struct.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<p>None.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span><span class="p">;</span>
+    
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    
+    <span class="c1">// Device handle is ready to use now, pass it to other API calls as needed...</span>
+    
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncDeviceGetOption.html b/docs/ncapi/ncapi2/c_api/ncDeviceGetOption.html
new file mode 100644 (file)
index 0000000..58b898a
--- /dev/null
@@ -0,0 +1,212 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncdevicegetoption">ncDeviceGetOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>, <a href="ncDeviceOption_t.html">ncDeviceOption_t</a>, <a href="ncDeviceSetOption.html">ncDeviceSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function gets the value of an option for a neural compute device. The available options and possible values can be found in the <a href="ncDeviceOption_t.html">ncDeviceOption_t</a> enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncDeviceGetOption</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">,</span>
+                             <span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span> <span class="n">data</span><span class="p">,</span>
+                             <span class="kt">unsigned</span> <span class="kt">int</span><span class="o">*</span> <span class="n">dataLength</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>*</td>
+      <td>A pointer to an ncDeviceHandle_t struct for the device for which the option value will be retrieved. The device state must be <a href="ncDeviceState_t.html">NC_DEVICE_CREATED</a> or <a href="ncDeviceState_t.html">NC_DEVICE_OPENED</a>.</td>
+    </tr>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the <a href="ncDeviceOption_t.html">ncDeviceOption_t</a> enumeration that specifies which option’s value will be retrieved.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>void*</td>
+      <td>A pointer to a buffer where the value of the option will be copied. The size and type of data this points to will depend on the option that is specified. See <a href="ncDeviceOption_t.html">ncDeviceOption_t</a> for option data types.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int*</td>
+      <td>A pointer to an unsigned int which contains the size, in bytes, of the buffer allocated by the caller for the data parameter.<br /><br />Upon normal return (status code <a href="ncStatus_t.html">NC_OK</a>), dataLength will be set to the number of bytes copied to the data buffer. In the event that the data buffer was an insufficient size to hold the option value, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and dataLength will be set to the size required to hold the option value.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<p>If the data buffer was an insufficient size to hold the option value, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and dataLength will be set to the size required to hold the option value.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>If you don’t know what value to use for dataLength, you can call this function once with a dataLength of 0 to have dataLength be set to the correct value and then allocate a correctly sized buffer and call this function again. See the example below.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<p>Get an option value when you know the correct data length:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span><span class="p">;</span>
+    
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    
+    <span class="cm">/* Get the device state option value */</span>  
+    <span class="kt">int</span> <span class="n">deviceState</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLength</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">int</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceGetOption</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_DEVICE_STATE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceState</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dataLength</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="c1">// Failed to get the option.</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"ncDeviceGetOption Failed [%d].</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    
+    <span class="cm">/* Use the device state as needed */</span>
+    <span class="n">printf</span><span class="p">(</span><span class="s">"The device state is %d.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">deviceState</span><span class="p">);</span>
+
+    <span class="c1">// open, use and close the device here as needed    </span>
+
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+<p>Get an option value when you don’t know the correct data length:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span><span class="p">;</span>
+    
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    
+    <span class="cm">/* Get the size of the option so we know what to allocate */</span>  
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLength</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceGetOption</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_DEVICE_STATE</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dataLength</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">==</span> <span class="n">NC_INVALID_DATA_LENGTH</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// we passed length too small (zero) and it should now be set to correct size</span>
+        <span class="kt">void</span> <span class="o">*</span><span class="n">optionPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+        <span class="n">optionPtr</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">dataLength</span><span class="p">);</span>
+        <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceGetOption</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_DEVICE_STATE</span><span class="p">,</span> <span class="n">optionPtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dataLength</span><span class="p">);</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+        <span class="p">{</span>
+            <span class="c1">// Failed to get the option.</span>
+            <span class="n">printf</span><span class="p">(</span><span class="s">"ncDeviceGetOption Failed [%d].</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+            <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+            <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+        <span class="p">}</span>
+        <span class="cm">/* Use the device state as needed */</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"The device state is %d.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="o">*</span><span class="p">((</span><span class="kt">int</span> <span class="o">*</span><span class="p">)</span><span class="n">optionPtr</span><span class="p">));</span>
+        <span class="n">free</span><span class="p">(</span><span class="n">optionPtr</span><span class="p">);</span>
+        <span class="n">optionPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="c1">// Failed to get the option size.</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"ncDeviceGetOption Failed to get the size[%d].</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="c1">// open, use and close the device here as needed    </span>
+
+    <span class="c1">// done with device, destroy it.</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+
+    
+    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncDeviceHandle_t.html b/docs/ncapi/ncapi2/c_api/ncDeviceHandle_t.html
new file mode 100644 (file)
index 0000000..b1ba877
--- /dev/null
@@ -0,0 +1,84 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="struct-ncdevicehandle_t">struct ncDeviceHandle_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>,<a href="ncDeviceOption_t.html">ncDeviceOption_t</a>, <a href="ncDeviceCreate.html">ncDeviceCreate()</a>, <a href="ncDeviceOpen.html">ncDeviceOpen()</a>, <a href="ncDeviceClose.html">ncDeviceClose()</a>, <a href="ncDeviceSetOption.html">ncDeviceSetOption()</a>, <a href="ncDeviceGetOption.html">ncDevicetGetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>The <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct is an abstraction for a neural compute device that is used throughout the API.</p>
+
+<h2 id="typical-usage">Typical Usage</h2>
+<ul>
+  <li>Initialize the <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct with <a href="ncDeviceCreate.html">ncDeviceCreate()</a></li>
+  <li>Initialize the device and open communication with <a href="ncDeviceOpen.html">ncDeviceOpen()</a></li>
+  <li>Use the device</li>
+  <li>Close the device with <a href="ncDeviceClose.html">ncDeviceClose()</a></li>
+  <li>Destroy the device handle and free associated resources with <a href="ncDeviceDestroy.html">ncDeviceDestroy()</a></li>
+</ul>
+
+<p>See the <a href="readme.html">C API Overview</a> for more information about typical API usage.</p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncDeviceHwVersion_t.html b/docs/ncapi/ncapi2/c_api/ncDeviceHwVersion_t.html
new file mode 100644 (file)
index 0000000..004559c
--- /dev/null
@@ -0,0 +1,93 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enum-ncdevicehwversion_t">enum ncDeviceHwVersion_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>, <a href="ncDeviceOption_t.html">ncDeviceOption_t</a>, <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The ncDeviceHwVersion_t enumeration defines neural compute device hardware versions, which can be read with <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_MA2450</td>
+      <td>A neural compute device hardware version.</td>
+    </tr>
+    <tr>
+      <td>NC_MA2480</td>
+      <td>A neural compute device hardware version.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncDeviceOpen.html b/docs/ncapi/ncapi2/c_api/ncDeviceOpen.html
new file mode 100644 (file)
index 0000000..d2f33b2
--- /dev/null
@@ -0,0 +1,142 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncdeviceopen">ncDeviceOpen()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>, <a href="ncDeviceCreate.html">ncDeviceCreate()</a>, <a href="ncDeviceClose.html">ncDeviceClose()</a>, <a href="ncDeviceDestroy.html">ncDeviceDestroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function initializes a neural compute device and opens communication.</p>
+
+<p>Upon successful return from this function, the device will be ready for use.</p>
+
+<p><a href="ncDeviceClose.html">ncDeviceClose()</a> closes communication with devices opened with this function.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>*</td>
+      <td>A pointer to an <a href="ncDeviceCreate.html">initialized</a> ncDeviceHandle_t struct for the device that will be opened. The device state must be <a href="ncDeviceState_t.html">NC_DEVICE_CREATED</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct must be passed to <a href="ncDeviceCreate.html">ncDeviceCreate()</a> and then this function before being passed to any API functions other than <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a> or <a href="ncDeviceSetOption.html">ncDeviceSetOption()</a>. When the device has been successfully opened, the device state will be <a href="ncDeviceState_t.html">NC_DEVICE_OPENED</a>.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span><span class="p">;</span>
+    
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+
+    <span class="c1">// Open the device</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="c1">// Failed to open the device</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"ncDeviceOpen Failed [%d]: Could not open the device.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span> 
+    <span class="k">else</span> 
+    <span class="p">{</span>
+        <span class="c1">// Device handle is ready to use now, pass it to other API calls as needed...</span>
+    
+        <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncDeviceOption_t.html b/docs/ncapi/ncapi2/c_api/ncDeviceOption_t.html
new file mode 100644 (file)
index 0000000..05842d0
--- /dev/null
@@ -0,0 +1,189 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enum-ncdeviceoption_t">enum ncDeviceOption_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>, <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a>, <a href="ncDeviceSetOption.html">ncDeviceSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The ncDeviceOption_t enumeration defines neural compute device options that can be read with <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a> or set with <a href="ncDeviceSetOption.html">ncDeviceSetOption()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_RO_DEVICE_THERMAL_STATS</td>
+      <td>float[ ]</td>
+      <td>Any</td>
+      <td>Device temperatures in degrees Celsius. The size of this array is NC_THERMAL_BUFFER_SIZE.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_THERMAL_THROTTLING_LEVEL</td>
+      <td>int</td>
+      <td>0, 1, 2</td>
+      <td>0: No limit reached.<br />1: Lower guard temperature threshold of chip sensor reached; short throttling time is in action between inferences to protect the device.<br />2: Upper guard temperature of chip sensor reached; long throttling time is in action between inferences to protect the device.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_STATE</td>
+      <td>int</td>
+      <td>Values in the <a href="ncDeviceState_t.html">ncDeviceState_t</a> enumeration</td>
+      <td>The state of the device and the associated <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_CURRENT_MEMORY_USED</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The current memory in use on the device in bytes. This value divided by NC_RO_DEVICE_MEMORY_SIZE is the percent of memory in use.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_MEMORY_SIZE</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The total memory available on the device in bytes.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_MAX_FIFO_NUM</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The maximum number of FIFOs that can be allocated for the device.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_ALLOCATED_FIFO_NUM</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The number of FIFOs currently allocated for the device.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_MAX_GRAPH_NUM</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The maximum number of graphs that can be allocated for the device.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_ALLOCATED_GRAPH_NUM</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The number of graphs currently allocated for the device.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_OPTION_CLASS_LIMIT</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The highest option class supported.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_FW_VERSION</td>
+      <td>unsigned int[4]</td>
+      <td>[<em>major, minor, hardware type, build number</em>]</td>
+      <td>The version of the firmware currently running on the device.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_DEBUG_INFO</td>
+      <td>char[ ]</td>
+      <td>Debug info</td>
+      <td><em>Not yet implemented.</em><br /><br />A null-terminated character array containing more detailed debug info when the result of a function call was <a href="ncStatus_t.html">NC_MYRIAD_ERROR</a>. The maximum size of this array is NC_DEBUG_BUFFER_SIZE.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_MVTENSOR_VERSION</td>
+      <td>unsigned int[2]</td>
+      <td>[<em>major, minor</em>]</td>
+      <td>The version of the mvtensor library that was linked with the API.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_NAME</td>
+      <td>char[ ]</td>
+      <td>Device name</td>
+      <td>A null-terminated character array containing the internal name of the device. The maximum size of this array is NC_MAX_NAME_SIZE.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_MAX_EXECUTORS_NUM</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td><em>Reserved for future use.</em></td>
+    </tr>
+    <tr>
+      <td>NC_RO_DEVICE_HW_VERSION</td>
+      <td>int</td>
+      <td>Values in the <a href="ncDeviceHwVersion_t.html">ncDeviceHwVersion_t</a> enumeration</td>
+      <td>The hardware version of the device.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li><strong>Options prefixed with ‘NC_RW’ have read/write permission and are both gettable and settable.</strong></li>
+  <li><strong>Options prefixed with ‘NC_RO’ have read-only permission and are only gettable.</strong></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncDeviceSetOption.html b/docs/ncapi/ncapi2/c_api/ncDeviceSetOption.html
new file mode 100644 (file)
index 0000000..5d94ce6
--- /dev/null
@@ -0,0 +1,127 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncdevicesetoption">ncDeviceSetOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>, <a href="ncDeviceOption_t.html">ncDeviceOption_t</a>, <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function sets an option value for a neural compute device. The available options and possible values can be found in the <a href="ncDeviceOption_t.html">ncDeviceOption_t</a> enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncDeviceSetOption</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">,</span>
+                             <span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span> <span class="n">data</span><span class="p">,</span>
+                             <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLength</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>*</td>
+      <td>A pointer to an ncDeviceHandle_t struct for the device for which the option value will be set. The device state must be <a href="ncDeviceState_t.html">NC_DEVICE_CREATED</a> or <a href="ncDeviceState_t.html">NC_DEVICE_OPENED</a>.</td>
+    </tr>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the <a href="ncDeviceOption_t.html">ncDeviceOption_t</a> enumeration that specifies which option’s value will be set.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>const void*</td>
+      <td>A pointer to a buffer containing the new value for the option.<br /><br />The type of data this points to depends on the option that is specified. Check <a href="ncDeviceOption_t.html">ncDeviceOption_t</a> for option data types.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int</td>
+      <td>An unsigned int that contains the length, in bytes, of the buffer that the data parameter points to.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>There are currently no settable device options.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<p>N/A</p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncDeviceState_t.html b/docs/ncapi/ncapi2/c_api/ncDeviceState_t.html
new file mode 100644 (file)
index 0000000..77be338
--- /dev/null
@@ -0,0 +1,97 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enum-ncdevicestate_t">enum ncDeviceState_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>, <a href="ncDeviceOption_t.html">ncDeviceOption_t</a>, <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The ncDeviceState_t enumeration defines states of a neural compute device and associated <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct, which can be read with <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_DEVICE_CREATED</td>
+      <td>The <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct has been initialized with <a href="ncDeviceCreate.html">ncDeviceCreate()</a>, but device communication has not been opened.</td>
+    </tr>
+    <tr>
+      <td>NC_DEVICE_OPENED</td>
+      <td>The device handle has been initialized, and device communication has been opened with <a href="ncDeviceOpen.html">ncDeviceOpen()</a>.</td>
+    </tr>
+    <tr>
+      <td>NC_DEVICE_CLOSED</td>
+      <td>Communication with the device has been closed with <a href="ncDeviceClose.html">ncDeviceClose()</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoAllocate.html b/docs/ncapi/ncapi2/c_api/ncFifoAllocate.html
new file mode 100644 (file)
index 0000000..1d382f5
--- /dev/null
@@ -0,0 +1,178 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncfifoallocate">ncFifoAllocate()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncFifoCreate.html">ncFifoCreate()</a>, <a href="ncFifoDestroy.html">ncFifoDestroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function allocates memory for a FIFO for the specified device based on the number of elements the FIFO will hold and a <a href="ncTensorDescriptor_t.html">ncTensorDescriptor_t</a> struct, which describes the expected shape of the FIFO’s elements. Each FIFO can only be allocated to a single device.</p>
+
+<p>Upon successful return from this function, the FIFO will be ready for reading/writing.</p>
+
+<p><a href="ncFifoDestroy.html">ncFifoDestroy()</a> frees the memory allocated with this function.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">fifo</span><span class="p">,</span> <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">device</span><span class="p">,</span>
+                        <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span><span class="o">*</span> <span class="n">tensorDesc</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">numElem</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>fifo</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>*</td>
+      <td>A pointer to an <a href="ncFifoCreate.html">initialized</a> ncFifoHandle_t struct for the FIFO that will be allocated. The FIFO state must be <a href="ncFifoState_t.html">NC_FIFO_CREATED</a>.</td>
+    </tr>
+    <tr>
+      <td>device</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>*</td>
+      <td>A pointer to an <a href="ncDeviceCreate.html">initialized</a> and <a href="ncDeviceOpen.html">opened</a> ncDeviceHandle_t struct for the device to which the FIFO will be allocated. The device state must be <a href="ncDeviceState_t.html">NC_DEVICE_OPENED</a>.</td>
+    </tr>
+    <tr>
+      <td>tensorDesc</td>
+      <td><a href="ncTensorDescriptor_t.html">struct ncTensorDescriptor_t</a>*</td>
+      <td>A pointer to an ncTensorDescriptor_t struct that describes the expected shape of the elements of the FIFO.</td>
+    </tr>
+    <tr>
+      <td>numElem</td>
+      <td>unsigned int</td>
+      <td>The maximum number of elements that the FIFO will be able to contain.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The initialized <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct must be passed to <a href="ncFifoCreate.html">ncFifoCreate()</a> and then this function before it can be passed to any API function other than <a href="ncFifoGetOption.html">ncFifoGetOpion()</a> or <a href="ncFifoSetOption.html">ncFifoSetOption()</a>. When the FIFO has been allocated, the FIFO state will be <a href="ncFifoState_t.html">NC_FIFO_ALLOCATED</a>.</li>
+  <li><a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a> or <a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> can be used to easily initialize and allocate an input and an output FIFO in addition to allocating a graph to a device; these internally call <a href="ncFifoCreate.html">ncFifoCreate()</a> and <a href="ncFifoAllocate.html">ncFifoAllocate()</a> for both <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> structs and <a href="ncGraphAllocate.html">ncGraphAllocate()</a> for the graph.</li>
+  <li>Any settable <a href="ncFifoOption_t.html">ncFifoOption_t</a> options must be set before calling this function.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">inTensorDesc</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionSize</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphSizeInBytes</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphInMemoryPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">graphInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadGraphFile</span><span class="p">(</span><span class="s">"./graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">ncGraphAllocate</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">graphInMemoryPtr</span><span class="p">,</span> <span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphInMemoryPtr</span><span class="p">);</span>
+    
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Input FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+
+    <span class="c1">// if we know there is only one input descriptor for the graph we can get it like this</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Could not allocate FIFO </span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error allocating FIFO [%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="c1">// FIFO created write only FIFO.  </span>
+        <span class="c1">// Now allocate it and then Write graph input to it and then queue inferences. </span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"FIFO created OK!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="c1">// clean up the graph and device</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoCreate.html b/docs/ncapi/ncapi2/c_api/ncFifoCreate.html
new file mode 100644 (file)
index 0000000..111576b
--- /dev/null
@@ -0,0 +1,161 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncfifocreate">ncFifoCreate()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncFifoAllocate.html">ncFifoAllocate()</a>, <a href="ncFifoDestroy.html">ncFifoDestroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function initializes a <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct.</p>
+
+<p>Typically, two FIFOs are created for each network graph - one for input and one for output.</p>
+
+<p><a href="ncFifoDestroy.html">ncFifoDestroy()</a> frees the memory that is allocated with this function.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncFifoCreate</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">name</span><span class="p">,</span> <span class="n">ncFifoType_t</span> <span class="n">type</span><span class="p">,</span> <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">**</span> <span class="n">fifoHandle</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>name</td>
+      <td>const char*</td>
+      <td>A null-terminated array of characters that specify a name for the FIFO; this can be can be anything you like up to NC_MAX_NAME_SIZE characters, or just an empty string.<br /><br />The name can be retrieved later with <a href="ncFifoGetOption.html">ncFifoGetOption()</a>.</td>
+    </tr>
+    <tr>
+      <td>type</td>
+      <td><a href="ncFifoType_t.html">ncFifoType_t</a></td>
+      <td>A member of the ncFifoType_t enumeration that specifies the FIFO access type. The API should be able to write to input FIFOs and read from output FIFOs.</td>
+    </tr>
+    <tr>
+      <td>fifoHandle</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>**</td>
+      <td>The address of a pointer to a ncFifoHandle_t struct that will be created and initialized by this function.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct must be created and initialized with this function before being passed to any API functions. When the FIFO handle is properly initialized, the FIFO state will be <a href="ncFifoState_t.html">NC_FIFO_CREATED</a>.</li>
+  <li>After initialization, the <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct must be passed to <a href="ncFifoAllocate.html">ncFifoAllocate()</a> before being passed to any API function other than <a href="ncFifoGetOption.html">ncFifoGetOption()</a> or <a href="ncFifoSetOption.html">ncFifoSetOption()</a>.</li>
+  <li><a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a> or <a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> can be used to easily initialize and allocate an input and an output FIFO in addition to allocating a graph to a device; these internally call <a href="ncFifoCreate.html">ncFifoCreate()</a> and <a href="ncFifoAllocate.html">ncFifoAllocate()</a> for both <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> structs and <a href="ncGraphAllocate.html">ncGraphAllocate()</a> for the graph.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Input FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Could not create FIFO </span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error creating FIFO [%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="c1">// FIFO created write only FIFO.  </span>
+        <span class="c1">// Now allocate it and then Write graph input to it and then queue inferences. </span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"FIFO created OK!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="c1">// clean up the graph and device</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoDataType_t.html b/docs/ncapi/ncapi2/c_api/ncFifoDataType_t.html
new file mode 100644 (file)
index 0000000..7dc2092
--- /dev/null
@@ -0,0 +1,95 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enum-ncfifodatatype_t">enum ncFifoDataType_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncFifoOption_t.html">ncFifoOption_t</a>, <a href="ncFifoGetOption.html">ncFifoGetOption()</a>, <a href="ncFifoSetOption.html">ncFifoSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This enumeration contains possible data types for FIFOs, which can be read with <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a> or set with <a href="ncDeviceSetOption.html">ncDeviceSetOption()</a> or <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>.</p>
+
+<p>The default data type is NC_FIFO_FP32. If the input FIFO’s <a href="ncFifoDataType_t.html">ncFifoDataType_t</a> is configured to NC_FIFO_FP32, the API will convert the data to the FP16 data type automatically when performing inferences. If the output FIFO’s <a href="ncFifoDataType_t.html">ncFifoDataType_t</a> is configured to NC_FIFO_32FP, the API will convert the output back to the FP32 data type.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_FIFO_FP16</td>
+      <td>The data is in half precision (16 bit) floating point format (FP16).</td>
+    </tr>
+    <tr>
+      <td>NC_FIFO_FP32</td>
+      <td>The data is in full precision (32 bit) floating point format (FP32).<br /><br />This is the C float type for many compilers and computer architectures.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoDestroy.html b/docs/ncapi/ncapi2/c_api/ncFifoDestroy.html
new file mode 100644 (file)
index 0000000..b0823e8
--- /dev/null
@@ -0,0 +1,172 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncfifodestroy">ncFifoDestroy()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncFifoCreate.html">ncFifoCreate()</a>, <a href="ncFifoAllocate.html">ncFifoAllocate()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function destroys a handle for a FIFO and frees associated resources. This function must be called for every FIFO handle that was initialized with <a href="ncFifoCreate.html">ncFifoCreate()</a>.</p>
+
+<p>Upon successful return, the <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct pointer will be set to NULL.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">**</span> <span class="n">fifo</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>fifoHandle</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>**</td>
+      <td>The address of a pointer to an <a href="ncFifoCreate.html">initialized</a> ncFifoHandle_t struct.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>All elements must be removed from the FIFO before calling this function.
+    <ul>
+      <li>For input FIFOs (type <a href="ncFifoType_t.html">NC_FIFO_HOST_WO</a>), elements are removed by calling <a href="ncGraphQueueInference.html">ncGraphQueueInference()</a>.</li>
+      <li>For output FIFOs (type <a href="ncFifoType_t.html">NC_FIFO_HOST_RO</a>), elements are removed by calling <a href="ncFifoReadElem.html">ncFifoReadElem()</a>.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">inTensorDesc</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">outTensorDesc</span><span class="p">;</span>
+    <span class="kt">float</span><span class="o">*</span> <span class="n">imageInMemoryPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionSize</span><span class="p">;</span>
+
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphSizeInBytes</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadGraphFile</span><span class="p">(</span><span class="s">"./graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">ncGraphAllocate</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">graphInMemoryPtr</span><span class="p">,</span> <span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphInMemoryPtr</span><span class="p">);</span>
+
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Input FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+    
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Output FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_RO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+
+    <span class="c1">// Use FIFOs here, write input and read output from inferences with them</span>
+
+    <span class="c1">// Clean up and exit program</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Could not destroy input FIFO</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error destroying input FIFO [%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Could not destroy FIFO</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error destroying output FIFO [%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoGetOption.html b/docs/ncapi/ncapi2/c_api/ncFifoGetOption.html
new file mode 100644 (file)
index 0000000..6cc67ed
--- /dev/null
@@ -0,0 +1,235 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncfifogetoption">ncFifoGetOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncFifoOption_t.html">ncFifoOption_t</a>, <a href="ncFifoSetOption.html">ncFifoSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function gets the value of an option for a FIFO. The available options and possible values can be found in the <a href="ncFifoOption_t.html">ncFifoOption_t</a> enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">fifoHandle</span><span class="p">,</span> 
+                           <span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span> <span class="n">data</span><span class="p">,</span> 
+                           <span class="kt">unsigned</span> <span class="kt">int</span><span class="o">*</span> <span class="n">dataLength</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>fifoHandle</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>*</td>
+      <td>A pointer to an ncFifoHandle_t struct for the FIFO for which the option value will be retrieved. The FIFO state must be <a href="ncFifoState_t.html">NC_FIFO_CREATED</a> or <a href="ncFifoState_t.html">NC_FIFO_ALLOCATED</a>.</td>
+    </tr>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the <a href="ncFifoOption_t.html">ncFifoOption_t</a> enumeration that specifies which option’s value will be retrieved.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>void*</td>
+      <td>A pointer to a buffer where the value of the option will be copied. The size and type of data this points to will depend on the option that is specified. See <a href="ncFifoOption_t.html">ncFifoOption_t</a> for option data types.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int*</td>
+      <td>A pointer to an unsigned int which contains the size, in bytes, of the buffer allocated by the caller for the data parameter.<br /><br />Upon normal return (status code <a href="ncStatus_t.html">NC_OK</a>), dataLength will be set to the number of bytes copied to the data buffer. In the event that the data buffer was an insufficient size to hold the option value, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and dataLength will be set to the size required to hold the option value.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<p>If the data buffer was an insufficient size to hold the option value, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and dataLength will be set to the size required to hold the option value.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>If you don’t know what value to use for dataLength, you can call this function once with a dataLength of 0 to have dataLength be set to the correct value and then allocate a correctly sized buffer and call this function again. See the example below.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<p>Get an option value when you know the correct data length:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;mvnc.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">inTensorDesc</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">outTensorDesc</span><span class="p">;</span>
+    <span class="kt">float</span><span class="o">*</span> <span class="n">imageInMemoryPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionSize</span><span class="p">;</span>
+
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphSizeInBytes</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadGraphFile</span><span class="p">(</span><span class="s">"./graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">ncGraphAllocate</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">graphInMemoryPtr</span><span class="p">,</span> <span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphInMemoryPtr</span><span class="p">);</span>
+
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Input FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+    
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Output FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_RO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">fifoOutputSize</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionDataLen</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_FIFO_ELEMENT_DATA_SIZE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionDataLen</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Could not get FIFO option</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error getting FIFO option [%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Got FIFO option NC_RO_FIFO_ELEMENT_DATA_SIZE, it is: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">fifoOutputSize</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="c1">// Use FIFOs, device, graph here</span>
+
+    <span class="c1">// clean up the graph and device</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+<p>Get an option value when you don’t know the correct data length:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;mvnc.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">fifoHandle</span><span class="p">;</span>
+    <span class="kt">char</span><span class="o">*</span> <span class="n">fifoName</span><span class="p">;</span> 
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLength</span><span class="p">;</span>
+    
+    <span class="cm">/* Initialize a fifo handle */</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"inputFifo"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoHandle</span><span class="p">);</span>
+    
+    <span class="cm">/* retCode should be NC_OK unless there was a problem */</span>
+    <span class="k">if</span><span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    
+    <span class="cm">/* Call ncFifoGetOption once to get the correct dataLength */</span>
+    <span class="n">fifoName</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="n">dataLength</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">fifoHandle</span><span class="p">,</span> <span class="n">NC_RO_FIFO_NAME</span><span class="p">,</span> <span class="n">fifoName</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dataLength</span><span class="p">);</span>
+
+    <span class="cm">/* retCode should be NC_INVALID_DATA_LENGTH unless there was another problem */</span>
+    <span class="k">if</span><span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_INVALID_DATA_LENGTH</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    
+    <span class="cm">/* Now the value of dataLength is correctly set */</span>
+    <span class="cm">/* Allocate the array buffer */</span>
+    <span class="n">fifoName</span> <span class="o">=</span> <span class="p">(</span><span class="kt">char</span><span class="o">*</span><span class="p">)</span><span class="n">malloc</span><span class="p">(</span><span class="n">dataLength</span><span class="p">);</span>
+    
+    <span class="cm">/* Get the fifo name option value */</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">fifoHandle</span><span class="p">,</span> <span class="n">NC_RO_FIFO_NAME</span><span class="p">,</span> <span class="n">fifoName</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dataLength</span><span class="p">);</span>
+    
+    <span class="cm">/* Use the fifo name as needed */</span>
+    <span class="n">printf</span><span class="p">(</span><span class="s">"The fifo name is %s.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">fifoName</span><span class="p">);</span>
+    
+    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoHandle_t.html b/docs/ncapi/ncapi2/c_api/ncFifoHandle_t.html
new file mode 100644 (file)
index 0000000..0125330
--- /dev/null
@@ -0,0 +1,87 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="struct-ncfifohandle_t">struct ncFifoHandle_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>, <a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncFifoOption_t.html">ncFifoOption_t</a>, <a href="ncFifoCreate.html">ncFifoCreate()</a>, <a href="ncFifoAllocate.html">ncFifoAllocate()</a>, <a href="ncFifoDestroy.html">ncFifoDestroy()</a>, <a href="ncFifoWriteElem.html">ncFifoWriteElem()</a>, <a href="ncFifoReadElem.html">ncFifoReadElem()</a>, <a href="ncFifoRemoveElem.html">ncFifoRemoveElem()</a>, <a href="ncFifoGetOption.html">ncFifoGetOption()</a>, <a href="ncFifoSetOption.html">ncFifoSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>The <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct is an abstraction for a first in, first out queue (FIFO) that is used throughout the API.</p>
+
+<h2 id="typical-usage">Typical Usage</h2>
+<ul>
+  <li>Create and allocate input and output FIFOs with <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a> or <a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a>.
+    <ul>
+      <li>Alternatively, initialize <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> structs for input and output queues with <a href="ncFifoCreate.html">ncFifoCreate()</a> and then allocate each with <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.</li>
+    </ul>
+  </li>
+  <li>Write input tensors to an input FIFO with <a href="ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a> or <a href="ncFifoWriteElem.html">ncFifoWriteElem()</a>.</li>
+  <li>Read output tensors from an output FIFO with <a href="ncFifoReadElem.html">ncFifoReadElem()</a>.</li>
+  <li>When finished, destroy the FIFO handle and free associated resources with <a href="ncFifoDestroy.html">ncFifoDestroy()</a>.</li>
+</ul>
+
+<p>See the <a href="readme.html">C API Overview</a> for more information about typical API usage.</p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoOption_t.html b/docs/ncapi/ncapi2/c_api/ncFifoOption_t.html
new file mode 100644 (file)
index 0000000..5788d54
--- /dev/null
@@ -0,0 +1,160 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enum-ncfifooption_t">enum ncFifoOption_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncFifoGetOption.html">ncFifoGetOption()</a>, <a href="ncFifoSetOption.html">ncFifoSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The ncFifoOption_t enumeration defines FIFO options that can be read with <a href="ncFifoGetOption.html">ncFifoGetOption()</a> or set with <a href="ncFifoSetOption.html">ncFifoSetOption()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_RW_FIFO_TYPE</td>
+      <td>int</td>
+      <td>Values in the <a href="ncFifoType_t.html">ncFifoType_t</a> enumeration</td>
+      <td>The type of FIFO (read-only or write-only).</td>
+    </tr>
+    <tr>
+      <td>NC_RW_FIFO_CONSUMER_COUNT</td>
+      <td>int</td>
+      <td>1</td>
+      <td>The number of times an element must be read by a graph or the API before the element is removed <em>(default 1)</em>. The API can always only read once even if this is greater than 1.<br /><br /><em>Only 1 currently supported.</em></td>
+    </tr>
+    <tr>
+      <td>NC_RW_FIFO_DATA_TYPE</td>
+      <td>int</td>
+      <td>Values in the <a href="ncFifoDataType_t.html">ncFifoDataType_t</a> enumeration</td>
+      <td>The type of data that will be placed in the FIFO (default: 32FP).<br /><br />Regardless of the configured data types of the input and output FIFOs, the API will convert tensors to 16FP while performing inferences.</td>
+    </tr>
+    <tr>
+      <td>NC_RW_FIFO_DONT_BLOCK</td>
+      <td>int</td>
+      <td>0</td>
+      <td>0: <a href="ncFifoWriteElem.html">ncFifoWriteElem()</a> will block if the input FIFO queue is full and <a href="ncFifoReadElem.html">ncFifoReadElem()</a> will block if the output FIFO queue is empty <em>(default)</em>. <br />1: <em>Not yet implemented.</em></td>
+    </tr>
+    <tr>
+      <td>NC_RO_FIFO_CAPACITY</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The maximum number of elements the FIFO queue can hold. This is set with <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a> or <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_FIFO_READ_FILL_LEVEL</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The number of tensors (FIFO elements) in the queue for a readable FIFO.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_FIFO_WRITE_FILL_LEVEL</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The number of tensors (FIFO elements) in the queue for a writable FIFO.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_FIFO_TENSOR_DESCRIPTOR</td>
+      <td><a href="ncTensorDescriptor_t.html">struct ncTensorDescriptor_t</a>*</td>
+      <td>N/A</td>
+      <td>A pointer to the FIFO’s ncTensorDescriptor_t struct, which describes the shape of tensors that this FIFO will hold. This is set with <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a> or <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_FIFO_STATE</td>
+      <td>int</td>
+      <td>Values in the <a href="ncFifoState_t.html">ncFifoState_t</a> enumeration</td>
+      <td>The state of the FIFO and the associated <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_FIFO_NAME</td>
+      <td>char[ ]</td>
+      <td>FIFO name</td>
+      <td>A null-terminated character array containing the name of the FIFO that was set with <a href="ncFifoCreate.html">ncFifoCreate()</a>. The maximum size of this array is NC_MAX_NAME_SIZE.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_FIFO_ELEMENT_DATA_SIZE</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The data size of one FIFO element in bytes.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li><strong>Options prefixed with ‘NC_RW’ have read/write permission and are both gettable and settable.</strong></li>
+  <li><strong>Options prefixed with ‘NC_RO’ have read-only permission and are only gettable.</strong></li>
+  <li><strong>All settable FIFO options must be set before <a href="ncFifoAllocate.html">ncFifoAllocate()</a> is called for the <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct.</strong></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoReadElem.html b/docs/ncapi/ncapi2/c_api/ncFifoReadElem.html
new file mode 100644 (file)
index 0000000..8d5ad1e
--- /dev/null
@@ -0,0 +1,210 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncfiforeadelem">ncFifoReadElem()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncGraphQueueInference.html">ncGraphQueueInference()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function reads an element from a FIFO, usually the result of an inference, along with the associated user-defined data that was passed to <a href="ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a> or <a href="ncFifoWriteElem.html">ncFifoWriteElem()</a>.</p>
+
+<p>This will also remove the element from the queue.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncFifoReadElem</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">fifoHandle</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span> <span class="n">outputData</span><span class="p">,</span>
+                          <span class="kt">unsigned</span> <span class="kt">int</span><span class="o">*</span> <span class="n">outputDataLen</span><span class="p">,</span> <span class="kt">void</span><span class="o">**</span> <span class="n">userParam</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>fifo</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>*</td>
+      <td>A pointer to the ncFifoHandle_t struct for the FIFO. The FIFO state must be <a href="ncFifoType_t.html">NC_FIFO_ALLOCATED</a>.</td>
+    </tr>
+    <tr>
+      <td>outputData</td>
+      <td>void*</td>
+      <td>A pointer to a buffer into which the result of the inference will be copied. The buffer will contain data in the format specified by the FIFO’s <a href="ncFifoOption_t.html">NC_RW_FIFO_DATA_TYPE</a> option.</td>
+    </tr>
+    <tr>
+      <td>outputDataLen</td>
+      <td>unsigned int*</td>
+      <td>A pointer to an unsigned int that contains the size, in bytes, of the buffer allocated to the outputData parameter.<br /><br />Upon normal return (status code NC_OK), the unsigned int pointed to by dataLength will be set to the number of bytes copied to the data buffer. In the event that the data buffer was an insufficient size to hold the outputData, the return status code will be NC_INVALID_DATA_LENGTH and the unsigned int pointed to by dataLength will be set to the size required.</td>
+    </tr>
+    <tr>
+      <td>userParam</td>
+      <td>void**</td>
+      <td>Address of a pointer that will be set to point to the user-defined data for this inference. This corresponds to the userParam that was passed when data was written to the input FIFO with <a href="ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a> or <a href="ncFifoWriteElem.html">ncFifoWriteElem()</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="ncFifoType_t.html">ncFifoType_t</a> set during FIFO creation must allow read access for the API.</li>
+  <li>The FIFO can not be written to or read from until it has been allocated with <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>/<a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> or <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.</li>
+  <li>The API can only read each element once even if <a href="ncFifoOption_t.html">NC_RW_FIFO_CONSUMER_COUNT</a> is greater than 1.</li>
+  <li>This is a blocking call if <a href="ncFifoOption_t.html">NC_RW_FIFO_DONT_BLOCK</a> is false. If the FIFO is empty this function will not return until there is an element to read.
+    <ul>
+      <li>You can check the current fill level of the FIFO with <a href="ncFifoGetOption.html">ncFifoGetOption()</a> for <a href="ncFifoOption_t.html">NC_RO_FIFO_READ_FILL_LEVEL</a>.</li>
+      <li>After an inference is queued there is a delay while device communication occurs and the inference is performed before the element is removed from the input FIFO and placed into the output FIFO.</li>
+    </ul>
+  </li>
+  <li>If you don’t know what value to use for outputDataLen, you can call this function once with an outputDataLen of 0 to have outputDataLen be set to the correct value, and then call this function again to get the output result in outputData.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="kt">float</span> <span class="n">networkMean</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span><span class="mi">0</span><span class="p">.</span><span class="mi">40787054</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">.</span><span class="mi">45752458</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">.</span><span class="mi">48109378</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">};</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">inTensorDesc</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">outTensorDesc</span><span class="p">;</span>
+    <span class="kt">float</span><span class="o">*</span> <span class="n">imageInMemoryPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionSize</span><span class="p">;</span>
+
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphSizeInBytes</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadGraphFile</span><span class="p">(</span><span class="s">"./graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">ncGraphAllocate</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">graphInMemoryPtr</span><span class="p">,</span> <span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphInMemoryPtr</span><span class="p">);</span>
+
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Input FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+    
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Output FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_RO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">networkDim</span> <span class="o">=</span> <span class="mi">224</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">numChannels</span> <span class="o">=</span> <span class="mi">3</span><span class="p">;</span>
+    <span class="n">imageInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadImage32</span><span class="p">(</span><span class="s">"./my_image.png"</span><span class="p">,</span> <span class="n">networkDim</span><span class="p">,</span> <span class="n">networkMean</span><span class="p">);</span>
+    <span class="n">imageSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">float</span><span class="p">)</span> <span class="o">*</span> <span class="n">networkDim</span> <span class="o">*</span> <span class="n">networkDim</span> <span class="o">*</span> <span class="n">numChannels</span><span class="p">;</span>
+    <span class="n">ncFifoWriteElem</span><span class="p">(</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="n">imageInMemoryPtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">imageSize</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">imageInMemoryPtr</span><span class="p">);</span>
+
+    <span class="n">ncGraphQueueInference</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
+
+    <span class="kt">void</span><span class="o">*</span> <span class="n">outputPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">fifoOutputSize</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionDataLen</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="p">);</span>
+    <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_FIFO_ELEMENT_DATA_SIZE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionDataLen</span><span class="p">);</span>
+    <span class="n">outputPtr</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>
+    <span class="n">ncFifoReadElem</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">outputPtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Could not read FIFO element</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error reading FIFO element [%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>   <span class="c1">// outputPtr now points to the result of the inference</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully read FIFO element</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>        
+    <span class="p">}</span>
+    
+    <span class="c1">// use the output, then free it</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">outputPtr</span><span class="p">);</span>
+    <span class="n">outputPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    
+    <span class="c1">// clean up the graph and device</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoRemoveElem.html b/docs/ncapi/ncapi2/c_api/ncFifoRemoveElem.html
new file mode 100644 (file)
index 0000000..28f7526
--- /dev/null
@@ -0,0 +1,117 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncfiforemoveelem">ncFifoRemoveElem()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncFifoReadElem.html">ncFifoReadElem()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p><strong>This function is not yet implemented.</strong></p>
+
+<p>This function removes an element from a FIFO when more control is required with regard to queue management.</p>
+
+<p>For the general case when an element is read from a FIFO using <a href="ncFifoWriteElem.html">ncFifoWriteElem()</a> it is also removed.</p>
+
+<h2 id="prototype">Prototype</h2>
+<p><strong>This function is not yet implemented.</strong></p>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncFifoRemoveElem</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">fifoHandle</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>fifoHandle</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>*</td>
+      <td>A pointer to the ncFifoHandle_t struct for the FIFO. The FIFO state must be <a href="ncFifoType_t.html">NC_FIFO_ALLOCATED</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li><strong>Not yet implemented</strong></li>
+</ul>
+
+<h2 id="example">Example</h2>
+<p>N/A</p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoSetOption.html b/docs/ncapi/ncapi2/c_api/ncFifoSetOption.html
new file mode 100644 (file)
index 0000000..f382766
--- /dev/null
@@ -0,0 +1,189 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncfifosetoption">ncFifoSetOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncFifoOption_t.html">ncFifoOption_t</a>, <a href="ncFifoGetOption.html">ncFifoGetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function sets an option value for a FIFO. The available options and possible values can be found in the <a href="ncFifoOption_t.html">ncFifoOption_t</a> enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncFifoSetOption</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">fifoHandle</span><span class="p">,</span> 
+                            <span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span> <span class="n">data</span><span class="p">,</span>
+                            <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLength</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>fifoHandle</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>*</td>
+      <td>A pointer to an ncFifoHandle_t struct for the FIFO for which the option value will be set. The FIFO state must be <a href="ncFifoState_t.html">NC_FIFO_CREATED</a>.</td>
+    </tr>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the <a href="ncFifoOption_t.html">ncFifoOption_t</a> enumeration that specifies which option’s value will be set.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>const void*</td>
+      <td>A pointer to a buffer containing the new value for the option.<br /><br />The type of data this points to depends on the option that is specified. Check <a href="ncFifoOption_t.html">ncFifoOption_t</a> for the data types that each option requires.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int</td>
+      <td>An unsigned int that contains the length, in bytes, of the buffer that the data parameter points to.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>All settable <a href="ncFifoOption_t.html">ncFifoOption_t</a> options must be set before calling <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.
+    <ul>
+      <li>Using <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>/<a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> to create and allocate FIFOS does not allow for any FIFO options to be set other than those specified in the function’s parameters.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">inTensorDesc</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">outTensorDesc</span><span class="p">;</span>
+    <span class="kt">float</span><span class="o">*</span> <span class="n">imageInMemoryPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionSize</span><span class="p">;</span>
+
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphSizeInBytes</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadGraphFile</span><span class="p">(</span><span class="s">"./graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">ncGraphAllocate</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">graphInMemoryPtr</span><span class="p">,</span> <span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphInMemoryPtr</span><span class="p">);</span>
+
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Input FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+
+    <span class="cm">/* crete fifo with WO type */</span>
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Output FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+
+    <span class="cm">/* set the fifo option to change to RO type */</span>
+    <span class="n">ncFifoType_t</span> <span class="n">newFifoType</span> <span class="o">=</span> <span class="n">NC_FIFO_HOST_RO</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLen</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncFifoType_t</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoSetOption</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">NC_RW_FIFO_TYPE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">newFifoType</span><span class="p">,</span> <span class="n">dataLen</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Could not get FIFO option</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error setting FIFO option [%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Set FIFO option NC_RW_FIFO_TYPE, it is: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">newFifoType</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+
+    <span class="c1">// clean up the graph and device</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoState_t.html b/docs/ncapi/ncapi2/c_api/ncFifoState_t.html
new file mode 100644 (file)
index 0000000..e274ca2
--- /dev/null
@@ -0,0 +1,93 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enum-ncfifostate_t">enum ncFifoState_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoGetOption.html">ncFifoGetOption()</a>, <a href="ncFifoSetOption.html">ncFifoSetOption()</a>, <a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The ncFifoState_t enumeration defines states of a FIFO and associated <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct, which can be read with <a href="ncFifoGetOption.html">ncFifoGetOption()</a></p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_FIFO_CREATED</td>
+      <td>The <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct has been initialized with <a href="ncFifoCreate.html">ncFifoCreate()</a> but the FIFO has not been allocated for a device.</td>
+    </tr>
+    <tr>
+      <td>NC_FIFO_ALLOCATED</td>
+      <td>The FIFO handle has been initialized, and the FIFO has been allocated for a device with <a href="ncFifoAllocate.html">ncFifoAllocate()</a> or <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoType_t.html b/docs/ncapi/ncapi2/c_api/ncFifoType_t.html
new file mode 100644 (file)
index 0000000..e9c2d92
--- /dev/null
@@ -0,0 +1,93 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enum-ncfifotype_t">enum ncFifoType_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoOption_t.html">ncFifoOption_t</a>, <a href="ncFifoGetOption.html">ncFifoGetOption()</a>, <a href="ncFifoSetOption.html">ncFifoSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>FifoType is an enumeration that defines FIFO access types, which can be read with <a href="ncFifoGetOption.html">ncFifoGetOption()</a> or set with <a href="ncFifoSetOption.html">ncFifoSetOption()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_FIFO_HOST_RO</td>
+      <td>API can only read. Graphs can read/write.<br /><br />This type should be used for output FIFOs.</td>
+    </tr>
+    <tr>
+      <td>NC_FIFO_HOST_WO</td>
+      <td>API can only write. Graph can only read.<br /><br />This type should be used for input FIFOs.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncFifoWriteElem.html b/docs/ncapi/ncapi2/c_api/ncFifoWriteElem.html
new file mode 100644 (file)
index 0000000..5f8c229
--- /dev/null
@@ -0,0 +1,207 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncfifowriteelem">ncFifoWriteElem()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncFifoReadElem.html">ncFifoReadElem()</a>, <a href="ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function writes an element to a FIFO, usually an input tensor for inference.</p>
+
+<p>After the tensor data is written to the FIFO, an inference can be queued with <a href="ncGraphQueueInference.html">ncGraphQueueInference()</a>. Alternatively, <a href="ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a> can be used to write the tensor to the input FIFO and queue the inference in one call.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncFifoWriteElem</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">fifoHandle</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span> <span class="n">inputTensor</span><span class="p">,</span>
+                           <span class="kt">unsigned</span> <span class="kt">int</span><span class="o">*</span> <span class="n">inputTensorLength</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span> <span class="n">userParam</span><span class="p">);</span>
+</code></pre></div></div>
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>fifoHandle</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>*</td>
+      <td>A pointer to the ncFifoHandle_t struct for the FIFO. The FIFO state must be <a href="ncFifoType_t.html">NC_FIFO_ALLOCATED</a>.</td>
+    </tr>
+    <tr>
+      <td>inputTensor</td>
+      <td>const void*</td>
+      <td>A pointer to a tensor data buffer that contains data in the format specified by the FIFO’s <a href="ncFifoDataType_t.html">NC_RW_FIFO_DATA_TYPE</a> option.  This data is typically a representation of each color channel in each pixel of an image.</td>
+    </tr>
+    <tr>
+      <td>inputTensorLength</td>
+      <td>unsigned int*</td>
+      <td>A pointer to an unsigned int that contains the length, in bytes, of the buffer that the inputTensor parameter points to.<br /><br />If the size of the input tensor does not match the expected input size for this FIFO, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and inputTensorLength will be set to the expected input size.</td>
+    </tr>
+    <tr>
+      <td>userParam</td>
+      <td>void*</td>
+      <td>A pointer to additional user data to associate with the input tensor, or NULL. The pointer value (not the data that it points to) will be copied, stored, and then returned with the inference result with <a href="ncFifoReadElem.html">ncFifoReadElem()</a>. This pointer can point to anything that the caller would like to associate with the inference result, such as the original inference input or a window handle. The caller is responsible for allocating and freeing any memory that this pointer references.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<p>If the size of the input tensor does not match the expected input size for this FIFO, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and the inputTensorLength will be set to the expected input size.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="ncFifoType_t.html">ncFifoType_t</a> set during FIFO creation must allow write access for the API.</li>
+  <li>The FIFO can not be written to or read from until it has been allocated with <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>/<a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> or <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.</li>
+  <li>This is a blocking call if <a href="ncFifoOption_t.html">NC_RW_FIFO_DONT_BLOCK</a> is false. If the FIFO is full this function will not return until there is space to successfully write.
+    <ul>
+      <li>The FIFO’s capacity is set when the FIFO is allocated with <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>/<a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> or <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.</li>
+      <li>You can check the capacity and the current fill level of the FIFO with <a href="ncFifoGetOption.html">ncFifoGetOption()</a> for <a href="ncFifoOption_t.html">NC_RO_FIFO_CAPACITY</a> and <a href="ncFifoOption_t.html">NC_RO_FIFO_WRITE_FILL_LEVEL</a>.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="kt">float</span> <span class="n">networkMean</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span><span class="mi">0</span><span class="p">.</span><span class="mi">40787054</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">.</span><span class="mi">45752458</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">.</span><span class="mi">48109378</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">};</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">inTensorDesc</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">outTensorDesc</span><span class="p">;</span>
+    <span class="kt">float</span><span class="o">*</span> <span class="n">imageInMemoryPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionSize</span><span class="p">;</span>
+
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphSizeInBytes</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadGraphFile</span><span class="p">(</span><span class="s">"./graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">ncGraphAllocate</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">graphInMemoryPtr</span><span class="p">,</span> <span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphInMemoryPtr</span><span class="p">);</span>
+
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Input FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+    
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Output FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_RO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">networkDim</span> <span class="o">=</span> <span class="mi">224</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">numChannels</span> <span class="o">=</span> <span class="mi">3</span><span class="p">;</span>
+    <span class="n">imageInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadImage32</span><span class="p">(</span><span class="s">"./my_image.png"</span><span class="p">,</span> <span class="n">networkDim</span><span class="p">,</span> <span class="n">networkMean</span><span class="p">);</span>
+    <span class="n">imageSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">float</span><span class="p">)</span> <span class="o">*</span> <span class="n">networkDim</span> <span class="o">*</span> <span class="n">networkDim</span> <span class="o">*</span> <span class="n">numChannels</span><span class="p">;</span>
+    <span class="n">ncFifoWriteElem</span><span class="p">(</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="n">imageInMemoryPtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">imageSize</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">imageInMemoryPtr</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   <span class="c1">// Could not write FIFO element</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error writing FIFO element [%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="c1">// the input FIFO now has the input data for an inference.  </span>
+    <span class="c1">// now we can Queue the inference to be started</span>
+    <span class="n">printf</span><span class="p">(</span><span class="s">"Successfully wrote FIFO element</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>        
+
+    <span class="n">ncGraphQueueInference</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
+
+    <span class="kt">void</span><span class="o">*</span> <span class="n">outputPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">fifoOutputSize</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionDataLen</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="p">);</span>
+    <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_FIFO_ELEMENT_DATA_SIZE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionDataLen</span><span class="p">);</span>
+    <span class="n">outputPtr</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>
+    <span class="n">ncFifoReadElem</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">outputPtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">outputPtr</span><span class="p">);</span>
+
+
+    <span class="c1">// clean up the graph and device</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGlobalGetOption.html b/docs/ncapi/ncapi2/c_api/ncGlobalGetOption.html
new file mode 100644 (file)
index 0000000..ca45e4c
--- /dev/null
@@ -0,0 +1,198 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncglobalgetoption">ncGlobalGetOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGlobalOption_t.html">ncGlobalOption_t</a>, <a href="ncGlobalSetOption.html">ncGlobalSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function gets the value of a global option. The available options and possible values can be found in the <a href="ncGlobalOption_t.html">ncGlobalOption_t</a> enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGlobalGetOption</span><span class="p">(</span><span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span> <span class="n">data</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span><span class="o">*</span> <span class="n">dataLength</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the <a href="ncGlobalOption_t.html">ncGlobalOption_t</a> enumeration that specifies which option’s value will be retrieved.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>void*</td>
+      <td>A pointer to a buffer where the value of the option will be copied. The size and type of data this points to will depend on the option that is specified. See <a href="ncGlobalOption_t.html">ncGlobalOption_t</a> for option data types.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int*</td>
+      <td>A pointer to an unsigned int which contains the size, in bytes, of the buffer allocated by the caller for the data parameter.<br /><br />Upon normal return (status code <a href="ncStatus_t.html">NC_OK</a>), dataLength will be set to the number of bytes copied to the data buffer. In the event that the data buffer was an insufficient size to hold the option value, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and dataLength will be set to the size required to hold the option value.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<p>If the data buffer was an insufficient size to hold the option value, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and dataLength will be set to the size required to hold the option value.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>If you don’t know what value to use for dataLength, you can call this function once with a dataLength of 0 to have dataLength be set to the correct value and then allocate a correctly sized buffer and call this function again. See the example below.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<p>Get an option value when you know the correct data length:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;mvnc.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> 
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="kt">int</span> <span class="n">logLevel</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLength</span><span class="p">;</span>
+
+    <span class="cm">/* Get the logging level option value */</span>
+    <span class="n">dataLength</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">logLevel</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGlobalGetOption</span><span class="p">(</span><span class="n">NC_RW_LOG_LEVEL</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">logLevel</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dataLength</span><span class="p">);</span>
+
+    <span class="cm">/* retCode should be NC_OK unless there was a problem */</span>
+    <span class="k">if</span><span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="cm">/* Use the log level as needed */</span>
+    <span class="n">printf</span><span class="p">(</span><span class="s">"LOGGING LEVEL IS %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">logLevel</span><span class="p">);</span>
+    
+    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+<p>Get an option value when you don’t know the correct data length:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;mvnc.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> 
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span><span class="o">*</span> <span class="n">apiVersion</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLength</span><span class="p">;</span>
+
+    <span class="cm">/* Call once to get the correct dataLength */</span>
+    <span class="n">apiVersion</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="n">dataLength</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGlobalGetOption</span><span class="p">(</span><span class="n">NC_RO_API_VERSION</span><span class="p">,</span> <span class="n">apiVersion</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dataLength</span><span class="p">);</span>
+
+    <span class="cm">/* retCode should be NC_INVALID_DATA_LENGTH unless there was another problem */</span>
+    <span class="k">if</span><span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_INVALID_DATA_LENGTH</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="cm">/* Now the value of dataLength is correctly set (in this case for an array of 4 unsigned ints) */</span>
+    <span class="cm">/* Allocate the array buffer */</span>
+    <span class="n">apiVersion</span> <span class="o">=</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="o">*</span><span class="p">)</span><span class="n">malloc</span><span class="p">(</span><span class="n">dataLength</span><span class="p">);</span>
+
+    <span class="cm">/* Call the function again to get the API version option value */</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGlobalGetOption</span><span class="p">(</span><span class="n">NC_RO_API_VERSION</span><span class="p">,</span> <span class="n">apiVersion</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dataLength</span><span class="p">);</span>
+    
+    <span class="cm">/* Now retCode should be NC_OK unless there was another problem */</span>
+    <span class="k">if</span><span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="cm">/* Use the API version as needed */</span>
+    <span class="n">printf</span><span class="p">(</span><span class="s">"API VERSION - Major: %d, Minor: %d, Hotfix: %d, Release: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">apiVersion</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">apiVersion</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">apiVersion</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">apiVersion</span><span class="p">[</span><span class="mi">3</span><span class="p">]);</span>
+
+    <span class="cm">/* When you are done, free it and set the pointer to NULL */</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">apiVersion</span><span class="p">);</span>
+    <span class="n">apiVersion</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    
+    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGlobalOption_t.html b/docs/ncapi/ncapi2/c_api/ncGlobalOption_t.html
new file mode 100644 (file)
index 0000000..9e96e5d
--- /dev/null
@@ -0,0 +1,105 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enum-ncglobaloption_t">enum ncGlobalOption_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGlobalGetOption.html">ncGlobalGetOption()</a>, <a href="ncGlobalSetOption.html">ncGlobalSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The ncGlobalOption_t enumeration defines application-level options that can be read with <a href="ncGlobalGetOption.html">ncGlobalGetOpion()</a> or set with <a href="ncGlobalSetOption.html">ncGlobalSetOption()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_RW_LOG_LEVEL</td>
+      <td>int</td>
+      <td>0, 1, 2, 3, 4</td>
+      <td>The logging level for the application:<br />0 = MVLOG_DEBUG, debug and above (full verbosity)<br />1 = MVLOG_INFO, info and above<br />2 = MVLOG_WARN, warnings and above <em>(default)</em> <br />3 = MVLOG_ERROR, errors and above<br />4 = MVLOG_FATAL, fatal only</td>
+    </tr>
+    <tr>
+      <td>NC_RO_API_VERSION</td>
+      <td>unsigned int[4]</td>
+      <td>[<em>major, minor, hotfix, release</em>]</td>
+      <td>The API version.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li><strong>Options prefixed with ‘NC_RW’ have read/write permission and are both gettable and settable.</strong></li>
+  <li><strong>Options prefixed with ‘NC_RO’ have read-only permission and are only gettable.</strong></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGlobalSetOption.html b/docs/ncapi/ncapi2/c_api/ncGlobalSetOption.html
new file mode 100644 (file)
index 0000000..30dce87
--- /dev/null
@@ -0,0 +1,142 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncglobalsetoption">ncGlobalSetOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGlobalOption_t.html">ncGlobalOption_t</a>, <a href="ncGlobalGetOption.html">ncGlobalGetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function sets a global option value. The available options and possible values can be found in the <a href="ncGlobalOption_t.html">ncGlobalOption_t</a> enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGlobalSetOption</span><span class="p">(</span><span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span> <span class="n">data</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLength</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the <a href="ncGlobalOption_t.html">ncGlobalOption_t</a> enumeration that specifies which option’s value will be set.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>const void*</td>
+      <td>A pointer to a buffer containing the new value for the option.<br /><br />The type of data this points to depends on the option that is specified.  Check <a href="ncGlobalOption_t.html">ncGlobalOption_t</a> for the data types that each option requires.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int</td>
+      <td>An unsigned int that contains the length, in bytes, of the buffer that the data parameter points to.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<p>None.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span> <span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+        <span class="kt">int</span> <span class="n">loggingLevel</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+        <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">len</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">int</span><span class="p">);</span>
+        <span class="n">ncStatus_t</span> <span class="n">status</span><span class="p">;</span>
+
+        <span class="n">status</span> <span class="o">=</span> <span class="n">ncGlobalSetOption</span><span class="p">(</span><span class="n">NC_RW_LOG_LEVEL</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">loggingLevel</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">int</span><span class="p">));</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">status</span> <span class="o">==</span> <span class="n">NC_OK</span><span class="p">)</span>
+        <span class="p">{</span>
+                <span class="c1">// loggingLevel option successfully set.</span>
+                <span class="n">printf</span><span class="p">(</span><span class="s">"Logging level set to: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">loggingLevel</span><span class="p">);</span>
+        <span class="p">}</span>
+
+        <span class="n">status</span> <span class="o">=</span> <span class="n">ncGlobalGetOption</span><span class="p">(</span><span class="n">NC_RW_LOG_LEVEL</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">loggingLevel</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">len</span><span class="p">);</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">status</span> <span class="o">==</span> <span class="n">NC_OK</span><span class="p">)</span>
+        <span class="p">{</span>
+                <span class="c1">// loggingLevel should be set to the option value now.</span>
+                <span class="n">printf</span><span class="p">(</span><span class="s">"Logging level is: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">loggingLevel</span><span class="p">);</span>
+        <span class="p">}</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphAllocate.html b/docs/ncapi/ncapi2/c_api/ncGraphAllocate.html
new file mode 100644 (file)
index 0000000..46f971a
--- /dev/null
@@ -0,0 +1,168 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncgraphallocate">ncGraphAllocate()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncGraphCreate.html">ncGraphCreate()</a>, <a href="ncGraphDestroy.html">ncGraphDestroy()</a>, <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>, <a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function allocates a network graph to the specified device. Each graph can only be allocated to a single device.</p>
+
+<p>Upon successful return from this function, the graph will be ready to perform inferences.</p>
+
+<p><a href="ncGraphDestroy.html">ncGraphDestroy()</a> frees the memory allocated with this function.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGraphAllocate</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncDeviceHandle_t</span> <span class="o">*</span><span class="n">deviceHandle</span><span class="p">,</span>
+                           <span class="k">struct</span> <span class="n">ncGraphHandle_t</span> <span class="o">*</span><span class="n">graphHandle</span><span class="p">,</span>
+                           <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">graphBuffer</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphBufferLength</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>*</td>
+      <td>A pointer to an <a href="ncDeviceCreate.html">initialized</a> and <a href="ncDeviceOpen.html">opened</a> ncDeviceHandle_t struct for the device to which the graph will be allocated. The device state must be <a href="ncDeviceState_t.html">NC_DEVICE_OPENED</a>.</td>
+    </tr>
+    <tr>
+      <td>graphHandle</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>*</td>
+      <td>A pointer to an <a href="ncGraphCreate.html">initialized</a> ncGraphHandle_t struct for the graph that will be allocated. The graph state must be <a href="ncGraphState_t.html">NC_GRAPH_CREATED</a>.</td>
+    </tr>
+    <tr>
+      <td>graphBuffer</td>
+      <td>const void*</td>
+      <td>A pointer to a buffer that contains raw data read from a neural network graph file that was created with the NCSDK <a href="../../../tools/compile.html">mvNCCompile</a> tool.</td>
+    </tr>
+    <tr>
+      <td>graphBufferLength</td>
+      <td>unsigned int</td>
+      <td>The size, in bytes, of the buffer allocated to the graphBuffer parameter.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The initialized <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct must be passed to this function or <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>/<a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> before it can be passed to any API function other than <a href="ncGraphGetOption.html">ncGraphGetOption()</a> or <a href="ncGraphSetOption.html">ncGraphSetOption()</a>. When the graph has been allocated, the graph state will be <a href="ncGraphState_t.html">NC_GRAPH_ALLOCATED</a>.</li>
+  <li><a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a> or <a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> can be used to easily initialize and allocate an input and an output FIFO in addition to allocating a graph to a device; these internally call <a href="ncFifoCreate.html">ncFifoCreate()</a> and <a href="ncFifoAllocate.html">ncFifoAllocate()</a> for both <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> structs and <a href="ncGraphAllocate.html">ncGraphAllocate()</a> for the graph.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span><span class="p">;</span>
+    
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphSizeInBytes</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadGraphFile</span><span class="p">(</span><span class="s">"./graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphSizeInBytes</span><span class="p">);</span>
+
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphAllocate</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">graphInMemoryPtr</span><span class="p">,</span> <span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   
+        <span class="c1">// Could not allocate graph </span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error allocating graph [%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="c1">// Graph is allocated and can be used for inference now.</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Graph allocated OK!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="c1">// clean up the graph and device</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphAllocateWithFifos.html b/docs/ncapi/ncapi2/c_api/ncGraphAllocateWithFifos.html
new file mode 100644 (file)
index 0000000..aad6e5e
--- /dev/null
@@ -0,0 +1,213 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncgraphallocatewithfifos">ncGraphAllocateWithFifos()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncGraphCreate.html">ncGraphCreate()</a>, <a href="ncGraphAllocate.html">ncGraphAllocate()</a>, <a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a>, <a href="ncGraphDestroy.html">ncGraphDestroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function allocates a graph and creates and allocates associated FIFOs.  This is a convenient way to set up inferences on a graph without setting up FIFOs explicitly.</p>
+
+<p>This function internally calls <a href="ncFifoCreate.html">ncFifoCreate()</a> and <a href="ncFifoAllocate.html">ncFifoAllocate()</a> with the following FIFO options:</p>
+<ul>
+  <li>Maximum number of elements = 2</li>
+  <li><a href="ncFifoDataType_t.html">FifoDataType_t</a> = NC_FIFO_FP32</li>
+  <li>Input <a href="ncFifoType_t.html">ncFifoType_t</a> = NC_FIFO_HOST_WO</li>
+  <li>Output <a href="ncFifoType_t.html">ncFifoType_t</a> = NC_FIFO_HOST_RO</li>
+</ul>
+
+<p><a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> can be used instead to set FIFO options explicitly.</p>
+
+<p>Calling <a href="ncGraphDestroy.html">ncGraphDestroy()</a> for the graph and <a href="ncFifoDestroy.html">ncFifoDestroy()</a> for each FIFO frees the memory allocated with this function.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGraphAllocateWithFifos</span><span class="p">(</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">,</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">,</span>
+    <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">graphBuffer</span><span class="p">,</span> 
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphBufferLength</span><span class="p">,</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">**</span> <span class="n">inFifoHandle</span><span class="p">,</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">**</span> <span class="n">outFifoHandle</span>
+<span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>*</td>
+      <td>A pointer to an <a href="ncDeviceCreate.html">initialized</a> and <a href="ncDeviceOpen.html">opened</a> ncDeviceHandle_t struct for the device to which the graph and FIFOs will be allocated. The device state must be <a href="ncDeviceState_t.html">NC_DEVICE_OPENED</a>.</td>
+    </tr>
+    <tr>
+      <td>graphHandle</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>*</td>
+      <td>A pointer to an <a href="ncGraphCreate.html">initialized</a> ncGraphHandle_t struct for the graph that will be allocated. The graph state must be <a href="ncGraphState_t.html">NC_GRAPH_CREATED</a>.</td>
+    </tr>
+    <tr>
+      <td>graphBuffer</td>
+      <td>const void*</td>
+      <td>A pointer to a buffer that contains raw data read from a neural network graph file that was created with the NCSDK <a href="../../../tools/compile.html">mvNCCompile</a> tool.</td>
+    </tr>
+    <tr>
+      <td>graphBufferLength</td>
+      <td>unsigned int</td>
+      <td>The size, in bytes, of the buffer allocated to the graphBuffer parameter.</td>
+    </tr>
+    <tr>
+      <td>inFifoHandle</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>**</td>
+      <td>The address of a pointer to a ncFifoHandle_t struct for the input FIFO that will be initialized and allocated by this function.</td>
+    </tr>
+    <tr>
+      <td>outFifoHandle</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>**</td>
+      <td>The address of a pointer to a ncFifoHandle_t struct for the output FIFO that will be initialized and allocated by this function.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>This function takes the place of explicit calls to <a href="ncGraphAllocate.html">ncGraphAllocate()</a>, <a href="ncFifoCreate.html">ncFifoCreate()</a>, and <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.</li>
+  <li>The <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct must be passed to <a href="ncGraphCreate.html">ncGraphCreate()</a> and then this function or <a href="ncGraphAllocate.html">ncGraphAllocate()</a>/<a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> before it can be passed to any API function other than <a href="ncGraphGetOption.html">ncGraphGetOption()</a> or <a href="ncGraphSetOption.html">ncGraphSetOption()</a>. When the graph has been allocated, the graph state will be <a href="ncGraphState_t.html">NC_GRAPH_ALLOCATED</a>.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+    <span class="c1">// You can check that this return code is equal to NC_OK after each API function call</span>
+    <span class="c1">// This is omitted in this example for better readability</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+
+    <span class="c1">// Initialize and open a device</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+
+    <span class="c1">// Load a graph from file</span>
+    <span class="c1">// void* graphBuffer = ...</span>
+    <span class="c1">// unsigned int graphBufferLength = ...</span>
+    
+    <span class="c1">// Initialize the graph</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"graph1"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+       
+    <span class="c1">// CONVENIENCE FUNCTION: Allocate the graph to the device and create input/output FIFOs with default options</span>
+    <span class="c1">// Alternatively, use ncGraphAllocateWithFifosEx() to do this with explicit FIFO options</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inputFIFO</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outputFIFO</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphAllocateWithFifos</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="n">graphHandle</span><span class="p">,</span> <span class="n">graphBuffer</span><span class="p">,</span> <span class="n">graphBufferLength</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphBuffer</span><span class="p">);</span>
+
+    <span class="c1">// Read and preprocess input...</span>
+    <span class="c1">// float* imageBuffer = ...</span>
+    <span class="c1">// unsigned int imageBufferLength = ...</span>
+
+    <span class="c1">// Write the image to the input FIFO and queue the inference</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphQueueInferenceWithFifoElem</span><span class="p">(</span>
+                    <span class="n">graphHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">,</span>
+                    <span class="n">imageBuffer</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">imageBufferLength</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>    
+    
+    <span class="c1">// Get the results from the output FIFO</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">result</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">fifoOutputSize</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionDataLen</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>
+    <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_FIFO_ELEMENT_DATA_SIZE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionDataLen</span><span class="p">);</span>
+    <span class="n">result</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>    
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoReadElem</span><span class="p">(</span><span class="n">outputFIFO</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">result</span><span class="p">);</span>
+
+    <span class="c1">// Do something with the results...</span>
+
+    <span class="c1">// Clean up</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphAllocateWithFifosEx.html b/docs/ncapi/ncapi2/c_api/ncGraphAllocateWithFifosEx.html
new file mode 100644 (file)
index 0000000..93ebd8e
--- /dev/null
@@ -0,0 +1,243 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncgraphallocatewithfifosex">ncGraphAllocateWithFifosEx()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncGraphCreate.html">ncGraphCreate()</a>, <a href="ncGraphAllocate.html">ncGraphAllocate()</a>, <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>, <a href="ncGraphDestroy.html">ncGraphDestroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function allocates a graph and creates associated FIFOs.  This is a convenient way to set up inferences on a graph without setting up FIFOs explicitly.</p>
+
+<p>This function is similar to <a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifos()</a> but rather than making assumptions about the FIFOs that are created this function takes parameters to specify the size, type, and data types for them.</p>
+
+<p>Calling <a href="ncGraphDestroy.html">ncGraphDestroy()</a> for the graph and <a href="ncFifoDestroy.html">ncFifoDestroy()</a> for each FIFO frees the memory allocated with this function.</p>
+
+<h2 id="prototype">Prototype</h2>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGraphAllocateWithFifosEx</span><span class="p">(</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">,</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">,</span>
+    <span class="k">const</span> <span class="kt">void</span> <span class="o">*</span><span class="n">graphBuffer</span><span class="p">,</span> 
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphBufferLength</span><span class="p">,</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">**</span> <span class="n">inFifoHandle</span><span class="p">,</span> 
+    <span class="n">ncFifoType_t</span> <span class="n">inFifoType</span><span class="p">,</span>
+    <span class="kt">int</span> <span class="n">inNumElem</span><span class="p">,</span> 
+    <span class="n">ncFifoDataType_t</span> <span class="n">inDataType</span><span class="p">,</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">**</span> <span class="n">outFifoHandle</span><span class="p">,</span>  
+    <span class="n">ncFifoType_t</span> <span class="n">outFifoType</span><span class="p">,</span>
+    <span class="kt">int</span> <span class="n">outNumElem</span><span class="p">,</span> 
+    <span class="n">ncFifoDataType_t</span> <span class="n">outDataType</span>
+<span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>deviceHandle</td>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a>*</td>
+      <td>A pointer to an <a href="ncDeviceCreate.html">initialized</a> and <a href="ncDeviceOpen.html">opened</a> ncDeviceHandle_t struct for the device to which the graph and FIFOs will be allocated. The device state must be <a href="ncDeviceState_t.html">NC_DEVICE_OPENED</a>.</td>
+    </tr>
+    <tr>
+      <td>graphHandle</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>*</td>
+      <td>A pointer to an <a href="ncGraphCreate.html">initialized</a> ncGraphHandle_t struct for the graph that will be allocated. The graph state must be <a href="ncGraphState_t.html">NC_GRAPH_CREATED</a>.</td>
+    </tr>
+    <tr>
+      <td>graphBuffer</td>
+      <td>const void*</td>
+      <td>A pointer to a buffer that contains raw data read from a neural network graph file that was created with the NCSDK <a href="../../../tools/compile.html">mvNCCompile</a> tool.</td>
+    </tr>
+    <tr>
+      <td>graphBufferLength</td>
+      <td>unsigned int</td>
+      <td>The size, in bytes, of the buffer allocated to the graphBuffer parameter.</td>
+    </tr>
+    <tr>
+      <td>inFifoHandle</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>**</td>
+      <td>The address of a pointer to a ncFifoHandle_t struct for the input FIFO that will be initialized and allocated by this function.</td>
+    </tr>
+    <tr>
+      <td>inFifoType</td>
+      <td><a href="ncFifoType_t.html">ncFifoType_t</a></td>
+      <td>A value from the ncFifoType_t enumeration that specifies the FIFO access type. The API should be able to write to the input FIFO.</td>
+    </tr>
+    <tr>
+      <td>inNumElem</td>
+      <td>int</td>
+      <td>The maximum number of elements that the input FIFO will be able to contain.</td>
+    </tr>
+    <tr>
+      <td>inDataType</td>
+      <td><a href="ncFifoDataType_t.html">ncFifoDataType_t</a></td>
+      <td>A value from the ncFifoDataType_t enumeration that specifies the data type for input FIFO elements.</td>
+    </tr>
+    <tr>
+      <td>outFifoHandle</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>**</td>
+      <td>The address of a pointer to a ncFifoHandle_t struct for the output FIFO that will be initialized and allocated by this function.</td>
+    </tr>
+    <tr>
+      <td>outFifoType</td>
+      <td><a href="ncFifoType_t.html">ncFifoType_t</a></td>
+      <td>A value from the ncFifoType_t enumeration that specifies the FIFO access type. The API should be able to read from the output FIFO.</td>
+    </tr>
+    <tr>
+      <td>outNumElem</td>
+      <td>int</td>
+      <td>The maximum number of elements that the output FIFO will be able to contain.</td>
+    </tr>
+    <tr>
+      <td>outDataType</td>
+      <td><a href="ncFifoDataType_t.html">ncFifoDataType_t</a></td>
+      <td>A value from the ncFifoDataType_t enumeration that specifies the data type for output FIFO elements.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>This function takes the place of explicit calls to <a href="ncGraphAllocate.html">ncGraphAllocate()</a>, <a href="ncFifoCreate.html">ncFifoCreate()</a>, and <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.</li>
+  <li>The <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct must be passed to <a href="ncGraphCreate.html">ncGraphCreate()</a> and then this function or <a href="ncGraphAllocate.html">ncGraphAllocate()</a>/<a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a> before it can be passed to any API function other than <a href="ncGraphGetOption.html">ncGraphGetOption()</a> or <a href="ncGraphSetOption.html">ncGraphSetOption()</a>. When the graph has been allocated, the graph state will be <a href="ncGraphState_t.html">NC_GRAPH_ALLOCATED</a>.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+    <span class="c1">// You can check that this return code is equal to NC_OK after each API function call</span>
+    <span class="c1">// This is omitted in this example for better readability</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+
+    <span class="c1">// Initialize and open a device</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+
+    <span class="c1">// Load a graph from file</span>
+    <span class="c1">// void* graphBuffer = ...</span>
+    <span class="c1">// unsigned int graphBufferLength = ...</span>
+    
+    <span class="c1">// Initialize the graph</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"graph1"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+       
+    <span class="c1">// CONVENIENCE FUNCTION: Allocate the graph to the device and create input/output FIFOs with explicit options</span>
+    <span class="c1">// Alternatively, use ncGraphAllocateWithFifos() to do this with default FIFO options</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inputFIFO</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outputFIFO</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphAllocateWithFifosEx</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="n">graphHandle</span><span class="p">,</span> <span class="n">graphBuffer</span><span class="p">,</span> <span class="n">graphBufferLength</span><span class="p">,</span> 
+                                         <span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">,</span>  <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="n">NC_FIFO_FP16</span><span class="p">,</span>
+                                         <span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_RO</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="n">NC_FIFO_FP16</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphBuffer</span><span class="p">);</span>
+
+    <span class="c1">// Read and preprocess input...</span>
+    <span class="c1">// float* imageBuffer = ...</span>
+    <span class="c1">// unsigned int imageBufferLength = ...</span>
+
+    <span class="c1">// Write the image to the input FIFO and queue the inference</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphQueueInferenceWithFifoElem</span><span class="p">(</span>
+                    <span class="n">graphHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">,</span>
+                    <span class="n">imageBuffer</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">imageBufferLength</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>    
+    
+    <span class="c1">// Get the results from the output FIFO</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">result</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">fifoOutputSize</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionDataLen</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>
+    <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_FIFO_ELEMENT_DATA_SIZE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionDataLen</span><span class="p">);</span>
+    <span class="n">result</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>    
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoReadElem</span><span class="p">(</span><span class="n">outputFIFO</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">result</span><span class="p">);</span>
+
+    <span class="c1">// Do something with the results...</span>
+
+    <span class="c1">// Clean up</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphCreate.html b/docs/ncapi/ncapi2/c_api/ncGraphCreate.html
new file mode 100644 (file)
index 0000000..5d40163
--- /dev/null
@@ -0,0 +1,151 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncgraphcreate">ncGraphCreate()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>, <a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a>, <a href="ncGraphAllocate.html">ncGraphAllocate()</a>, <a href="ncGraphDestroy.html">ncGraphDestroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function initializes a <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct.</p>
+
+<p>Create a graph handle for each network graph. A neural compute device can have more than one graph allocated to it, but each graph can only be allocated to a single device.</p>
+
+<p><a href="ncGraphDestroy.html">ncGraphDestroy()</a> frees the memory that is allocated for the <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGraphCreate</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">name</span><span class="p">,</span> <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">**</span> <span class="n">graphHandle</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>name</td>
+      <td>const char*</td>
+      <td>A null-terminated array of characters that specify a name for the graph; this can be can be anything you like up to NC_MAX_NAME_SIZE characters, or just an empty string.<br /><br />The name can be retrieved later with <a href="ncGraphGetOption.html">ncGraphGetOption()</a>.</td>
+    </tr>
+    <tr>
+      <td>graphHandle</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>**</td>
+      <td>The address of a pointer to the <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct that will be created and initialized by this function.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct must be created and initialized with this function before being passed to any other API functions. When the graph handle is properly initialized, the graph state will be <a href="ncGraphState_t.html">NC_GRAPH_CREATED</a>.</li>
+  <li>After initialization, the <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct must be passed to <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>/<a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> or <a href="ncGraphAllocate.html">ncGraphAllocate()</a> before being passed to any API functions other than <a href="ncGraphGetOption.html">ncGraphGetOption()</a> or <a href="ncGraphSetOption.html">ncGraphSetOption()</a>.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span><span class="p">;</span>
+    
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+
+    <span class="c1">// Initialize the graph and give it a name.</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error creating graph[%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="c1">// Graph is initialized. User can now call ncGraphAllocate and then</span>
+        <span class="c1">// other API functions with the graph handle.</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Graph created OK!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="c1">// clean up the graph and device</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphDestroy.html b/docs/ncapi/ncapi2/c_api/ncGraphDestroy.html
new file mode 100644 (file)
index 0000000..4af3077
--- /dev/null
@@ -0,0 +1,137 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncgraphdestroy">ncGraphDestroy()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncGraphCreate.html">ncGraphCreate()</a>, <a href="ncGraphAllocate.html">ncGraphAllocate()</a>, <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>, <a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function destroys a handle for a graph and frees associated resources. This function must be called for every graph handle that was initialized with <a href="ncGraphCreate.html">ncGraphCreate()</a>.</p>
+
+<p>Upon successful return, the <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct pointer will be set to NULL.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">**</span> <span class="n">graphHandle</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphHandle</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>**</td>
+      <td>The address of a pointer to an <a href="ncGraphCreate.html">initialized</a> ncGraphHandle_t struct.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<p>None.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span><span class="p">;</span>
+
+    <span class="c1">// Create a graph</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+
+    <span class="c1">// Allocate the graph on a device then queue inferences</span>
+    
+
+    <span class="c1">// When done with graph, destroy it.</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+            <span class="n">printf</span><span class="p">(</span><span class="s">"Error destroying graph[%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="c1">// Graph is destroyed and handle pointer set to NULL</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Graph Destroyed OK!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphGetOption.html b/docs/ncapi/ncapi2/c_api/ncGraphGetOption.html
new file mode 100644 (file)
index 0000000..2eca509
--- /dev/null
@@ -0,0 +1,208 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncgraphgetoption">ncGraphGetOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncGraphOption_t.html">ncGraphOption_t</a>, <a href="ncGraphSetOption.html">ncGraphSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function gets the value of an option for a graph. The available options and possible values can be found in the <a href="ncGraphOption_t.html">ncGraphOption_t</a> enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">,</span>
+                            <span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="kt">void</span><span class="o">*</span> <span class="n">data</span><span class="p">,</span>
+                            <span class="kt">unsigned</span> <span class="kt">int</span><span class="o">*</span> <span class="n">dataLength</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphHandle</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>*</td>
+      <td>A pointer to an ncGraphHandle_t struct for the graph for which the option value will be retrieved. The graph state must be <a href="ncGraphState_t.html">NC_GRAPH_CREATED</a> or <a href="ncGraphState_t.html">NC_GRAPH_ALLOCATED</a>.</td>
+    </tr>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the <a href="ncGraphOption_t.html">ncGraphOption_t</a> enumeration that specifies which option’s value will be retrieved.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>void*</td>
+      <td>A pointer to a buffer where the value of the option will be copied. The size and type of data this points to will depend on the option that is specified. See <a href="ncGraphOption_t.html">ncGraphOption_t</a> for option data types.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int*</td>
+      <td>A pointer to an unsigned int which contains the size, in bytes, of the buffer allocated by the caller for the data parameter.<br /><br />Upon normal return (status code <a href="ncStatus_t.html">NC_OK</a>), dataLength will be set to the number of bytes copied to the data buffer. In the event that the data buffer was an insufficient size to hold the option value, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and dataLength will be set to the size required to hold the option value.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<p>If the data buffer was an insufficient size to hold the option value, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and dataLength will be set to the size required to hold the option value.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>If you don’t know what value to use for dataLength, you can call this function once with a dataLength of 0 to have dataLength be set to the correct value and then allocate a correctly sized buffer and call this function again. See the example below.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<p>Get an option value when you know the correct data length:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span><span class="p">;</span>
+    
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionSize</span> <span class="o">=</span> <span class="n">NC_MAX_NAME_SIZE</span><span class="p">;</span>
+    <span class="kt">char</span> <span class="n">graphName</span><span class="p">[</span><span class="n">NC_MAX_NAME_SIZE</span><span class="p">];</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_NAME</span><span class="p">,</span> <span class="n">graphName</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error getting graph option[%d].</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Graph option NC_RO_GRAPH_NAME is: '%s'</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">graphName</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="c1">// clean up the graph and device</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+<p>Get an option value when you don’t know the correct data length:</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;mvnc.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">;</span>
+    <span class="kt">char</span><span class="o">*</span> <span class="n">graphName</span><span class="p">;</span> 
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLength</span><span class="p">;</span>
+    
+    <span class="cm">/* Initialize a graph handle */</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"graph1"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+    
+    <span class="cm">/* retCode should be NC_OK unless there was a problem */</span>
+    <span class="k">if</span><span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    
+    <span class="cm">/* Call ncGraphGetOption once to get the correct dataLength */</span>
+    <span class="n">graphName</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="n">dataLength</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_NAME</span><span class="p">,</span> <span class="n">graphName</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dataLength</span><span class="p">);</span>
+
+    <span class="cm">/* retCode should be NC_INVALID_DATA_LENGTH unless there was another problem */</span>
+    <span class="k">if</span><span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_INVALID_DATA_LENGTH</span><span class="p">)</span>
+    <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    
+    <span class="cm">/* Now the value of dataLength is correctly set */</span>
+    <span class="cm">/* Allocate the array buffer */</span>
+    <span class="n">graphName</span> <span class="o">=</span> <span class="p">(</span><span class="kt">char</span><span class="o">*</span><span class="p">)</span><span class="n">malloc</span><span class="p">(</span><span class="n">dataLength</span><span class="p">);</span>
+    
+    <span class="cm">/* Get the graph name option value */</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandle</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_NAME</span><span class="p">,</span> <span class="n">graphName</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">dataLength</span><span class="p">);</span>
+    
+    <span class="cm">/* Use the graph name as needed */</span>
+    <span class="n">printf</span><span class="p">(</span><span class="s">"The graph name is %s.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">graphName</span><span class="p">);</span>
+    
+    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphHandle_t.html b/docs/ncapi/ncapi2/c_api/ncGraphHandle_t.html
new file mode 100644 (file)
index 0000000..ae56674
--- /dev/null
@@ -0,0 +1,91 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="struct-ncgraphhandle_t">struct ncGraphHandle_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphCreate.html">ncGraphCreate()</a>, <a href="ncGraphAllocate.html">ncGraphAllocate()</a>, <a href="ncGraphDestroy.html">ncGraphDestroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>The ncGraphHandle_t struct is an abstraction for a network graph that is used throughout the API.</p>
+
+<h2 id="typical-usage">Typical Usage</h2>
+<ul>
+  <li>Initialize a <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct with <a href="ncGraphCreate.html">ncGraphCreate()</a>.</li>
+  <li>Create input and output FIFO queues and allocate the graph to a neural compute device with <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>/<a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a>.
+    <ul>
+      <li>Alternatively, just allocate the graph with <a href="ncGraphAllocate.html">ncGraphAllocate()</a> and handle FIFO creation and allocation separately.</li>
+    </ul>
+  </li>
+  <li>Write an image to the input FIFO and queue an inference with <a href="ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a>.
+    <ul>
+      <li>You can also just queue an inference from an input FIFO that already contains elements with <a href="ncGraphQueueInference.html">ncGraphQueueInference()</a></li>
+    </ul>
+  </li>
+  <li>When finished, destroy the graph handle and free associated resources with <a href="ncGraphDestroy.html">ncGraphDestroy()</a></li>
+</ul>
+
+<p>See the <a href="readme.html">C API Overview</a> for more information about typical API usage.</p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphOption_t.html b/docs/ncapi/ncapi2/c_api/ncGraphOption_t.html
new file mode 100644 (file)
index 0000000..6962f95
--- /dev/null
@@ -0,0 +1,166 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncgraphoption_t-enumeration">ncGraphOption_t enumeration</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncGraphGetOption.html">ncGraphGetOption()</a>, <a href="ncGraphSetOption.html">ncGraphSetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The ncGraphOption_t enumeration defines graph options that can be read with <a href="ncGraphGetOption.html">ncGraphGetOption()</a> or set with <a href="ncGraphSetOption.html">ncGraphSetOption()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_RO_GRAPH_STATE</td>
+      <td>int</td>
+      <td>Values in the <a href="ncGraphState_t.html">ncGraphState_t</a> enumeration</td>
+      <td>The current state of the graph and the associated <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_GRAPH_TIME_TAKEN</td>
+      <td>float[ ]</td>
+      <td>Positive floats</td>
+      <td>The times taken per graph layer for the last inference. The size of this array is the value of the NC_RO_GRAPH_TIME_TAKEN_ARRAY_SIZE option.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_GRAPH_INPUT_COUNT</td>
+      <td>int</td>
+      <td>1</td>
+      <td>The number of inputs expected by the graph. This is the number of elements in the NC_RO_GRAPH_INPUT_TENSOR_<br />DESCRIPTORS array.<br /><br /><em>Only 1 currently supported.</em></td>
+    </tr>
+    <tr>
+      <td>NC_RO_GRAPH_OUTPUT_COUNT</td>
+      <td>int</td>
+      <td>1</td>
+      <td>The number of outputs expected by the graph. This is the number of elements in the NC_RO_GRAPH_OUTPUT_TENSOR_<br />DESCRIPTORS array.<br /><br /><em>Only 1 currently supported.</em></td>
+    </tr>
+    <tr>
+      <td>NC_RO_GRAPH_INPUT_<br />TENSOR_DESCRIPTORS</td>
+      <td><a href="ncTensorDescriptor_t.html">struct ncTensorDescriptor_t</a>[ ]</td>
+      <td>N/A</td>
+      <td>An array of ncTensorDescriptor_t structs, which describe the graph inputs in order. The value of the NC_RO_GRAPH_INPUT_COUNT option is the length of the array.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_GRAPH_OUTPUT_<br />TENSOR_DESCRIPTORS</td>
+      <td><a href="ncTensorDescriptor_t.html">struct ncTensorDescriptor_t</a>[ ]</td>
+      <td>N/A</td>
+      <td>An array of ncTensorDescriptor_t structs, which describe the graph outputs in order. The value of the NC_RO_GRAPH_OUTPUT_COUNT option is the length of the array.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_GRAPH_DEBUG_INFO</td>
+      <td>char[ ]</td>
+      <td>Debug info</td>
+      <td>A null-terminated character array that provides more details when the result of a function call was <a href="ncStatus_t.html">NC_MYRIAD_ERROR</a>. The maximum size of this array is NC_DEBUG_BUFFER_SIZE.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_GRAPH_NAME</td>
+      <td>char[ ]</td>
+      <td>Graph name</td>
+      <td>A null-terminated character array containing the name of the graph that was set with <a href="ncGraphCreate.html">ncGraphCreate()</a>. The maximum size of this array is NC_MAX_NAME_SIZE.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_GRAPH_OPTION_<br />CLASS_LIMIT</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The highest option class supported.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_GRAPH_VERSION</td>
+      <td>unsigned int[2]</td>
+      <td>[<em>major, minor</em>]</td>
+      <td>The version of the compiled graph.</td>
+    </tr>
+    <tr>
+      <td>NC_RO_GRAPH_TIME_<br />TAKEN_ARRAY_SIZE</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The size of the NC_RO_GRAPH_TIME_TAKEN option array.</td>
+    </tr>
+    <tr>
+      <td>NC_RW_GRAPH_<br />EXECUTORS_NUM</td>
+      <td>int</td>
+      <td>Positive int up to the device’s <a href="ncDeviceOption_t.html">NC_RO_DEVICE_MAX_<br />EXECUTORS_NUM</a></td>
+      <td><em>Reserved for future use.</em></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="notes">Notes</h2>
+
+<ul>
+  <li><strong>Options prefixed with ‘NC_RW’ have read/write permission and are both gettable and settable.</strong></li>
+  <li><strong>Options prefixed with ‘NC_RO’ have read-only permission and are only gettable.</strong></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphQueueInference.html b/docs/ncapi/ncapi2/c_api/ncGraphQueueInference.html
new file mode 100644 (file)
index 0000000..d3ed31d
--- /dev/null
@@ -0,0 +1,211 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncgraphqueueinference">ncGraphQueueInference()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function queues an inference to be processed by a graph with specified input and output FIFOs.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGraphQueueInference</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">,</span>
+                                 <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">**</span> <span class="n">fifoIn</span><span class="p">,</span>
+                                 <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">inFifoCount</span><span class="p">,</span>
+                                 <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">**</span> <span class="n">fifoOut</span><span class="p">,</span>
+                                 <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">outFifoCount</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphHandle</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>*</td>
+      <td>A pointer to an ncGraphHandle_t struct for the graph that will be used for inference. The graph state must be <a href="ncGraphState_t.html">NC_GRAPH_ALLOCATED</a>.</td>
+    </tr>
+    <tr>
+      <td>fifoIn</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>**</td>
+      <td>An array of pointers to ncFifoHandle_t structs for the input queue(s) from which the tensor will be read. The FIFO states must be <a href="ncFifoState_t.html">NC_FIFO_ALLOCATED</a>.</td>
+    </tr>
+    <tr>
+      <td>inFifoCount</td>
+      <td>unsigned int</td>
+      <td>The number of <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> structs pointed to by the fifoIn parameter.<br /><br /><em>Only 1 currently supported.</em></td>
+    </tr>
+    <tr>
+      <td>fifoOut</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>**</td>
+      <td>An array of pointers to ncFifoHandle_t structs for the output queue(s) on which the inference result will be placed. The FIFO states must be <a href="ncFifoState_t.html">NC_FIFO_ALLOCATED</a>.</td>
+    </tr>
+    <tr>
+      <td>outFifoCount</td>
+      <td>unsigned int</td>
+      <td>The number of <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> structs pointed to by the fifoOut parameter.<br /><br /><em>Only 1 currently supported.</em></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The input FIFO must allow <a href="ncFifoType_t.html">write access</a> for the API and the output FIFO must allow <a href="ncFifoType_t.html">read access</a></li>
+  <li>This is a blocking call. If the input FIFO is empty, this function will not return until there is an element to queue for inference.
+    <ul>
+      <li>The FIFO’s capacity is set when the FIFO is allocated with <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>/<a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> or <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.</li>
+      <li>You can check the capacity and the current fill level of the FIFO with <a href="ncFifoGetOption.html">ncFifoGetOption()</a> for <a href="ncFifoOption_t.html">NC_RO_FIFO_CAPACITY</a> and <a href="ncFifoOption_t.html">NC_RO_FIFO_WRITE_FILL_LEVEL</a>.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
+<span class="p">{</span>
+    <span class="kt">float</span> <span class="n">networkMean</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span><span class="mi">0</span><span class="p">.</span><span class="mi">40787054</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">.</span><span class="mi">45752458</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">.</span><span class="mi">48109378</span><span class="o">*</span><span class="mi">255</span><span class="p">.</span><span class="mi">0</span><span class="p">};</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outFifoHandlePtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">inTensorDesc</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncTensorDescriptor_t</span> <span class="n">outTensorDesc</span><span class="p">;</span>
+    <span class="kt">float</span><span class="o">*</span> <span class="n">imageInMemoryPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionSize</span><span class="p">;</span>
+
+    <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"My Graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">graphSizeInBytes</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">graphInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadGraphFile</span><span class="p">(</span><span class="s">"./graph"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">ncGraphAllocate</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">graphInMemoryPtr</span><span class="p">,</span> <span class="n">graphSizeInBytes</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphInMemoryPtr</span><span class="p">);</span>
+
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Input FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_WO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+    
+    <span class="n">ncFifoCreate</span><span class="p">(</span><span class="s">"MY Output FIFO"</span><span class="p">,</span> <span class="n">NC_FIFO_HOST_RO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">ncTensorDescriptor_t</span><span class="p">);</span>
+    <span class="n">ncGraphGetOption</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="n">ncFifoAllocate</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">deviceHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outTensorDesc</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">networkDim</span> <span class="o">=</span> <span class="mi">224</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">numChannels</span> <span class="o">=</span> <span class="mi">3</span><span class="p">;</span>
+    <span class="n">imageInMemoryPtr</span> <span class="o">=</span> <span class="n">LoadImage32</span><span class="p">(</span><span class="s">"./my_image.png"</span><span class="p">,</span> <span class="n">networkDim</span><span class="p">,</span> <span class="n">networkMean</span><span class="p">);</span>
+    <span class="n">imageSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">float</span><span class="p">)</span> <span class="o">*</span> <span class="n">networkDim</span> <span class="o">*</span> <span class="n">networkDim</span> <span class="o">*</span> <span class="n">numChannels</span><span class="p">;</span>
+    <span class="n">ncFifoWriteElem</span><span class="p">(</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="n">imageInMemoryPtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">imageSize</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">imageInMemoryPtr</span><span class="p">);</span>
+
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphQueueInference</span><span class="p">(</span><span class="n">graphHandlePtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span>
+    <span class="p">{</span>   
+        <span class="c1">// Could not queue inference for graph </span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error queueing inference for graph graph [%d]</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="k">else</span>
+    <span class="p">{</span>
+        <span class="c1">// Inference queued.  When its done finished the result will be on the output FIFO</span>
+        <span class="kt">void</span><span class="o">*</span> <span class="n">outputPtr</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
+        <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">fifoOutputSize</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+        <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionDataLen</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="p">);</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Graph inference queued OK!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span>
+        <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_FIFO_ELEMENT_DATA_SIZE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionDataLen</span><span class="p">);</span>
+        <span class="n">outputPtr</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"output size is: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">outputDataLen</span><span class="p">);</span>
+        <span class="n">ncFifoReadElem</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">outputPtr</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+        <span class="n">free</span><span class="p">(</span><span class="n">outputPtr</span><span class="p">);</span>
+    <span class="p">}</span>
+
+    <span class="c1">// clean up the graph and device</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outFifoHandlePtr</span><span class="p">);</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandlePtr</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphQueueInferenceWithFifoElem.html b/docs/ncapi/ncapi2/c_api/ncGraphQueueInferenceWithFifoElem.html
new file mode 100644 (file)
index 0000000..551f87a
--- /dev/null
@@ -0,0 +1,208 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncgraphqueueinferencewithfifoelem">ncGraphQueueInferenceWithFifoElem()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncGraphQueueInference.html">ncGraphQueueInference()</a>, <a href="ncFifoWriteElem.html">ncFifoWriteElem()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function writes an element to a FIFO, usually an input tensor for inference, and queues an inference to be processed by a graph. This is a convenient way to write an input tensor and queue an inference in one call.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGraphQueueInferenceWithFifoElem</span><span class="p">(</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">,</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">fifoIn</span><span class="p">,</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">fifoOut</span><span class="p">,</span> 
+    <span class="k">const</span> <span class="kt">void</span><span class="o">*</span> <span class="n">inputTensor</span><span class="p">,</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span><span class="o">*</span> <span class="n">inputTensorLength</span><span class="p">,</span> 
+    <span class="kt">void</span><span class="o">*</span> <span class="n">userParam</span>
+<span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphHandle</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>*</td>
+      <td>A pointer to an ncGraphHandle_t struct for the graph that will be used for inference. The graph state must be <a href="ncGraphState_t.html">NC_GRAPH_ALLOCATED</a>.</td>
+    </tr>
+    <tr>
+      <td>fifoIn</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>*</td>
+      <td>A pointer to the ncFifoHandle_t struct for the input queue from which the tensor will be read. The FIFO state must be <a href="ncFifoState_t.html">NC_FIFO_ALLOCATED</a>.</td>
+    </tr>
+    <tr>
+      <td>fifoOut</td>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>*</td>
+      <td>A pointer to the ncFifoHandle_t struct for the output queue on which the inference result will be placed. The FIFO state must be <a href="ncFifoState_t.html">NC_FIFO_ALLOCATED</a>.</td>
+    </tr>
+    <tr>
+      <td>inputTensor</td>
+      <td>const void*</td>
+      <td>A pointer to a tensor data buffer that contains data in the format specified by the FIFO’s <a href="ncFifoDataType_t.html">NC_RW_FIFO_DATA_TYPE</a> option.  This data is typically a representation of each color channel in each pixel of an image.</td>
+    </tr>
+    <tr>
+      <td>inputTensorLength</td>
+      <td>unsigned int*</td>
+      <td>A pointer to an unsigned int that contains the length, in bytes, of the buffer that the inputTensor parameter points to.<br /><br />If the size of the input tensor does not match the expected input size for this FIFO, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and inputTensorLength will be set to the expected input size.</td>
+    </tr>
+    <tr>
+      <td>userParam</td>
+      <td>void*</td>
+      <td>A pointer to additional user data to associate with the input tensor, or NULL. The pointer value (not the data that it points to) will be copied, stored, and then returned with the inference result with <a href="ncFifoReadElem.html">ncFifoReadElem()</a>. This pointer can point to anything that the caller would like to associate with the inference result, such as the original inference input or a window handle. The caller is responsible for allocating and freeing any memory that this pointer references.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<p>If the size of the input tensor does not match the expected input size for this FIFO, the return status code will be <a href="ncStatus_t.html">NC_INVALID_DATA_LENGTH</a> and the inputTensorLength will be set to the expected input size.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>This function takes the place of explicit calls to <a href="ncFifoWriteElem.html">ncFifoWriteElem()</a> and <a href="ncGraphQueueInference.html">ncGraphQueueInference()</a>.</li>
+  <li>The input FIFO must allow <a href="ncFifoType_t.html">write access</a> for the API and the output FIFO must allow <a href="ncFifoType_t.html">read access</a> for the API.</li>
+  <li><a href="ncFifoWriteElem.html">ncFifoWriteElem()</a>, which is called internally by this function, is a blocking call if <a href="ncFifoOption_t.html">NC_RW_FIFO_DONT_BLOCK</a> is false. If the input FIFO is full this function will not return until there is space to write to the FIFO.
+    <ul>
+      <li>The input FIFO’s capacity is set when the FIFO is allocated with <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>/<a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> or <a href="ncFifoAllocate.html">ncFifoAllocate()</a>.</li>
+      <li>You can check the capacity and the current fill level of the input FIFO with <a href="ncFifoGetOption.html">ncFifoGetOption()</a> for <a href="ncFifoOption_t.html">NC_RO_FIFO_CAPACITY</a> and <a href="ncFifoOption_t.html">NC_RO_FIFO_WRITE_FILL_LEVEL</a>.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
+    <span class="c1">// You can check that this return code is equal to NC_OK after each API function call</span>
+    <span class="c1">// This is omitted in this example for better readability</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+
+    <span class="c1">// Initialize and open a device</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+
+    <span class="c1">// Load a graph from file</span>
+    <span class="c1">// void* graphBuffer = ...</span>
+    <span class="c1">// unsigned int graphBufferLength = ...</span>
+    
+    <span class="c1">// Initialize the graph</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"graph1"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+       
+    <span class="c1">// CONVENIENCE FUNCTION: Allocate the graph to the device and create input/output FIFOs with default options</span>
+    <span class="c1">// Alternatively, use ncGraphAllocateWithFifosEx() to do this with explicit FIFO options</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inputFIFO</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outputFIFO</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphAllocateWithFifos</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="n">graphHandle</span><span class="p">,</span> <span class="n">graphBuffer</span><span class="p">,</span> <span class="n">graphBufferLength</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphBuffer</span><span class="p">);</span>
+
+    <span class="c1">// Read and preprocess input...</span>
+    <span class="c1">// float* imageBuffer = ...</span>
+    <span class="c1">// unsigned int imageBufferLength = ...</span>
+
+    <span class="c1">// Write the image to the input FIFO and queue the inference</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphQueueInferenceWithFifoElem</span><span class="p">(</span>
+                    <span class="n">graphHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">,</span>
+                    <span class="n">imageBuffer</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">imageBufferLength</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>    
+    
+    <span class="c1">// Get the results from the output FIFO</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">result</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">fifoOutputSize</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionDataLen</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>
+    <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">outFifoHandlePtr</span><span class="p">,</span> <span class="n">NC_RO_FIFO_ELEMENT_DATA_SIZE</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionDataLen</span><span class="p">);</span>
+    <span class="n">result</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">fifoOutputSize</span><span class="p">);</span>    
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoReadElem</span><span class="p">(</span><span class="n">outputFIFO</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">fifoOutputSize</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">result</span><span class="p">);</span>
+
+    <span class="c1">// Do something with the results...</span>
+
+    <span class="c1">// Clean up</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inputFIFO</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outputFIFO</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphSetOption.html b/docs/ncapi/ncapi2/c_api/ncGraphSetOption.html
new file mode 100644 (file)
index 0000000..88cb6f5
--- /dev/null
@@ -0,0 +1,128 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="ncgraphsetoption">ncGraphSetOption()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Library</td>
+      <td>libmvnc.so</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncGraphOption_t.html">ncGraphOption_t</a>, <a href="ncGraphGetOption.html">ncGraphGetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>This function sets an option value for a graph.  The available options and possible values can be found in the <a href="ncGraphOption_t.html">ncGraphOption_t</a> enumeration.</p>
+
+<h2 id="prototype">Prototype</h2>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ncStatus_t</span> <span class="n">ncGraphSetOption</span><span class="p">(</span><span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">,</span>
+                            <span class="kt">int</span> <span class="n">option</span><span class="p">,</span> <span class="k">const</span> <span class="kt">void</span><span class="o">*</span> <span class="n">data</span><span class="p">,</span>
+                            <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">dataLength</span><span class="p">);</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Name</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>graphHandle</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>*</td>
+      <td>A pointer to an ncGraphHandle_t struct for the graph for which the option value will be set. The graph state must be <a href="ncGraphState_t.html">NC_GRAPH_CREATED</a>.</td>
+    </tr>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A value from the <a href="ncGraphOption_t.html">ncGraphOption_t</a> enumeration that specifies which option’s value will be set.</td>
+    </tr>
+    <tr>
+      <td>data</td>
+      <td>const void*</td>
+      <td>A pointer to a buffer containing the new value for the option.<br /><br />The type of data this points to depends on the option that is specified. Check <a href="ncGraphOption_t.html">ncGraphOption_t</a> for the data types that each option requires.</td>
+    </tr>
+    <tr>
+      <td>dataLength</td>
+      <td>unsigned int</td>
+      <td>An unsigned int that contains the length, in bytes, of the buffer that the data parameter points to.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>An appropriate value from the <a href="ncStatus_t.html">ncStatus_t</a> enumeration.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>There are currently no settable graph options.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<p>N/A</p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncGraphState_t.html b/docs/ncapi/ncapi2/c_api/ncGraphState_t.html
new file mode 100644 (file)
index 0000000..b87c6b0
--- /dev/null
@@ -0,0 +1,101 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enum-ncgraphstate_t">enum ncGraphState_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncGraphOption_t.html">ncGraphOption_t</a>, <a href="ncGraphGetOption.html">ncGraphGetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The ncGraphState_t enumeration defines states of a network graph and associated <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct, which can be read with <a href="ncGraphGetOption.html">ncGraphGetOption()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_GRAPH_CREATED</td>
+      <td>The <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct has been initialized with <a href="ncGraphCreate.html">ncGraphCreate()</a> but the graph has not been allocated for a device.</td>
+    </tr>
+    <tr>
+      <td>NC_GRAPH_ALLOCATED</td>
+      <td>The graph handle has been initialized, and the graph has been allocated for a device with <a href="ncGraphAllocate.html">ncGraphAllocate()</a> or <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>.</td>
+    </tr>
+    <tr>
+      <td>NC_GRAPH_WAITING_FOR_BUFFERS</td>
+      <td>The graph is waiting for input.</td>
+    </tr>
+    <tr>
+      <td>NC_GRAPH_RUNNING</td>
+      <td>The graph is currently running an inference.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncStatus_t.html b/docs/ncapi/ncapi2/c_api/ncStatus_t.html
new file mode 100644 (file)
index 0000000..fc15f5f
--- /dev/null
@@ -0,0 +1,149 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enum-ncstatus_t">enum ncStatus_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td> </td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>A value from this enumeration is returned from most of the C API functions.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Constant</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>NC_OK</td>
+      <td>The function call worked as expected.</td>
+    </tr>
+    <tr>
+      <td>NC_BUSY</td>
+      <td>The device is busy; retry later.</td>
+    </tr>
+    <tr>
+      <td>NC_ERROR</td>
+      <td>An unexpected error was encountered during the function call.</td>
+    </tr>
+    <tr>
+      <td>NC_OUT_OF_MEMORY</td>
+      <td>The host is out of memory.</td>
+    </tr>
+    <tr>
+      <td>NC_DEVICE_NOT_FOUND</td>
+      <td>There is no device at the given index or name.</td>
+    </tr>
+    <tr>
+      <td>NC_INVALID_PARAMETERS</td>
+      <td>At least one of the given parameters is invalid in the context of the function call.</td>
+    </tr>
+    <tr>
+      <td>NC_TIMEOUT</td>
+      <td>Timeout in the communication with the device.</td>
+    </tr>
+    <tr>
+      <td>NC_MVCMD_NOT_FOUND</td>
+      <td>The file to boot the device was not found.  This file typically has the extension .mvcmd and should be installed during the NCSDK installation. This message may mean that the installation failed.</td>
+    </tr>
+    <tr>
+      <td>NC_NOT_ALLOCATED</td>
+      <td>The graph or fifo has not been allocated.</td>
+    </tr>
+    <tr>
+      <td>NC_UNAUTHORIZED</td>
+      <td>An unauthorized operation has been attempted.</td>
+    </tr>
+    <tr>
+      <td>NC_UNSUPPORTED_GRAPH_FILE</td>
+      <td>The graph file may have been created with an incompatible prior version of the Toolkit. Try to recompile the graph file with the version of the Toolkit that corresponds to the API version.</td>
+    </tr>
+    <tr>
+      <td>NC_UNSUPPORTED_CONFIGURATION_FILE</td>
+      <td><em>Reserved for future use.</em></td>
+    </tr>
+    <tr>
+      <td>NC_UNSUPPORTED_FEATURE</td>
+      <td>Operation attempted a feature that is not supported by this firmware version.</td>
+    </tr>
+    <tr>
+      <td>NC_MYRIAD_ERROR</td>
+      <td>An error has been reported by Intel® Movidius™ VPU. Use <a href="ncGraphGetOption.html">ncGraphGetOption()</a> for <a href="ncGraphOption_t.html">NC_RO_GRAPH_DEBUG_INFO</a> and <a href="ncDeviceGetOption.html">ncDeviceGetOption</a> for <a href="ncDeviceOption_t.html">NC_RO_DEVICE_DEBUG_INFO</a> to get more information on the error.</td>
+    </tr>
+    <tr>
+      <td>NC_INVALID_DATA_LENGTH</td>
+      <td>An invalid data length has been passed when getting or setting an option.</td>
+    </tr>
+    <tr>
+      <td>NC_INVALID_HANDLE</td>
+      <td>An invalid handle has been passed to a function.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/ncTensorDescriptor_t.html b/docs/ncapi/ncapi2/c_api/ncTensorDescriptor_t.html
new file mode 100644 (file)
index 0000000..c63472a
--- /dev/null
@@ -0,0 +1,115 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="struct-nctensordescriptor_t">struct ncTensorDescriptor_t</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Header</td>
+      <td>mvnc.h</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a>, <a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a>, <a href="ncGraphOption_t.html">ncGraphOption_t</a>, <a href="ncFifoOption_t.html">ncFifoOption_t</a>, <a href="ncGraphGetOption.html">ncGraphGetOption()</a>, <a href="ncFifoGetOption.html">ncFifoGetOption()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>The ncTensorDescriptor_t struct describes graph inputs and outputs.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Member</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>n</td>
+      <td>unsigned int</td>
+      <td>The number of images in the batch.</td>
+    </tr>
+    <tr>
+      <td>c</td>
+      <td>unsigned int</td>
+      <td>The number of channels in the image.  For image tensors, this is the number of channels per pixel.</td>
+    </tr>
+    <tr>
+      <td>w</td>
+      <td>unsigned int</td>
+      <td>The width of the image. For non-image tensors, this is always 1.</td>
+    </tr>
+    <tr>
+      <td>h</td>
+      <td>unsigned int</td>
+      <td>The height of the image. For non-image tensors, this is always 1.</td>
+    </tr>
+    <tr>
+      <td>totalSize</td>
+      <td>unsigned int</td>
+      <td>The total size of the data. This is the number of bytes required to hold the entire tensor.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>You can use <a href="ncGraphGetOption.html">ncGraphGetOption()</a> to get arrays of input or output <a href="ncTensorDescriptor_t.html">ncTensorDescriptor_t</a> structs for a graph.</li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/c_api/readme.html b/docs/ncapi/ncapi2/c_api/readme.html
new file mode 100644 (file)
index 0000000..4f1114d
--- /dev/null
@@ -0,0 +1,460 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="intel-movidius-neural-compute-sdk-c-api">Intel® Movidius™ Neural Compute SDK C API</h1>
+
+<p>The Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) comes with a C language API (API) that enables developers to create applications in C or C++ that utilize hardware-accelerated Deep Neural Networks via neural compute devices like the <a href="../../../ncs.html">Intel® Movidius™ Neural Compute Stick</a>.
+The C API is provided as a header file (mvnc.h) and an associated library file (libmvnc.so), both of which are placed on the development computer when the NCSDK is installed.</p>
+
+<h2 id="documentation">Documentation</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Enumerations</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncDeviceHwVersion_t.html">ncDeviceHwVersion_t</a></td>
+      <td>Contains neural compute device hardware versions.</td>
+    </tr>
+    <tr>
+      <td><a href="ncDeviceOption_t.html">ncDeviceOption_t</a></td>
+      <td>Contains neural compute device options.</td>
+    </tr>
+    <tr>
+      <td><a href="ncDeviceState_t.html">ncDeviceState_t</a></td>
+      <td>Contains neural compute device NCAPI states.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoDataType_t.html">ncFifoDataType_t</a></td>
+      <td>Contains FIFO queue element data types.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoOption_t.html">ncFifoOption_t</a></td>
+      <td>Contains FIFO queue options.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoState_t.html">ncFifoState_t</a></td>
+      <td>Contains FIFO queue NCAPI states.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoType_t.html">ncFifoType_t</a></td>
+      <td>Contains FIFO queue access types.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGlobalOption_t.html">ncGlobalOption_t</a></td>
+      <td>Contains global (application-level) options.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGraphOption_t.html">ncGraphOption_t</a></td>
+      <td>Contains network graph options.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGraphState_t.html">ncGraphState_t</a></td>
+      <td>Contains network graph NCAPI states.</td>
+    </tr>
+    <tr>
+      <td><a href="ncStatus_t.html">ncStatus_t</a></td>
+      <td>Contains status code return values for NCAPI functions.</td>
+    </tr>
+  </tbody>
+</table>
+
+<table>
+  <thead>
+    <tr>
+      <th>Structs</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncDeviceHandle_t.html">struct ncDeviceHandle_t</a></td>
+      <td>Holds data and resources corresponding to a neural compute device.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoHandle_t.html">struct ncFifoHandle_t</a></td>
+      <td>Holds data and resources corresponding to a FIFO queue.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGraphHandle_t.html">struct ncGraphHandle_t</a></td>
+      <td>Holds data and resources corresponding to network graph.</td>
+    </tr>
+    <tr>
+      <td><a href="ncTensorDescriptor_t.html">struct ncTensorDescriptor_t</a></td>
+      <td>Holds information that describes the shape of a tensor.</td>
+    </tr>
+  </tbody>
+</table>
+
+<table>
+  <thead>
+    <tr>
+      <th>Global Functions</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncGlobalGetOption.html">ncGlobalGetOption</a></td>
+      <td>Gets the value of a global option for the application.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGlobalSetOption.html">ncGlobalSetOption</a></td>
+      <td>Sets the value of a global option for the application.</td>
+    </tr>
+  </tbody>
+</table>
+
+<table>
+  <thead>
+    <tr>
+      <th>Device Functions</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncDeviceClose.html">ncDeviceClose</a></td>
+      <td>Closes communication with a previously opened neural compute device.</td>
+    </tr>
+    <tr>
+      <td><a href="ncDeviceCreate.html">ncDeviceCreate</a></td>
+      <td>Initializes a <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct for use with the NCAPI.</td>
+    </tr>
+    <tr>
+      <td><a href="ncDeviceDestroy.html">ncDeviceDestroy</a></td>
+      <td>Destroys a device handle and frees associated resources.</td>
+    </tr>
+    <tr>
+      <td><a href="ncDeviceGetOption.html">ncDeviceGetOption</a></td>
+      <td>Gets the value of an option for a neural compute device.</td>
+    </tr>
+    <tr>
+      <td><a href="ncDeviceOpen.html">ncDeviceOpen</a></td>
+      <td>Boots and initializes a neural compute device and opens communication.</td>
+    </tr>
+    <tr>
+      <td><a href="ncDeviceSetOption.html">ncDeviceSetOption</a></td>
+      <td>Sets the value of an option for a neural compute device.</td>
+    </tr>
+  </tbody>
+</table>
+
+<table>
+  <thead>
+    <tr>
+      <th>FIFO Functions</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncFifoAllocate.html">ncFifoAllocate</a></td>
+      <td>Allocates a FIFO buffer for graph input or output.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoCreate.html">ncFifoCreate</a></td>
+      <td>Initializes a <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct for use with the NCAPI.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoDestroy.html">ncFifoDestroy</a></td>
+      <td>Destroys a FIFO handle and frees associated resources.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoGetOption.html">ncFifoGetOption</a></td>
+      <td>Gets the value of an option for a FIFO.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoReadElem.html">ncFifoReadElem</a></td>
+      <td>Reads an element from a FIFO.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoRemoveElem.html">ncFifoRemoveElem</a></td>
+      <td><em>Not yet implemented.</em></td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoSetOption.html">ncFifoSetOption</a></td>
+      <td>Sets the value of an option for a FIFO.</td>
+    </tr>
+    <tr>
+      <td><a href="ncFifoWriteElem.html">ncFifoWriteElem</a></td>
+      <td>Writes an element to a FIFO.</td>
+    </tr>
+  </tbody>
+</table>
+
+<table>
+  <thead>
+    <tr>
+      <th>Graph Functions</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncGraphAllocate.html">ncGraphAllocate</a></td>
+      <td>Allocates a graph to a neural compute device.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGraphCreate.html">ncGraphCreate</a></td>
+      <td>Initializes a <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct for use with the NCAPI.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGraphDestroy.html">ncGraphDestroy</a></td>
+      <td>Destroys a graph handle and frees associated resources.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGraphQueueInference.html">ncGraphQueueInference</a></td>
+      <td>Queues an inference from a network graph.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGraphGetOption.html">ncGraphGetOption</a></td>
+      <td>Gets the value of an option for a graph.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGraphSetOption.html">ncGraphSetOption</a></td>
+      <td>Sets the value of an option for a graph.</td>
+    </tr>
+  </tbody>
+</table>
+
+<table>
+  <thead>
+    <tr>
+      <th>Convenience Functions</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos</a></td>
+      <td>Allocates a network graph and creates and allocates associated FIFOs with default options.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx</a></td>
+      <td>Allocates a network graph and creates and allocates associated FIFOs with explicit options.</td>
+    </tr>
+    <tr>
+      <td><a href="ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem</a></td>
+      <td>Writes an input tensor to a FIFO and queues an inference from a network graph.</td>
+    </tr>
+  </tbody>
+</table>
+
+<p><br /></p>
+
+<h2 id="c-api-overview">C API Overview</h2>
+
+<h3 id="1-import-the-ncapi">1. Import the NCAPI</h3>
+
+<p>Import the <code class="highlighter-rouge">mvnc.h</code> header and anything else that you need.</p>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;mvnc.h&gt;
+</span>
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span>
+    <span class="c1">// Every NCAPI function will return a status code that should normally be NC_OK</span>
+    <span class="n">ncStatus_t</span> <span class="n">retCode</span><span class="p">;</span>
+<span class="p">...</span>
+</code></pre></div></div>
+
+<p>You can get and set application-level information and options with <a href="ncGlobalGetOption.html">ncGlobalGetOption()</a> and <a href="ncGlobalSetOption.html">ncGlobalSetOption()</a>.</p>
+
+<h3 id="2-set-up-a-neural-compute-device">2. Set up a neural compute device</h3>
+
+<p>The <a href="ncDeviceHandle_t.html">ncDeviceHandle_t</a> struct is used to represent a neural compute device throughout the NCAPI. The NCAPI provides functions to communicate with the device.</p>
+
+<p>Initialize a device handle with <a href="ncDeviceCreate.html">ncDeviceCreate()</a>.</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="c1">// Create a device handle for the first device found (index 0)</span>
+    <span class="k">struct</span> <span class="n">ncDeviceHandle_t</span><span class="o">*</span> <span class="n">deviceHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceCreate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error [%d]: Could not create a neural compute device handle.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+</code></pre></div></div>
+
+<p>Boot and initialize the neural compute device and open communication with <a href="ncDeviceOpen.html">ncDeviceOpen()</a>.</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="c1">// Boot the device and open communication</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncDeviceOpen</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span> <span class="p">{</span>  
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error [%d]: Could not open the neural compute device.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+</code></pre></div></div>
+
+<p>You can get information about the device using <a href="ncDeviceGetOption.html">ncDeviceGetOption()</a> for options in the <a href="ncDeviceOption_t.html">ncDeviceOption_t</a> enumeration.</p>
+
+<p>*Note: If you are using more than one neural compute device, you must create and open a separate device handle for each.</p>
+
+<h3 id="3-set-up-a-network-graph-and-associated-fifo-queues-for-the-device">3. Set up a network graph and associated FIFO queues for the device</h3>
+
+<p>The NCSDK requires a neural network graph file compiled with the <a href="../../../tools/compile.html">mvNCCompile</a> NCSDK tool.
+Many network models from <a href="../../../tensorflow.html">TensorFlow™</a> and <a href="../../../caffe.html">Caffe</a> are supported.
+See <a href="../../../configure_network.html">Configuring Your Network for the Intel® Movidius™ Neural Compute SDK</a> for more information about preparing your network model for use with the NCSDK.</p>
+
+<p>When you have a compiled graph, load the graph file data to a buffer.</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="c1">// Load the graph file into a buffer</span>
+    <span class="c1">// void* graphFileBuffer = ...</span>
+    <span class="c1">// unsigned int graphFileLength = ...</span>
+</code></pre></div></div>
+
+<p>The <a href="ncGraphHandle_t.html">ncGraphHandle_t</a> struct is used to represent a neural network graph throughout the NCAPI. The NCAPI provides functions to perform inferences using the graph.</p>
+
+<p>Initialize the graph handle with a name string. The name string can be anything you like up to NC_MAX_NAME_SIZE characters, or just an empty string. You can read this name later with <a href="ncGraphGetOption.html">ncGraphGetOption()</a>.</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="c1">// Initialize a graph handle</span>
+    <span class="k">struct</span> <span class="n">ncGraphHandle_t</span><span class="o">*</span> <span class="n">graphHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphCreate</span><span class="p">(</span><span class="s">"graph1"</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error [%d]: Could not create a graph handle.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="c1">// Do clean up...</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+</code></pre></div></div>
+
+<p>Graph input and output is done with FIFO (first-in, first-out) queues. The <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> struct is used to represent a FIFO throughout the NCAPI. The NCAPI provides functions for managing FIFO queues.</p>
+
+<p>Create input and output FIFO queues for the graph using default FIFO options and allocate the graph to the device with <a href="ncGraphAllocateWithFifos.html">ncGraphAllocateWithFifos()</a>.</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="c1">// Allocate the graph to the device and create input and output FIFOs with default options</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">inFifoHandle</span><span class="p">;</span>
+    <span class="k">struct</span> <span class="n">ncFifoHandle_t</span><span class="o">*</span> <span class="n">outFifoHandle</span><span class="p">;</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphAllocateWithFifos</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">,</span> <span class="n">graphHandle</span><span class="p">,</span> <span class="n">graphFileBuffer</span><span class="p">,</span> 
+                                       <span class="n">graphFileLength</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inFifoHandle</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoHandle</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error [%d]: Could not allocate graph with FIFOs.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="c1">// Do clean up...</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="n">free</span><span class="p">(</span><span class="n">graphFileBuffer</span><span class="p">);</span>
+</code></pre></div></div>
+<p>You can also use <a href="ncGraphAllocateWithFifosEx.html">ncGraphAllocateWithFifosEx()</a> to explicitly set FIFO options for type, data type, and size. See the <a href="ncFifoHandle_t.html">ncFifoHandle_t</a> documentation for more information on creating and allocating FIFOs.</p>
+
+<p>You can get information about a graph using <a href="ncGraphGetOption.html">ncGraphGetOption()</a> for options in the <a href="ncGraphOption_t.html">ncGraphOption_t</a> enumeration. You can get information about a FIFO using <a href="ncFifoGetOption.html">ncFifoGetOption()</a> for options in the <a href="ncFifoOption_t.html">ncFifoOption_t</a> enumeration.</p>
+
+<p>*Note: You must create and allocate a graph handle for each network graph file that you wish to use. A neural compute device can have more than one graph allocated to it, but each graph can only be allocated to a single device.</p>
+
+<h3 id="4-get-an-input-tensor">4. Get an input tensor</h3>
+
+<p>The way that you obtain and pre-process your input tensor will depend on your individual application. OpenCV and GStreamer are popular libraries for loading and manipulating images from file or a camera stream.</p>
+
+<p>Input tensor data must be the data type specified by the <a href="ncFifoOption_t.html">NC_RW_FIFO_DATA_TYPE</a> option for the input FIFO. The default is 32-bit floating point, but FIFOs can also be configured to store 16-bit floating point data. See the <a href="ncFifoDataType_t.html">ncFifoDataType_t.html</a> enumeration.</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="c1">// Load an input tensor and do pre-processing...</span>
+    <span class="c1">// float* imageBuffer = ...</span>
+    <span class="c1">// unsigned int imageBufferLength = ...</span>
+</code></pre></div></div>
+
+<p>The NCSDK includes example applications that demonstrate image tensor pre-processing for several networks.</p>
+
+<h3 id="5-perform-an-inference">5. Perform an inference</h3>
+
+<p>Use <a href="ncGraphQueueInferenceWithFifoElem.html">ncGraphQueueInferenceWithFifoElem()</a> to write the input tensor to your input FIFO and queue it for inference.
+When the inference is complete the input tensor will be removed from the input FIFO and the result tensor will be placed in the output FIFO.
+The third parameter is the size of the input tensor in bytes. This must match the expected size for the network.
+The fourth parameter can be any data that you wish to have associated with this particular tensor when you read the inference result, such as the original tensor or a window handle, or NULL.</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="c1">// Write the tensor to the input FIFO and queue an inference</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncGraphQueueInferenceWithFifoElem</span><span class="p">(</span>
+                <span class="n">graphHandle</span><span class="p">,</span> <span class="n">inFifoHandle</span><span class="p">,</span> <span class="n">outFifoHandle</span><span class="p">,</span> <span class="n">imageBuffer</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">imageBufferLength</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error [%d]: Could not write to the input FIFO and queue an inference.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="c1">// Do clean up...</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+</code></pre></div></div>
+
+<p>If the input FIFO is full, this function call will block until there is room to write to the FIFO.
+You can check how many elements are in the input and output FIFOs with <a href="ncFifoGetOption.html">ncFifoGetOption()</a> for NC_RO_FIFO_WRITE_FILL_LEVEL and NC_RO_FIFO_READ_FILL_LEVEL, respectively.
+Note that the inference will take some amount of time to complete, depending on network model speed and device communication latency, so you may need to wait to see updated levels.</p>
+
+<p>After the inference is complete, you can get the inference result with <a href="ncFifoReadElem.html">ncFifoReadElem()</a>.
+The size of the output tensor will depend on the network definition as well as the output FIFO’s data type.
+You can calculate the size of the output tensor yourself or use <a href="ncFifoGetOption.html">ncFifoGetOption()</a> for NC_RO_FIFO_ELEMENT_DATA_SIZE to get the correct size.</p>
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="c1">// Get the size of the output tensor</span>
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">outFifoElemSize</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> 
+    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">optionSize</span> <span class="o">=</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">outFifoElemSize</span><span class="p">);</span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoGetOption</span><span class="p">(</span><span class="n">outFifoHandle</span><span class="p">,</span>  <span class="n">NC_RO_FIFO_ELEMENT_DATA_SIZE</span><span class="p">,</span>
+                              <span class="o">&amp;</span><span class="n">outFifoElemSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">optionSize</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error [%d]: Could not get the output FIFO element data size.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="c1">// Do clean up...</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+                    
+    <span class="c1">// Get the output tensor</span>
+    <span class="kt">float</span><span class="o">*</span> <span class="n">resultData</span> <span class="o">=</span> <span class="p">(</span><span class="kt">float</span><span class="o">*</span><span class="p">)</span> <span class="n">malloc</span><span class="p">(</span><span class="n">outFifoElemSize</span><span class="p">);</span>
+    <span class="kt">void</span><span class="o">*</span> <span class="n">userParam</span><span class="p">;</span>  <span class="c1">// this will be set to point to the user-defined data that you passed into ncGraphQueueInferenceWithFifoElem() with this tensor  </span>
+    <span class="n">retCode</span> <span class="o">=</span> <span class="n">ncFifoReadElem</span><span class="p">(</span><span class="n">outFifoHandle</span><span class="p">,</span> <span class="p">(</span><span class="kt">void</span><span class="o">*</span><span class="p">)</span><span class="n">resultData</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">outFifoElemSize</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">userParam</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">retCode</span> <span class="o">!=</span> <span class="n">NC_OK</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">printf</span><span class="p">(</span><span class="s">"Error [%d]: Could not read the result from the ouput FIFO.</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">retCode</span><span class="p">);</span>
+        <span class="c1">// Do clean up...</span>
+        <span class="n">exit</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">}</span>
+</code></pre></div></div>
+
+<p>You can then use the output result as intended for your particular network model.</p>
+
+<h3 id="6-clean-up">6. Clean up</h3>
+
+<p>Before closing communication with the device, use <a href="ncGraphDestroy.html">ncGraphDestroy()</a> and <a href="ncFifoDestroy.html">ncFifoDestroy()</a> to set graph and FIFO handles to NULL and clean up associated memory. The FIFOs must be empty before being destroyed.
+Then use <a href="ncDeviceClose.html">ncDeviceClose()</a> to close the device and <a href="ncDeviceDestroy.html">ncDeviceDestroy()</a> to set the device handle to NULL and clean up associated memory.</p>
+
+<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="c1">// Clean up the FIFOs</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">inFifoHandle</span><span class="p">);</span>
+    <span class="n">ncFifoDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">outFifoHandle</span><span class="p">);</span>
+    
+    <span class="c1">// Clean up the graph</span>
+    <span class="n">ncGraphDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">graphHandle</span><span class="p">);</span>
+
+    <span class="c1">// Close and clean up the device</span>
+    <span class="n">ncDeviceClose</span><span class="p">(</span><span class="n">deviceHandle</span><span class="p">);</span>
+    <span class="n">ncDeviceDestroy</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deviceHandle</span><span class="p">);</span>
+    
+<span class="p">}</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Device.close.html b/docs/ncapi/ncapi2/py_api/Device.close.html
new file mode 100644 (file)
index 0000000..88fa392
--- /dev/null
@@ -0,0 +1,119 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="deviceclose">Device.close()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a>, <a href="Device.open.html">Device.open()</a>, <a href="Device.destroy.html">Device.destroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method closes communication with a neural compute device that has been opened with <a href="Device.open.html">Device.open()</a>. Opened devices have an OPENED <a href="DeviceState.html">DeviceState</a>.</p>
+
+<p>Before calling this method, you should destroy all <a href="Fifo.html">Fifos</a> and <a href="Graph.html">Graphs</a> that were allocated to this <a href="Device.html">Device</a>. This method should be called before calling <a href="Device.destroy.html">Device.destroy()</a> for an open device.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>When the device has been successfully closed the <a href="DeviceState.html">DeviceState</a> will be CLOSED.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Get a list of valid device identifiers</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+
+<span class="c"># Create a Device instance for the first device found</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+<span class="c"># Open communication with the device</span>
+<span class="n">device</span><span class="o">.</span><span class="nb">open</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Use the device...</span>
+<span class="c">#</span>
+
+<span class="c"># Close the device and destroy the device handle</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Device.destroy.html b/docs/ncapi/ncapi2/py_api/Device.destroy.html
new file mode 100644 (file)
index 0000000..269de5b
--- /dev/null
@@ -0,0 +1,117 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="devicedestroy">Device.destroy()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a>, <a href="Device.open.html">Device.open()</a>, <a href="Device.close.html">Device.close()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method destroys the <a href="Device.html">Device</a> and frees associated resources. This must be called for every <a href="Device.html">Device</a> created.</p>
+
+<p>Before calling this method, you should destroy all <a href="Fifo.html">Fifos</a> and <a href="Graph.html">Graphs</a> that were allocated to this device and then close communication with the device with <a href="Device.close.html">Device.close()</a>.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<p>None.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Get a list of valid device identifiers</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+
+<span class="c"># Create a Device instance for the first device found</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+<span class="c"># Open communication with the device</span>
+<span class="n">device</span><span class="o">.</span><span class="nb">open</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Use the device...</span>
+<span class="c">#</span>
+
+<span class="c"># Close the device and destroy the device handle</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Device.get_option.html b/docs/ncapi/ncapi2/py_api/Device.get_option.html
new file mode 100644 (file)
index 0000000..01509b4
--- /dev/null
@@ -0,0 +1,130 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="deviceget_option">Device.get_option()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a>, <a href="DeviceOption.html">DeviceOption</a>, <a href="Device.set_option.html">Device.set_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method returns the value of an option for the <a href="Device.html">Device</a>. The available options and possible values can be found in the <a href="DeviceOption.html">DeviceOption</a> enumeration.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">value</span> <span class="o">=</span> <span class="n">device</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">option</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A member of the <a href="DeviceOption.html">DeviceOption</a> enumeration that specifies which option value to get.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p><em>value</em></p>
+
+<p>The value for the specified option. The value type depends on the option specified.  See the <a href="DeviceOption.html">DeviceOption</a> enumeration for the type that corresponds to each option.</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a <a href="Status.html">Status.INVALID_PARAMETERS</a> code if an invalid option is passed or Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="DeviceState.html">DeviceState</a> must be CREATED or OPENED.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Get a list of valid device identifiers</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+
+<span class="c"># Create a Device instance for the first device found</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+<span class="c"># Get the device name and output to console</span>
+<span class="k">print</span><span class="p">(</span><span class="n">device</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">DeviceOption</span><span class="o">.</span><span class="n">RO_DEVICE_NAME</span><span class="p">))</span>
+
+<span class="c"># Destroy the device handle</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Device.html b/docs/ncapi/ncapi2/py_api/Device.html
new file mode 100644 (file)
index 0000000..c28cef7
--- /dev/null
@@ -0,0 +1,174 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-device">class Device</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="DeviceOption.html">DeviceOption</a>, <a href="Graph.html">Graph</a>, <a href="Fifo.html">Fifo</a>, <a href="enumerate_devices.html">enumerate_devices()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The <a href="Device.html">Device</a> class represents a neural compute device and provides methods to communicate with the device to perform inferences.</p>
+
+<p>Create an instance of this class each neural compute device. You can get a list of identifiers for neural compute devices present in the system with <a href="enumerate_devices.html">enumerate_devices()</a>.</p>
+
+<h2 id="initialization">Initialization</h2>
+<p>Create a Device instance:</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">identifier</span><span class="p">)</span>
+</code></pre></div></div>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>identifier</td>
+      <td>ctypes.c_void_p</td>
+      <td>The identifier of the device to initialize.<br /><br />A list of valid identifiers can be obtained by calling the mvncapi module global function <a href="enumerate_devices.html">enumerate_devices()</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>When the Device has been successfully created the <a href="DeviceState.html">DeviceState</a> will be CREATED.</p>
+
+<h2 id="methods">Methods</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Method</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="Device.close.html">close</a></td>
+      <td>Cease communication with the device.</td>
+    </tr>
+    <tr>
+      <td><a href="Device.destroy.html">destroy</a></td>
+      <td>Destroy the <a href="Device.html">Device</a> and free associated resources.</td>
+    </tr>
+    <tr>
+      <td><a href="Device.get_option.html">get_option</a></td>
+      <td>Get the value of a <a href="DeviceOption.html">DeviceOption</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="Device.open.html">open</a></td>
+      <td>Initialize the device and open communication.</td>
+    </tr>
+    <tr>
+      <td><a href="Device.set_option.html">set_option</a></td>
+      <td>Set the value of a <a href="DeviceOption.html">DeviceOption</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="typical-usage">Typical Usage</h2>
+
+<ul>
+  <li>Create a <a href="Device.html">Device</a>.</li>
+  <li>Open the device with <a href="Device.open.html">Device.open()</a>.</li>
+  <li>Use the device.</li>
+  <li>Close the device with <a href="Device.close.html">Device.close()</a>.</li>
+  <li>Destroy the <a href="Device.html">Device</a> and free associated resources with <a href="Device.destroy.html">Device.destroy()</a>.</li>
+</ul>
+
+<p>See the <a href="readme.html">Python API Overview</a> for more information about typical API usage.</p>
+
+<h2 id="example">Example</h2>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Get a list of valid device identifiers</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+
+<span class="c"># Create a Device instance for the first device found</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+<span class="c"># Get the device name and output to console</span>
+<span class="k">print</span><span class="p">(</span><span class="n">device</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">DeviceOption</span><span class="o">.</span><span class="n">RO_DEVICE_NAME</span><span class="p">))</span>
+
+<span class="c"># Open communication with the device</span>
+<span class="n">device</span><span class="o">.</span><span class="nb">open</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Use the device...</span>
+<span class="c">#</span>
+
+<span class="c"># Clean up</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Device.open.html b/docs/ncapi/ncapi2/py_api/Device.open.html
new file mode 100644 (file)
index 0000000..a1182ef
--- /dev/null
@@ -0,0 +1,121 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="deviceopen">Device.open()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a>, <a href="Device.close.html">Device.close()</a>, <a href="Device.destroy.html">Device.destroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method initializes the neural compute device and opens communication.</p>
+
+<p>Upon successful return from this method, the <a href="Device.html">Device</a> will be ready for use.</p>
+
+<p>Device communication is closed with <a href="Device.close.html">Device.close()</a>.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">device</span><span class="o">.</span><span class="nb">open</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="Device.html">Device</a> must be opened with this method before being used with any API functions other than <a href="Device.get_option.html">Device.get_option()</a> or <a href="Device.set_option.html">Device.set_option()</a>. When the device has been successfully opened, the device state will be <a href="DeviceState.html">OPENED</a>.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Get a list of valid device identifiers</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+
+<span class="c"># Create a Device instance for the first device found</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+<span class="c"># Open communication with the device</span>
+<span class="n">device</span><span class="o">.</span><span class="nb">open</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Use the device...</span>
+<span class="c">#</span>
+
+<span class="c"># Close the device and destroy the device handle</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Device.set_option.html b/docs/ncapi/ncapi2/py_api/Device.set_option.html
new file mode 100644 (file)
index 0000000..2b02d4e
--- /dev/null
@@ -0,0 +1,121 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="deviceset_option">Device.set_option()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a>, <a href="DeviceOption.html">DeviceOption</a>, <a href="Device.get_option.html">Device.get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method sets an option value for the <a href="Device.html">Device</a>. The available options and possible values can be found in the <a href="DeviceOption.html">DeviceOption</a> enumeration.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">device</span><span class="o">.</span><span class="n">set_option</span><span class="p">(</span><span class="n">option</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A member of the <a href="DeviceOption.html">DeviceOption</a> enumeration that specifies which option value to set.</td>
+    </tr>
+    <tr>
+      <td>value</td>
+      <td><em>varies</em></td>
+      <td>The new value to which the device option will be set.<br /><br />The type to pass for this parameter depends on which option is being set. See the <a href="DeviceOption.html">DeviceOption</a> enumeration for the type that corresponds to each option.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a <a href="Status.html">Status.INVALID_PARAMETERS</a> code if an invalid option is passed or Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>There are currently no settable options for Device.</li>
+  <li>The <a href="DeviceState.html">DeviceState</a> must be CREATED or OPENED.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<p>N/A</p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/DeviceHwVersion.html b/docs/ncapi/ncapi2/py_api/DeviceHwVersion.html
new file mode 100644 (file)
index 0000000..2641660
--- /dev/null
@@ -0,0 +1,95 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-devicehwversionenumenum">class DeviceHwVersion(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a>, <a href="DeviceOption.html">DeviceOption</a>, <a href="Device.get_option.html">Device.get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>DeviceHwVersion is an enumeration that defines neural compute device hardware versions, which can be read with <a href="Device.get_option.html">Device.get_option()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Enumeration Member</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>MA2450</td>
+      <td>A neural compute device hardware version.</td>
+    </tr>
+    <tr>
+      <td>MA2480</td>
+      <td>A neural compute device hardware version.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/DeviceOption.html b/docs/ncapi/ncapi2/py_api/DeviceOption.html
new file mode 100644 (file)
index 0000000..977757c
--- /dev/null
@@ -0,0 +1,191 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-deviceoptionenumenum">class DeviceOption(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a>, <a href="Device.set_option.html">Device.set_option()</a>, <a href="Device.get_option.html">Device.get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>DeviceOption is an enumeration that defines <a href="Device.html">Device</a> options that can be read with <a href="Device.get_option.html">Device.get_option()</a> or set with <a href="Device.set_option.html">Device.set_option()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Option</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>RO_THERMAL_STATS</td>
+      <td>numpy.ndarray of floats</td>
+      <td>Any</td>
+      <td>Device temperatures in degrees Celsius.</td>
+    </tr>
+    <tr>
+      <td>RO_THERMAL_THROTTLING_LEVEL</td>
+      <td>int</td>
+      <td>0, 1, 2</td>
+      <td>0: No limit reached<br />1: Lower guard temperature threshold of chip sensor reached; short throttling time is in action between inferences to protect the device.<br />2: Upper guard temperature of chip sensor reached; long throttling time is in action between inferences to protect the device.</td>
+    </tr>
+    <tr>
+      <td>RO_DEVICE_STATE</td>
+      <td>int</td>
+      <td>Values in the <a href="DeviceState.html">DeviceState</a> enumeration</td>
+      <td>The current state of the <a href="Device.html">Device</a>.</td>
+    </tr>
+    <tr>
+      <td>RO_CURRENT_MEMORY_USED</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The current memory in use on the device in bytes.  This value divided by <a href="DeviceOption.html">RO_MEMORY_SIZE</a> is the percent of memory in use.</td>
+    </tr>
+    <tr>
+      <td>RO_MEMORY_SIZE</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The total memory available on the device in bytes.</td>
+    </tr>
+    <tr>
+      <td>RO_MAX_FIFO_NUM</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The maximum number of <a href="Fifo.html">Fifos</a> that can be allocated for the device.</td>
+    </tr>
+    <tr>
+      <td>RO_ALLOCATED_FIFO_NUM</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The number of <a href="Fifo.html">Fifos</a> currently allocated for the device.</td>
+    </tr>
+    <tr>
+      <td>RO_MAX_GRAPH_NUM</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The maximum number of <a href="Graph.html">Graphs</a> that can be allocated for the device.</td>
+    </tr>
+    <tr>
+      <td>RO_ALLOCATED_GRAPH_NUM</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The number of <a href="Graph.html">Graphs</a> currently allocated for the device.</td>
+    </tr>
+    <tr>
+      <td>RO_CLASS_LIMIT</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The highest option class supported.</td>
+    </tr>
+    <tr>
+      <td>RO_FW_VERSION</td>
+      <td>numpy.ndarray of 4 unsigned ints</td>
+      <td>[<em>major, minor, hardware type, build number</em>]</td>
+      <td>The version of the firmware currently running on the device.</td>
+    </tr>
+    <tr>
+      <td>RO_DEBUG_INFO</td>
+      <td>str</td>
+      <td>Debug info string</td>
+      <td><em>Not yet implemented.</em><br /><br />More detailed debug info when the result of a function call was <a href="Status.html">Status.MYRIAD_ERROR</a>.</td>
+    </tr>
+    <tr>
+      <td>RO_MVTENSOR_VERSION</td>
+      <td>numpy.ndarray of 2 unsigned ints</td>
+      <td>[<em>major, minor</em>]</td>
+      <td>The version of the mvtensor library that was linked with the API.</td>
+    </tr>
+    <tr>
+      <td>RO_DEVICE_NAME</td>
+      <td>str</td>
+      <td>Device name string</td>
+      <td>The internal name of the device.</td>
+    </tr>
+    <tr>
+      <td>RO_MAX_EXECUTORS_NUM</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td><em>Reserved for future use.</em></td>
+    </tr>
+    <tr>
+      <td>RO_HW_VERSION</td>
+      <td>int</td>
+      <td>Values in the <a href="DeviceHwVersion.html">DeviceHwVersion</a> enumeration</td>
+      <td>The hardware version of the device.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li><strong>Options prefixed with ‘RW’ have read/write permission and are both gettable and settable.</strong></li>
+  <li><strong>Options prefixed with ‘RO’ have read-only permission and are only gettable.</strong></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/DeviceState.html b/docs/ncapi/ncapi2/py_api/DeviceState.html
new file mode 100644 (file)
index 0000000..7a4d44a
--- /dev/null
@@ -0,0 +1,99 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-devicestateenumenum">class DeviceState(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a>, <a href="DeviceOption.html">DeviceOption</a>, <a href="Device.get_option.html">Device.get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>DeviceState is an enumeration that defines states of a <a href="Device.html">Device</a>, which can be read with <a href="Device.get_option.html">Device.get_option()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Enumeration Member</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>CREATED</td>
+      <td>The <a href="Device.html">Device</a> has been created, but device communication has not been opened.</td>
+    </tr>
+    <tr>
+      <td>OPENED</td>
+      <td>The device has been initialized and communication has been opened with <a href="Device.open.html">Device.open()</a>.</td>
+    </tr>
+    <tr>
+      <td>CLOSED</td>
+      <td>Communication with the device has been closed with <a href="Device.close.html">Device.close()</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Fifo.allocate.html b/docs/ncapi/ncapi2/py_api/Fifo.allocate.html
new file mode 100644 (file)
index 0000000..bae9731
--- /dev/null
@@ -0,0 +1,157 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="fifoallocate">Fifo.allocate()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="Fifo.destroy.html">Fifo.destroy()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method allocates memory for the <a href="Fifo.html">Fifo</a> for the specified <a href="Device.html">Device</a> based on the number of elements the <a href="Fifo.html">Fifo</a> will hold and a <a href="TensorDescriptor.html">TensorDescriptor</a> struct, which describes the expected shape of the <a href="Fifo.html">Fifo’s</a> elements. Each <a href="Fifo.html">Fifo</a> can only be allocated to a single device.</p>
+
+<p>Upon successful return from this method, the <a href="Fifo.html">Fifo</a> will be ready for reading/writing.</p>
+
+<p>The allocated memory is freed with <a href="Fifo.destroy.html">Fifo.destroy()</a>.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">fifo</span><span class="o">.</span><span class="n">allocate</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">tensor_desc</span><span class="p">,</span> <span class="n">n_elem</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>device</td>
+      <td><a href="Device.html">Device</a></td>
+      <td>A <a href="Device.html">Device</a> that this <a href="Fifo.html">Fifo</a> will be associated with. The <a href="DeviceState.html">DeviceState</a> must be OPENED.</td>
+    </tr>
+    <tr>
+      <td>tensor_desc</td>
+      <td><a href="TensorDescriptor.html">TensorDescriptor</a></td>
+      <td>A TensorDescriptor structure that describes the elements of the Fifo.<br /><br /><a href="Graph.get_option.html">Graph.get_option()</a> with <a href="GraphOption.html">GraphOption.RO_INPUT_TENSOR_DESCRIPTORS</a> or <a href="GraphOption.html">GraphOption.RO_OUTPUT_TENSOR_DESCRIPTORS</a> will return a list of <a href="TensorDescriptor.html">TensorDescriptors</a> for that <a href="Graph.html">Graph</a>.</td>
+    </tr>
+    <tr>
+      <td>n_elem</td>
+      <td>int</td>
+      <td>The maximum number of elements that the <a href="Fifo.html">Fifo</a> will be able to contain.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="Fifo.html">Fifo</a> must be allocated with this method before being used for any other API other than <a href="Fifo.get_option.html">Fifo.get_option()</a> or <a href="Fifo.set_option.html">Fifo.set_option()</a>. When the Fifo is successfully allocated the <a href="FifoState.html">FifoState</a> will be ALLOCATED.</li>
+  <li>Any settable <a href="FifoOption.html">FifoOptions</a> must be set before calling this method.</li>
+  <li><a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a> can be used instead to easily create and allocate two <a href="Fifo.html">Fifos</a> for input and output in addition to allocating a <a href="Graph.html">Graph</a> to a <a href="Device.html">Device</a>; this internally calls <a href="Fifo.allocate.html">Fifo.allocate()</a> and <a href="Graph.allocate.html">Graph.allocate()</a>.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c">#</span>
+<span class="c"># Open a Device and allocate a Graph...</span>
+<span class="c">#</span>
+
+<span class="c"># Create an input Fifo</span>
+<span class="n">input_fifo</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Fifo</span><span class="p">(</span><span class="s">'input1'</span><span class="p">,</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_WO</span><span class="p">)</span>
+
+<span class="c"># Get an input TensorDescriptor from a graph</span>
+<span class="n">input_descs</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">GraphOption</span><span class="o">.</span><span class="n">RO_INPUT_TENSOR_DESCRIPTORS</span><span class="p">)</span>
+
+<span class="c"># Allocate the Fifo buffer with the graph input TensorDescriptor to the device</span>
+<span class="n">NUM_ELEMENTS</span> <span class="o">=</span> <span class="mi">2</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">allocate</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">input_descs</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">NUM_ELEMENTS</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Write elements to the Fifo with Fifo.write_elem() and initiate inferences with Graph.queue_inference()</span>
+<span class="c">#</span>
+
+<span class="c"># Destroy the Fifo</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Perform other clean up...</span>
+<span class="c">#</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Fifo.destroy.html b/docs/ncapi/ncapi2/py_api/Fifo.destroy.html
new file mode 100644 (file)
index 0000000..1719a6a
--- /dev/null
@@ -0,0 +1,124 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="fifodestroy">Fifo.destroy()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="Fifo.allocate.html">Fifo.allocate()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method destroys the <a href="Fifo.html">Fifo</a> and frees associated resources. This must be called for every <a href="Fifo.html">Fifo</a> created.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+
+<ul>
+  <li>All elements must be removed from the <a href="Fifo.html">Fifo</a> before calling this method.
+    <ul>
+      <li>For input <a href="Fifo.html">Fifos</a> (type <a href="FifoType.html">FifoType.HOST_WO</a>), elements are removed by calling <a href="Graph.queue_inference.html">Graph.queue_inference()</a>.</li>
+      <li>For output <a href="Fifo.html">Fifos</a> (type <a href="FifoType.html">FifoType.HOST_RO</a>), elements are removed by calling <a href="Fifo.read_elem.html">Fifo.read_elem()</a>.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c">#</span>
+<span class="c"># Open a Device, create a Graph, and load graph data from file...</span>
+<span class="c">#</span>
+
+<span class="c"># Allocate the Graph and create and allocate two associate Fifos for input and output</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+<span class="c">#</span>
+<span class="c"># Use the Fifos...</span>
+<span class="c">#</span>
+
+<span class="c"># Destroy the Fifos</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Perform other clean up...</span>
+<span class="c">#</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Fifo.get_option.html b/docs/ncapi/ncapi2/py_api/Fifo.get_option.html
new file mode 100644 (file)
index 0000000..75bfd8b
--- /dev/null
@@ -0,0 +1,127 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="fifoget_option">Fifo.get_option()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="FifoOption.html">FifoOption</a>, <a href="Fifo.set_option.html">Fifo.set_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method returns an option value for the <a href="Fifo.html">Fifo</a>. The available options and possible values can be found in the <a href="FifoOption.html">FifoOption</a> enumeration.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">value</span> <span class="o">=</span> <span class="n">fifo</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">option</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A member of the <a href="FifoOption.html">FifoOption</a> enumeration that specifies which option value to get.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p><em>value</em></p>
+
+<p>The value for the specified option. The value type depends on the option specified. See the <a href="FifoOption.html">FifoOption</a> enumeration for the type that corresponds to each option.</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a <a href="Status.html">Status.INVALID_PARAMETERS</a> code if an invalid option is passed or Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="FifoState.html">FifoState</a> must be CREATED or ALLOCATED.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Initialize a Fifo</span>
+<span class="n">fifo</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Fifo</span><span class="p">(</span><span class="s">''</span><span class="p">,</span> <span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_RW</span><span class="p">)</span>
+
+<span class="c"># Print the Fifo data type</span>
+<span class="k">print</span><span class="p">(</span><span class="s">'The Fifo data type is'</span><span class="p">,</span> <span class="n">fifo</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoOption</span><span class="o">.</span><span class="n">RW_DATA_TYPE</span><span class="p">))</span>
+
+<span class="c"># Destroy the Fifo</span>
+<span class="n">fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Fifo.html b/docs/ncapi/ncapi2/py_api/Fifo.html
new file mode 100644 (file)
index 0000000..9af2f77
--- /dev/null
@@ -0,0 +1,247 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-fifo">class Fifo</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="FifoOption.html">FifoOption</a>, <a href="Device.html">Device</a>, <a href="Graph.html">Graph</a>, <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a>, <a href="Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The <a href="Fifo.html">Fifo</a> class represents a first in, first out (FIFO) queue for network input and output.</p>
+
+<p>Typically two instances of this class are created for each <a href="Graph.html">Graph</a> - one for input and one for output.</p>
+
+<h2 id="initialization">Initialization</h2>
+<p>Create a Fifo instance:</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">fifo</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Fifo</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">fifo_type</span><span class="p">)</span>
+</code></pre></div></div>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>name</td>
+      <td>str</td>
+      <td>A name for the <a href="Fifo.html">Fifo</a>; this can be can be anything you like up to mvncapi.MAX_NAME_SIZE characters, or just an empty string.<br /><br />The name can be retrieved later with <a href="Fifo.get_option.html">Fifo.get_option()</a>.</td>
+    </tr>
+    <tr>
+      <td>fifo_type</td>
+      <td>int</td>
+      <td>A member of the <a href="FifoType.html">FifoType</a> enumeration.<br /><br />The API must be able to write to input <a href="Fifo.html">Fifos</a> and read from output <a href="Fifo.html">Fifos</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>You can also create and allocate both an input <a href="Fifo.html">Fifo</a> and an output <a href="Fifo.html">Fifo</a> in one call with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a>.</p>
+
+<p>When the Fifo has been successfully created the <a href="FifoState.html">FifoState</a> will be CREATED.</p>
+
+<h2 id="methods">Methods</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Method</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="Fifo.allocate.html">allocate</a></td>
+      <td>Allocate a <a href="Fifo.html">Fifo</a> queue for a particular device..</td>
+    </tr>
+    <tr>
+      <td><a href="Fifo.destroy.html">destroy</a></td>
+      <td>Destroy the <a href="Fifo.html">Fifo</a> and free associated resources. The <a href="Fifo.html">Fifo</a> queue must be empty.</td>
+    </tr>
+    <tr>
+      <td><a href="Fifo.get_option.html">get_option</a></td>
+      <td>Get the value of a <a href="FifoOption.html">FifoOption</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="Fifo.read_elem.html">read_elem</a></td>
+      <td>Read an element from the <a href="Fifo.html">Fifo</a>. The <a href="Fifo.html">Fifo</a> must be <a href="FifoType.html">FifoType.HOST_RO</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="Fifo.remove_elem.html">remove_elem</a></td>
+      <td><em>Not yet implemented.</em><br /><br />Remove an element from a <a href="Fifo.html">Fifo</a> without returning it.</td>
+    </tr>
+    <tr>
+      <td><a href="Fifo.set_option.html">set_option</a></td>
+      <td>Set the value of a <a href="FifoOption.html">FifoOption</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="Fifo.write_elem.html">write_elem</a></td>
+      <td>Send an input tensor to the <a href="Fifo.html">Fifo</a> queue. The <a href="Fifo.html">Fifo</a> must be <a href="FifoType.html">FifoType.HOST_WO</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h1 id="typical-usage">Typical Usage</h1>
+
+<ul>
+  <li>Allocate a <a href="Graph.html">Graph</a> for a <a href="Device.html">Device</a> and create and allocate associated input and output <a href="Fifo.html">Fifos</a> with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a>.
+    <ul>
+      <li>Alternatively, you can create <a href="Fifo.html">Fifos</a> individually and then allocate them with <a href="Fifo.allocate.html">Fifo.allocate()</a>. In this case you would use <a href="Graph.allocate.html">Graph.allocate()</a> to allocate the <a href="Graph.html">Graph</a> for the <a href="Device.html">Device</a>.</li>
+    </ul>
+  </li>
+  <li>Write an input tensor to the input <a href="Fifo.html">Fifo</a> and queue an inference with <a href="Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a>.
+    <ul>
+      <li>You can also use <a href="Fifo.write_elem.html">Fifo.write_elem()</a> to write input tensors to the <a href="Fifo.html">Fifo</a> and then call <a href="Graph.queue_inference.html">Graph.queue_inference()</a> for each to queue the inference.</li>
+    </ul>
+  </li>
+  <li>Read result tensor(s) from the output <a href="Fifo.html">Fifo</a> with <a href="Fifo.read_elem.html">Fifo.read_elem()</a>.</li>
+  <li>When finished, destroy each <a href="Fifo.html">Fifo</a> and free associated resources with <a href="Fifo.destroy.html">Fifo.destroy()</a>.</li>
+</ul>
+
+<p>See the <a href="readme.html">Python API Overview</a> for more information about typical API usage.</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="examples">Examples</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="s">"""Example Fifo usage with convenience functions."""</span>
+<span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c">#</span>
+<span class="c"># Open a Device, create a Graph, and load graph data from file...</span>
+<span class="c">#</span>
+
+<span class="c"># Allocate the Graph and create and allocate two associate Fifos for input and output</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c"># Write an input tensor to the input Fifo and queue an inference</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">queue_inference_with_fifo_elem</span><span class="p">(</span><span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span><span class="p">,</span> <span class="n">input_tensor</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="s">'tensor1'</span><span class="p">)</span>
+
+<span class="c"># Read the inference result tensor from the output Fifo</span>
+<span class="n">result_tensor</span><span class="p">,</span> <span class="n">user_obj</span> <span class="o">=</span> <span class="n">output_fifo</span><span class="o">.</span><span class="n">read_elem</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Do something with the result...</span>
+<span class="c">#</span>
+
+<span class="c"># Destroy the Fifos</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Perform other clean up...</span>
+<span class="c">#</span>
+</code></pre></div></div>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="s">"""Example Fifo usage without convenience functions."""</span>
+<span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c">#</span>
+<span class="c"># Open a Device and allocate a Graph...</span>
+<span class="c">#</span>
+
+<span class="c"># Initialize two Fifos for input and output</span>
+<span class="n">input_fifo</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Fifo</span><span class="p">(</span><span class="s">'input1'</span><span class="p">,</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_WO</span><span class="p">)</span>
+<span class="n">output_fifo</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Fifo</span><span class="p">(</span><span class="s">'output1'</span><span class="p">,</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_RO</span><span class="p">)</span>
+
+<span class="c"># Get input and output TensorDescriptors from the graph</span>
+<span class="n">input_descriptor</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">GraphOption</span><span class="o">.</span><span class="n">RO_INPUT_TENSOR_DESCRIPTORS</span><span class="p">)</span>
+<span class="n">output_descriptor</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">GraphOption</span><span class="o">.</span><span class="n">RO_OUTPUT_TENSOR_DESCRIPTORS</span><span class="p">)</span>
+
+<span class="c"># Allocate the Fifo buffers</span>
+<span class="n">NUM_ELEMENTS</span> <span class="o">=</span> <span class="mi">2</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">allocate</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">input_descriptor</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">NUM_ELEMENTS</span><span class="p">)</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">allocate</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">output_descriptor</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">NUM_ELEMENTS</span><span class="p">)</span>
+
+<span class="c"># Write an input tensor to the input_fifo</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">write_elem</span><span class="p">(</span><span class="n">input_tensor</span><span class="p">,</span> <span class="s">'tensor1'</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Queue an inference with Graph.queue_inference()...</span>
+<span class="c">#</span>
+
+<span class="c"># Read the inference result tensor from the output Fifo</span>
+<span class="n">result_tensor</span><span class="p">,</span> <span class="n">user_obj</span> <span class="o">=</span> <span class="n">output_fifo</span><span class="o">.</span><span class="n">read_elem</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Do something with the result...</span>
+<span class="c">#</span>
+
+<span class="c"># Destroy the Fifos</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Perform other clean up...</span>
+<span class="c">#</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Fifo.read_elem.html b/docs/ncapi/ncapi2/py_api/Fifo.read_elem.html
new file mode 100644 (file)
index 0000000..efbfcc3
--- /dev/null
@@ -0,0 +1,138 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="fiforead_elem">Fifo.read_elem()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="Fifo.write_elem.html">Fifo.write_elem()</a>, <a href="Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_With_fifo_elem()</a>, <a href="Graph.queue_inference.html">Graph.queue_inference()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method returns an element from the <a href="Fifo.html">Fifo</a>, usually the result of an inference, along with the associated user-defined object that was passed to <a href="Fifo.write_elem.html">Fifo.write_elem()</a> or <a href="Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a>.</p>
+
+<p>This will also remove the element from the queue.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">output_tensor</span><span class="p">,</span> <span class="n">user_obj</span> <span class="o">=</span> <span class="n">fifo</span><span class="o">.</span><span class="n">read_elem</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p><em>tensor, user_obj</em></p>
+
+<p>A numpy.ndarray with output tensor data of the type specified by the <a href="FifoDataType.html">FifoDataType</a> option, and the user-defined data that was passed to <a href="Fifo.write_elem.html">Fifo.write_elem()</a> or <a href="Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a>.</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="FifoType.html">FifoType</a> set during initialization must allow read access for the API.</li>
+  <li>The <a href="Fifo.html">Fifo</a> cannot be written to or read from until it is allocated with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a> or <a href="Fifo.allocate.html">Fifo.allocate()</a>. The <a href="FifoState.html">FifoState</a> must be ALLOCATED.</li>
+  <li>The API can only read each element once even if <a href="FifoOption.html">FifoOption.RW_CONSUMER_COUNT</a> is greater than 1.</li>
+  <li>This is a blocking call if <a href="FifoOption.html">FifoOption.RW_DONT_BLOCK</a> is false. If the <a href="Fifo.html">Fifo</a> is empty this method will not return until there is an element to read.
+    <ul>
+      <li>You can check the current fill level of the <a href="Fifo.html">Fifo</a> with <a href="Fifo.get_option.html">Fifo.get_option()</a> for <a href="FifoOption.html">FifoOption.RO_READ_FILL_LEVEL</a>.</li>
+      <li>After an inference is queued there is a delay while device communication occurs and the inference is performed before the element is removed from the input <a href="Fifo.html">Fifo</a> and placed into the output <a href="Fifo.html">Fifo</a>.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c">#</span>
+<span class="c"># Open a Device, create a Graph, and load graph data from file...</span>
+<span class="c">#</span>
+
+<span class="c"># Allocate the Graph and create and allocate two associate Fifos for input and output</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Write elements to an input Fifo with Fifo.write_elem() and initiate inferences with Graph.queue_inference()</span>
+<span class="c">#</span>
+
+<span class="c"># Read the result to the output Fifo</span>
+<span class="n">result_tensor</span><span class="p">,</span> <span class="n">user_obj</span> <span class="o">=</span> <span class="n">output_fifo</span><span class="o">.</span><span class="n">read_elem</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Do something with the result...</span>
+<span class="c">#</span>
+
+<span class="c"># Destroy the Fifos</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Perform other clean up...</span>
+<span class="c">#</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Fifo.remove_elem.html b/docs/ncapi/ncapi2/py_api/Fifo.remove_elem.html
new file mode 100644 (file)
index 0000000..c0aa8d3
--- /dev/null
@@ -0,0 +1,104 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="fiforemove_elem">Fifo.remove_elem()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="Fifo.read_elem.html">Fifo.read_elem()</a>, <a href="Fifo.write_elem.html">Fifo.write_elem()</a>,</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p><strong>This method is not yet implemented.</strong></p>
+
+<p>This method removes an element from the <a href="Fifo.html">Fifo</a> when more control is required with regard to queue management.</p>
+
+<p>For the general case when an element is read from a <a href="Fifo.html">Fifo</a> using <a href="Fifo.read_elem.html">Fifo.read_elem()</a> it is also removed.</p>
+
+<h2 id="syntax">Syntax</h2>
+<p><strong>This method is not yet implemented.</strong></p>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">fifo</span><span class="o">.</span><span class="n">remove_elem</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li><strong>This method is not yet implemented.</strong></li>
+</ul>
+
+<h2 id="example">Example</h2>
+<p>N/A</p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Fifo.set_option.html b/docs/ncapi/ncapi2/py_api/Fifo.set_option.html
new file mode 100644 (file)
index 0000000..0250c03
--- /dev/null
@@ -0,0 +1,134 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="fifoset_option">Fifo.set_option()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="FifoOption.html">FifoOption</a>, <a href="Fifo.get_option.html">Fifo.get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method sets an option value for the <a href="Fifo.html">Fifo</a>. The available options and possible values can be found in the <a href="FifoOption.html">FifoOption</a> enumeration.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">fifo</span><span class="o">.</span><span class="n">set_option</span><span class="p">(</span><span class="n">option</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A member of the <a href="FifoOption.html">FifoOption</a> enumeration that specifies which option value to set.</td>
+    </tr>
+    <tr>
+      <td>value</td>
+      <td><em>varies</em></td>
+      <td>The new value to which the option will be set.<br /><br />The type to pass for this parameter depends on which option is being set. See the <a href="FifoOption.html">FifoOption</a> enumeration for the type that corresponds to each option.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a <a href="Status.html">Status.INVALID_PARAMETERS</a> code if an invalid option is passed or Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>All <a href="Fifo.html">Fifo</a> options must be set before calling <a href="Fifo.allocate.html">Fifo.allocate()</a>. The <a href="FifoState.html">FifoState</a> must be CREATED.
+    <ul>
+      <li>Using <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a> to create and allocate <a href="Fifo.html">Fifos</a> does not allow for any Fifo options to be set other than those specified in that function’s parameters.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Initialize a Fifo</span>
+<span class="n">fifo</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Fifo</span><span class="p">(</span><span class="s">''</span><span class="p">,</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_RW</span><span class="p">)</span>
+
+<span class="c"># Set the Fifo data type to FP16</span>
+<span class="n">fifo</span><span class="o">.</span><span class="n">set_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoOption</span><span class="o">.</span><span class="n">RW_DATA_TYPE</span><span class="p">,</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoDataType</span><span class="o">.</span><span class="n">FP16</span><span class="p">)</span>
+
+<span class="c"># Destroy the Fifo</span>
+<span class="n">fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Fifo.write_elem.html b/docs/ncapi/ncapi2/py_api/Fifo.write_elem.html
new file mode 100644 (file)
index 0000000..7ac879f
--- /dev/null
@@ -0,0 +1,156 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="fifowrite_elem">Fifo.write_elem()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="Fifo.read_elem.html">Fifo.read_elem()</a>, <a href="Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method writes an element to the <a href="Fifo.html">Fifo</a>, usually the input tensor for an inference.</p>
+
+<p>After the tensor data is written to the <a href="Fifo.html">Fifo</a>, an inference can be queued with <a href="Graph.queue_inference.html">Graph.queue_inference()</a>. Alternatively, <a href="Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a> can be used to write the tensor to the input <a href="Fifo.html">Fifo</a> and queue the inference in one call.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">fifo</span><span class="o">.</span><span class="n">write_elem</span><span class="p">(</span><span class="n">input_tensor</span><span class="p">,</span> <span class="n">user_obj</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>input_tensor</td>
+      <td>numpy.ndarray</td>
+      <td>Input tensor data of the type specified by the <a href="FifoDataType.html">FifoDataType</a> option. This data is typically a representation of each color channel in each pixel of an image.</td>
+    </tr>
+    <tr>
+      <td>user_obj</td>
+      <td><em>any</em></td>
+      <td>User-defined data that will be returned along with the inference result. This can be anything that you want associated with the inference result, such as the original inference input or a window handle, or can be None.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="FifoType.html">FifoType</a> set during initialization must allow write access for the API.</li>
+  <li>The <a href="Fifo.html">Fifo</a> cannot be written to or read from until it is allocated with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a> or <a href="Fifo.allocate.html">Fifo.allocate()</a>.</li>
+  <li>This is a blocking call if <a href="FifoOption.html">FifoOption.RW_DONT_BLOCK</a> is false. If the <a href="Fifo.html">Fifo</a> is full this method will not return until there is space to successfully write.
+    <ul>
+      <li>The Fifo’s capacity is set when the Fifo is allocated with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a> or <a href="Fifo.allocate.html">Fifo.allocate()</a>. The <a href="FifoState.html">FifoState</a> must be ALLOCATED.</li>
+      <li>You can check the capacity and the current fill level of the <a href="Fifo.html">Fifo</a> with <a href="Fifo.get_option.html">Fifo.get_option()</a> for <a href="FifoOption.html">FifoOption.RO_CAPACITY</a> and <a href="FifoOption.html">FifoOption.RO_WRITE_FILL_LEVEL</a>.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c">#</span>
+<span class="c"># Open a Device, create a Graph, and load graph data from file...</span>
+<span class="c">#</span>
+
+<span class="c"># Allocate the Graph and create and allocate two associate Fifos for input and output</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Get an input tensor and do pre-processing</span>
+<span class="c">#</span>
+
+<span class="c"># Write the input tensor to the Fifo</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">write_elem</span><span class="p">(</span><span class="n">input_tensor</span><span class="p">,</span> <span class="s">'input1'</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Queue an inference with Graph.queue_inference(), read the result and do something with it...</span>
+<span class="c">#</span>
+
+<span class="c"># Destroy the Fifos</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+
+<span class="c">#</span>
+<span class="c"># Perform other clean up...</span>
+<span class="c">#</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/FifoDataType.html b/docs/ncapi/ncapi2/py_api/FifoDataType.html
new file mode 100644 (file)
index 0000000..9b8d583
--- /dev/null
@@ -0,0 +1,97 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-fifodatatypeenumenum">class FifoDataType(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="FifoOption.html">FifoOption</a>, <a href="Fifo.get_option.html">Fifo.get_option()</a>, <a href="Fifo.set_option.html">Fifo.set_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>FifoDataType is an enumeration that defines <a href="Fifo.html">Fifo</a> data types, which can be read with <a href="Fifo.get_option.html">Fifo.get_option()</a> or set with <a href="Fifo.set_option.html">Fifo.set_option()</a> or <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a>.</p>
+
+<p>The default data type is FP32. If the input <a href="Fifo.html">Fifo’s</a> <a href="FifoDataType.html">FifoDataType</a> is configured to FP32, the API will convert the data to the FP16 data type automatically when performing inferences. If the output <a href="Fifo.html">Fifo’s</a> <a href="FifoDataType.html">FifoDataType</a> is configured to 32FP, the API will convert the output back to the FP32 data type.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Enumeration Member</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>FP16</td>
+      <td>The data is in half precision (16 bit) floating point format (FP16).</td>
+    </tr>
+    <tr>
+      <td>FP32</td>
+      <td>The data is in full precision (32 bit) floating point format (FP32).<br /><br />This is the C float type for many compilers and computer architectures.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/FifoOption.html b/docs/ncapi/ncapi2/py_api/FifoOption.html
new file mode 100644 (file)
index 0000000..d252d0d
--- /dev/null
@@ -0,0 +1,156 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-fifooptionenumenum">class FifoOption(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="Fifo.set_option.html">Fifo.set_option()</a>, <a href="Fifo.get_option.html">Fifo.get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>FifoOption is an enumeration that defines <a href="Fifo.html">Fifo</a> options that can be read with <a href="Fifo.get_option.html">Fifo.get_option()</a> or set with <a href="Fifo.set_option.html">Fifo.set_option()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Option</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>RW_TYPE</td>
+      <td>int</td>
+      <td>Values in the <a href="FifoType.html">FifoType</a> enumeration</td>
+      <td>The type of <a href="Fifo.html">Fifo</a> (read-only or write-only).</td>
+    </tr>
+    <tr>
+      <td>RW_CONSUMER_COUNT</td>
+      <td>int</td>
+      <td>1</td>
+      <td>The number of times an element must be read by a graph or the API before the element is removed <em>(default 1)</em>. The API can always only read once even if this is greater than 1.<br /><br /><em>Only 1 currently supported.</em></td>
+    </tr>
+    <tr>
+      <td>RW_DATA_TYPE</td>
+      <td>int</td>
+      <td>Values in the <a href="FifoDataType.html">FifoDataType</a> enumeration</td>
+      <td>The type of data that will be placed in the <a href="Fifo.html">Fifo</a> (default: 32FP).<br /><br />Regardless of what data types the input and output <a href="Fifo.html">Fifos</a> are configured for, the API will convert tensors to 16FP while performing inferences.</td>
+    </tr>
+    <tr>
+      <td>RW_DONT_BLOCK</td>
+      <td>int</td>
+      <td>0</td>
+      <td>0: <a href="Fifo.write_elem.html">Fifo.write_elem()</a> will block if the input <a href="Fifo.html">Fifo</a> is full and <a href="Fifo.read_elem.html">Fifo.read_elem()</a> will block if the output <a href="Fifo.html">Fifo</a> is empty <em>(default)</em>. <br />1: <em>Not yet implemented.</em></td>
+    </tr>
+    <tr>
+      <td>RO_CAPACITY</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The maximum number of elements the <a href="Fifo.html">Fifo</a> can hold. This is set with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a> or <a href="Fifo.allocate.html">Fifo.allocate()</a>.</td>
+    </tr>
+    <tr>
+      <td>RO_READ_FILL_LEVEL</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The number of tensors (Fifo elements) in the queue for a readable <a href="Fifo.html">Fifo</a>.</td>
+    </tr>
+    <tr>
+      <td>RO_WRITE_FILL_LEVEL</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The number of tensors (Fifo elements0 in the queue for a writable <a href="Fifo.html">Fifo</a>.</td>
+    </tr>
+    <tr>
+      <td>RO_TENSOR_DESCRIPTOR</td>
+      <td><a href="TensorDescriptor.html">TensorDescriptor</a></td>
+      <td>N/A</td>
+      <td>The Fifo’s <a href="TensorDescriptor.html">TensorDescriptor</a>, which describes the shape of tensors that this <a href="Fifo.html">Fifo</a> will hold. This is set with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a> or <a href="Fifo.allocate.html">Fifo.allocate()</a>.</td>
+    </tr>
+    <tr>
+      <td>RO_STATE</td>
+      <td>int</td>
+      <td>Values in the <a href="FifoState.html">FifoState</a> enumeration</td>
+      <td>The current state of the <a href="Fifo.html">Fifo</a>.</td>
+    </tr>
+    <tr>
+      <td>RO_NAME</td>
+      <td>str</td>
+      <td>Fifo name string</td>
+      <td>The name of the <a href="Fifo.html">Fifo</a> that was set when the <a href="Fifo.html">Fifo</a> was created.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li><strong>Options prefixed with ‘RW’ have read/write permission and are both gettable and settable.</strong></li>
+  <li><strong>Options prefixed with ‘RO’ have read-only permission and are only gettable.</strong></li>
+  <li><strong>All settable <a href="Fifo.html">Fifo</a> options must be set before <a href="Fifo.allocate.html">Fifo.allocate()</a> is called for this <a href="Fifo.html">Fifo</a>.</strong></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/FifoState.html b/docs/ncapi/ncapi2/py_api/FifoState.html
new file mode 100644 (file)
index 0000000..a14244c
--- /dev/null
@@ -0,0 +1,95 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-fifostateenumenum">class FifoState(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="FifoOption.html">FifoOption</a>, <a href="Fifo.get_option.html">Fifo.get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>FifoState is an enumeration that defines <a href="Fifo.html">Fifo</a> states, which can be read with <a href="Fifo.get_option.html">Fifo.get_option()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Enumeration Member</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>CREATED</td>
+      <td>The <a href="Fifo.html">Fifo</a> has been created but has not been allocated for a device.</td>
+    </tr>
+    <tr>
+      <td>ALLOCATED</td>
+      <td>The <a href="Fifo.html">Fifo</a> has been created and allocated for a device with <a href="Fifo.allocate.html">Fifo.allocate()</a> or <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/FifoType.html b/docs/ncapi/ncapi2/py_api/FifoType.html
new file mode 100644 (file)
index 0000000..60118da
--- /dev/null
@@ -0,0 +1,95 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-fifotypeenumenum">class FifoType(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Fifo.html">Fifo</a>, <a href="FifoOption.html">FifoOption</a>, <a href="Fifo.get_option.html">Fifo.get_option()</a>, <a href="Fifo.set_option.html">Fifo.set_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>FifoType is an enumeration that defines <a href="Fifo.html">Fifo</a> access types, which can be read with <a href="Fifo.get_option.html">Fifo.get_option()</a> or set with <a href="Fifo.set_option.html">Fifo.set_option()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Enumeration Member</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>HOST_RO</td>
+      <td>API can only read. Graphs can read/write.<br /><br />This type should be used for output <a href="Fifo.html">Fifos</a>.</td>
+    </tr>
+    <tr>
+      <td>HOST_WO</td>
+      <td>API can only write. Graphs can only read.<br /><br />This type should be used for input <a href="Fifo.html">Fifos</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/GlobalOption.html b/docs/ncapi/ncapi2/py_api/GlobalOption.html
new file mode 100644 (file)
index 0000000..81ca45c
--- /dev/null
@@ -0,0 +1,107 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-globaloptionenumenum">class GlobalOption(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="global_set_option.html">global_set_option()</a>, <a href="global_get_option.html">global_get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>GlobalOption is an enumeration that defines application-level options that can be read with <a href="global_get_option.html">global_get_option()</a> or set with <a href="global_set_option.html">global_set_option()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Option</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>RW_LOG_LEVEL</td>
+      <td>int</td>
+      <td>0, 1, 2, 3, 4</td>
+      <td>The logging level for the application:<br />0 = MVLOG_DEBUG, debug and above (full verbosity)<br />1 = MVLOG_INFO, info and above<br />2 = MVLOG_WARN, warnings and above <em>(default)</em> <br />3 = MVLOG_ERROR, errors and above<br />4 = MVLOG_FATAL, fatal only</td>
+    </tr>
+    <tr>
+      <td>RO_API_VERSION</td>
+      <td>numpy.ndarray of 4 unsigned ints</td>
+      <td>[<em>major, minor, hotfix, release</em>]</td>
+      <td>The API version.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li><strong>Options prefixed with ‘RW’ have read/write permission and are both gettable and settable.</strong></li>
+  <li><strong>Options prefixed with ‘RO’ have read-only permission and are only gettable.</strong></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Graph.allocate.html b/docs/ncapi/ncapi2/py_api/Graph.allocate.html
new file mode 100644 (file)
index 0000000..9fffdec
--- /dev/null
@@ -0,0 +1,152 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphallocate">Graph.allocate()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a>, <a href="Graph.html">Graph</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method allocates the <a href="Graph.html">Graph</a> to a <a href="Device.html">Device</a>. Each <a href="Graph.html">Graph</a> instance can only be allocated to a single <a href="Device.html">Device</a> instance.</p>
+
+<p>Upon successful return from this method, the <a href="Graph.html">Graph</a> will be ready to perform inferences.</p>
+
+<p><a href="Graph.destroy.html">Graph.destroy()</a> frees the memory allocated with this method.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">graph</span><span class="o">.</span><span class="n">allocate</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>device</td>
+      <td><a href="Device.html">Device</a></td>
+      <td>A <a href="Device.html">Device</a> that this <a href="Graph.html">Graph</a> will be allocated to. The <a href="DeviceState.html">DeviceState</a> must be OPENED.</td>
+    </tr>
+    <tr>
+      <td>graph_buffer</td>
+      <td>bytes</td>
+      <td>Raw data read from a neural network graph file that was created with the NCSDK mvNCCompile tool.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a <a href="Status.html">Status.INVALID_PARAMETERS</a> code if an invalid option is passed or Exception with another status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<p>None.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Get a list of valid device identifiers</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+
+<span class="c"># Create a Device instance for the first device found</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+<span class="c"># Open communication with the device</span>
+<span class="n">device</span><span class="o">.</span><span class="nb">open</span><span class="p">()</span>
+
+<span class="c"># Create a Graph</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'graph1'</span><span class="p">)</span>
+
+<span class="c"># Read a compiled network graph from file (set the graph_filepath correctly for your graph file)</span>
+<span class="n">graph_filepath</span> <span class="o">=</span> <span class="s">'./graph'</span>
+<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">graph_filepath</span><span class="p">,</span> <span class="s">'rb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+    <span class="n">graph_buffer</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+
+<span class="c"># Allocate the graph on the device</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">allocate</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Use the device...</span>
+<span class="c">#</span>
+
+<span class="c"># Deallocate and destroy the graph handle, close the device, and destroy the device handle</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Graph.allocate_with_fifos.html b/docs/ncapi/ncapi2/py_api/Graph.allocate_with_fifos.html
new file mode 100644 (file)
index 0000000..7810440
--- /dev/null
@@ -0,0 +1,205 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphallocate_with_fifos">Graph.allocate_with_fifos()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a>, <a href="Graph.html">Graph</a>, <a href="Fifo.html">Fifo</a>, <a href="Graph.allocate.html">Graph.allocate()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method allocates a network graph to the device and creates and allocates two associated <a href="Fifo.html">Fifos</a> for graph input and output. This is a convenient way to set up a <a href="Graph.html">Graph</a> for inference without setting up <a href="Fifo.html">Fifos</a> explicitly. Each <a href="Graph.html">Graph</a> instance can only be allocated to a single <a href="Device.html">Device</a> instance.</p>
+
+<p>Upon successful return from this method, the <a href="Graph.html">Graph</a> will be ready to perform inferences and the input and output <a href="Fifo.html">Fifos</a> will be ready for reading/writing.</p>
+
+<p>Calling <a href="Graph.destroy.html">Graph.destroy()</a> for the <a href="Graph.html">Graph</a> and <a href="Fifo.destroy.html">Fifo.destroy()</a> for each <a href="Fifo.html">Fifo</a> frees the memory allocated with this method.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span>
+        <span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">,</span>
+        <span class="n">input_fifo_type</span><span class="o">=</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_WO</span><span class="p">,</span> 
+        <span class="n">input_fifo_num_elem</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
+        <span class="n">input_fifo_data_type</span><span class="o">=</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoDataType</span><span class="o">.</span><span class="n">FP32</span><span class="p">,</span>
+        <span class="n">output_fifo_type</span><span class="o">=</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_RO</span><span class="p">,</span> 
+        <span class="n">output_fifo_num_elem</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
+        <span class="n">output_fifo_data_type</span><span class="o">=</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoDataType</span><span class="o">.</span><span class="n">FP32</span>
+<span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Default</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>device</td>
+      <td><a href="Device.html">Device</a></td>
+      <td> </td>
+      <td>A <a href="Device.html">Device</a> that this <a href="Graph.html">Graph</a> will be allocated to. The <a href="DeviceState.html">DeviceState</a> must be OPENED.</td>
+    </tr>
+    <tr>
+      <td>graph_buffer</td>
+      <td>bytes</td>
+      <td> </td>
+      <td>Raw data read from a neural network graph file that was created with the Intel® Movidius™ Neural Compute SDK <a href="../../../tools/compile.html">mvNCCompile</a> tool.</td>
+    </tr>
+    <tr>
+      <td>input_fifo_type</td>
+      <td>int</td>
+      <td><a href="FifoType.html">FifoType.HOST_WO</a></td>
+      <td>A member of the <a href="FifoType.html">FifoType</a> enumeration, which sets read/write access to the Fifo.</td>
+    </tr>
+    <tr>
+      <td>input_fifo_num_elem</td>
+      <td>int</td>
+      <td>2</td>
+      <td>The maximum number of elements that the input Fifo can hold.</td>
+    </tr>
+    <tr>
+      <td>input_fifo_data_type</td>
+      <td>int</td>
+      <td><a href="FifoDataType.html">FifoDataType.FP32</a></td>
+      <td>A member of the <a href="FifoDataType.html">FifoDataType</a> enumeration.</td>
+    </tr>
+    <tr>
+      <td>output_fifo_type</td>
+      <td>int</td>
+      <td><a href="FifoType.html">FifoType.HOST_RO</a></td>
+      <td>A member of the <a href="FifoType.html">FifoType</a> enumeration, which sets read/write access to the Fifo.</td>
+    </tr>
+    <tr>
+      <td>output_fifo_num_elem</td>
+      <td>int</td>
+      <td>2</td>
+      <td>The maximum number of elements that the output Fifo can hold.</td>
+    </tr>
+    <tr>
+      <td>output_fifo_data_type</td>
+      <td>int</td>
+      <td><a href="FifoDataType.html">FifoDataType.FP32</a></td>
+      <td>A member of the <a href="FifoDataType.html">FifoDataType</a> enumeration.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p><a href="Fifo.html">input_fifo</a>, <a href="Fifo.html">output_fifo</a></p>
+
+<p>The input and output <a href="Fifo.html">Fifos</a> that were created and allocated by this method.</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>This method takes the place of explicit calls for <a href="Graph.allocate.html">Graph.allocate()</a>, <a href="Fifo.html">Fifo</a> creation, and <a href="Fifo.allocate.html">Fifo.allocate()</a>.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Get a list of valid device identifiers</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+
+<span class="c"># Create a Device instance for the first device found</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+<span class="c"># Open communication with the device</span>
+<span class="n">device</span><span class="o">.</span><span class="nb">open</span><span class="p">()</span>
+
+<span class="c"># Create a Graph</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'graph1'</span><span class="p">)</span>
+
+<span class="c"># Read a compiled network graph from file (set the graph_filepath correctly for your graph file)</span>
+<span class="n">graph_filepath</span> <span class="o">=</span> <span class="s">'./graph'</span>
+<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">graph_filepath</span><span class="p">,</span> <span class="s">'rb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+    <span class="n">graph_buffer</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+
+<span class="c"># Allocate the graph on the device</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Use the device...</span>
+<span class="c">#</span>
+
+<span class="c"># Deallocate and destroy the graph handle and fifo handles, close the device, and destroy the device handle</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Graph.destroy.html b/docs/ncapi/ncapi2/py_api/Graph.destroy.html
new file mode 100644 (file)
index 0000000..44ea3fe
--- /dev/null
@@ -0,0 +1,104 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphdestroy">Graph.destroy()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.html">Graph</a>, <a href="Device.html">Device</a>, <a href="Graph.allocate.html">Graph.allocate()</a>, <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method frees resources associated with a <a href="Graph.html">Graph</a>. This must be called for every <a href="Graph.html">Graph</a> created.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<p>None.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Create a Graph</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'graph1'</span><span class="p">)</span>
+
+<span class="c"># Destroy the Graph</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Graph.get_option.html b/docs/ncapi/ncapi2/py_api/Graph.get_option.html
new file mode 100644 (file)
index 0000000..d0fb92c
--- /dev/null
@@ -0,0 +1,127 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphget_option">Graph.get_option()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.html">Graph</a>, <a href="GraphOption.html">GraphOption</a>, <a href="Graph.set_option.html">Graph.set_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method returns the value of an option for the <a href="Graph.html">Graph</a>. The available options and possible values can be found in the <a href="GraphOption.html">GraphOption</a> enumeration.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">value</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">option</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A member of the <a href="GraphOption.html">GraphOption</a> enumeration that specifies which option value to get.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p><em>value</em></p>
+
+<p>The value for the specified option. The value type depends on the option specified.  See the <a href="GraphOption.html">GraphOption</a> enumeration for the type that corresponds to each option.</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a <a href="Status.html">Status.INVALID_PARAMETERS</a> code if an invalid option is passed or Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="GraphState.html">GraphState</a> must be CREATED or ALLOCATED.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Create a graph</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'graph1'</span><span class="p">)</span>
+
+<span class="c"># Print the name of the Graph</span>
+<span class="k">print</span><span class="p">(</span><span class="s">'The graph name is'</span><span class="p">,</span> <span class="n">graph</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">GraphOption</span><span class="o">.</span><span class="n">RO_GRAPH_NAME</span><span class="p">))</span>
+
+<span class="c"># Destroy the Graph when done using it</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Graph.html b/docs/ncapi/ncapi2/py_api/Graph.html
new file mode 100644 (file)
index 0000000..a87cde5
--- /dev/null
@@ -0,0 +1,200 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-graph">class Graph</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="GraphOption.html">GraphOption</a>, <a href="Device.html">Device</a>, <a href="Fifo.html">Fifo</a>, <a href="Graph.allocate.html">Graph.allocate()</a>, <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>The <a href="Graph.html">Graph</a> class represents a neural network graph and provides methods to perform inferences.</p>
+
+<p>Create and allocate a <a href="Graph.html">Graph</a> for each network graph file. A <a href="Device.html">Device</a> can have more than one <a href="Graph.html">Graph</a> allocated to it, but each <a href="Graph.html">Graph</a> can only be allocated to a single <a href="Device.html">Device</a>.</p>
+
+<h2 id="initialization">Initialization</h2>
+<p>Create a Graph instance:</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+</code></pre></div></div>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>name</td>
+      <td>str</td>
+      <td>A name for the graph; this can be anything you like up to mvncapi.MAX_NAME_SIZE characters, or just an empty string.<br /><br />The name can be retrieved later with <a href="Graph.get_option.html">Graph.get_option()</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>When the Graph has been successfully created, the <a href="GraphState.html">GraphState</a> will be CREATED.</p>
+
+<h2 id="methods">Methods</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Method</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="Graph.allocate.html">allocate</a></td>
+      <td>Allocate a <a href="Graph.html">Graph</a> to a device.</td>
+    </tr>
+    <tr>
+      <td><a href="Graph.allocate_with_fifos.html">allocate_with_fifos</a></td>
+      <td>Allocate a graph to a device and create and allocate associated <a href="Fifo.html">Fifos</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="Graph.destroy.html">destroy</a></td>
+      <td>Deallocate a graph that was allocated with <a href="Graph.allocate.html">Graph.allocate()</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="Graph.get_option.html">get_option</a></td>
+      <td>Get the value of a graph option.<br /><br />See <a href="GraphOption.html">GraphOption</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="Graph.queue_inference.html">queue_inference</a></td>
+      <td>Queue an inference to be processed by the graph.</td>
+    </tr>
+    <tr>
+      <td><a href="Graph.queue_inference_with_fifo_elem.html">queue_inference_with_fifo_elem</a></td>
+      <td>Write input tensor data to an input Fifo buffer and then trigger graph execution.</td>
+    </tr>
+    <tr>
+      <td><a href="Graph.set_option.html">set_option</a></td>
+      <td>Set the value of a graph option.<br /><br />See <a href="GraphOption.html">GraphOption</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="typical-usage">Typical Usage</h2>
+<ul>
+  <li>Create a <a href="Graph.html">Graph</a> instance.</li>
+  <li>Create input and output <a href="Fifo.html">Fifo</a> queues and allocate the graph for a neural compute device with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a>.
+    <ul>
+      <li>Alternatively, just allocate the <a href="Graph.html">Graph</a> with <a href="Graph.allocate.html">Graph.allocate()</a> and handle <a href="Fifo.html">Fifo</a> creation and allocation separately.</li>
+    </ul>
+  </li>
+  <li>Write an image to the input <a href="Fifo.html">Fifo</a> and queue an inference with <a href="Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a>.
+    <ul>
+      <li>You can also just queue an inference from an input <a href="Fifo.html">Fifo</a> that already contains elements with <a href="Graph.queue_inference.html">Graph.queue_inference()</a> instead.</li>
+    </ul>
+  </li>
+  <li>When finished, destroy the <a href="Graph.html">Graph</a> and free associated resources with <a href="Graph.destroy.html">Graph.destroy()</a>.</li>
+</ul>
+
+<p>See the <a href="readme.html">Python API Overview</a> for more information about typical API usage.</p>
+
+<h2 id="examples">Examples</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c">#</span>
+<span class="c"># Create and open a Device...</span>
+<span class="c">#</span>
+
+<span class="c"># Create a Graph</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'graph1'</span><span class="p">)</span>
+
+<span class="c"># Read a compiled network graph from file (set the graph_filepath correctly for your graph file)</span>
+<span class="n">graph_filepath</span> <span class="o">=</span> <span class="s">'./graph'</span>
+<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">graph_filepath</span><span class="p">,</span> <span class="s">'rb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+    <span class="n">graph_buffer</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+
+<span class="c"># Allocate the graph on the device and create input and output Fifos</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Pre-procces your input tensor...</span>
+<span class="c">#</span>
+
+<span class="c"># Write the tensor to the input Fifo and queue an inference</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">queue_inference_with_fifo_elem</span><span class="p">(</span><span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span><span class="p">,</span> <span class="n">input_tensor</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="s">'object1'</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Read the output from the output_fifo and use it as needed...</span>
+<span class="c">#</span>
+
+<span class="c"># Clean up</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Graph.queue_inference.html b/docs/ncapi/ncapi2/py_api/Graph.queue_inference.html
new file mode 100644 (file)
index 0000000..a64f4a6
--- /dev/null
@@ -0,0 +1,161 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphqueue_inference">Graph.queue_inference()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.html">Graph</a>, <a href="Fifo.html">Fifo</a>, <a href="Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method queues an inference with specified input and output <a href="Fifo.html">Fifos</a>.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">graph</span><span class="o">.</span><span class="n">queue_inference</span><span class="p">(</span><span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>input_fifo</td>
+      <td><a href="Fifo.html">Fifo</a></td>
+      <td>A FIFO queue for graph inputs. The <a href="FifoState.html">FifoState</a> must be ALLOCATED.</td>
+    </tr>
+    <tr>
+      <td>output_fifo</td>
+      <td><a href="Fifo.html">Fifo</a></td>
+      <td>A FIFO queue for graph outputs. The <a href="FifoState.html">FifoState</a> must be ALLOCATED.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="Graph.html">GraphState</a> must be ALLOCATED.</li>
+  <li>The input_fifo <a href="FifoType.html">FifoType</a> must allow <a href="FifoType.html">write access</a> for the API and the output_fifo must allow <a href="FifoType.html">read access</a> for the API.</li>
+  <li>This is a blocking call if <a href="FifoOption.html">FifoOption.RW_DONT_BLOCK</a> is false. If the input <a href="Fifo.html">Fifo</a> is empty this function will not return until there is an element to queue for inference.
+    <ul>
+      <li>The Fifo’s capacity is set when the Fifo is allocated with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a> or <a href="Fifo.allocate.html">Fifo.allocate()</a>.</li>
+      <li>You can check the capacity and the current fill level of the <a href="Fifo.html">Fifo</a> with <a href="Fifo.get_option.html">Fifo.get_option()</a> for <a href="FifoOption.html">FifoOption.RO_CAPACITY</a> and <a href="FifoOption.html">FifoOption.RO_WRITE_FILL_LEVEL</a>.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c">#</span>
+<span class="c"># Create and open a Device...</span>
+<span class="c">#</span>
+
+<span class="c"># Create a Graph</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'graph1'</span><span class="p">)</span>
+
+<span class="c"># Read a compiled network graph from file (set the graph_filepath correctly for your graph file)</span>
+<span class="n">graph_filepath</span> <span class="o">=</span> <span class="s">'./graph'</span>
+<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">graph_filepath</span><span class="p">,</span> <span class="s">'rb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+    <span class="n">graph_buffer</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+
+<span class="c"># Allocate the graph on the device and create input and output Fifos</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Pre-procces your input tensor and write to the input Fifo...</span>
+<span class="c">#</span>
+
+<span class="c"># Queue an inference</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">queue_inference</span><span class="p">(</span><span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Read the output from the output_fifo and use it as needed...</span>
+<span class="c">#</span>
+
+<span class="c"># Deallocate and destroy the fifo and graph handles, close the device, and destroy the device handle</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Graph.queue_inference_with_fifo_elem.html b/docs/ncapi/ncapi2/py_api/Graph.queue_inference_with_fifo_elem.html
new file mode 100644 (file)
index 0000000..cfc2d83
--- /dev/null
@@ -0,0 +1,168 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphqueue_inference_with_fifo_elem">Graph.queue_inference_with_fifo_elem()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.html">Graph</a>, <a href="Graph.queue_inference.html">Graph.queue_inference()</a><br /><a href="Fifo.html">Fifo</a>, <a href="Fifo.write_elem.html">Fifo.write_elem()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method writes input tensor data to an input <a href="Fifo.html">Fifo</a> and then queues an inference.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">graph</span><span class="o">.</span><span class="n">queue_inference_with_fifo_elem</span><span class="p">(</span><span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span><span class="p">,</span> <span class="n">input_tensor</span><span class="p">,</span> <span class="n">user_obj</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>input_fifo</td>
+      <td><a href="Fifo.html">Fifo</a></td>
+      <td>A Fifo queue for graph inputs. The <a href="FifoState.html">FifoState</a> must be ALLOCATED.</td>
+    </tr>
+    <tr>
+      <td>output_fifo</td>
+      <td><a href="Fifo.html">Fifo</a></td>
+      <td>A Fifo queue for graph outputs. The <a href="FifoState.html">FifoState</a> must be ALLOCATED.</td>
+    </tr>
+    <tr>
+      <td>input_tensor</td>
+      <td>numpy.ndarray</td>
+      <td>Input tensor data of the type specified by the <a href="FifoDataType.html">FifoDataType</a> option.</td>
+    </tr>
+    <tr>
+      <td>user_obj</td>
+      <td><em>any</em></td>
+      <td>User-defined data that will be returned along with the inference result. This can be anything that you want associated with the inference result, such as the original inference input or a window handle, or None.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="Graph.html">GraphState</a> must be ALLOCATED.</li>
+  <li>This method takes the place of explicit calls to <a href="Fifo.write_elem.html">Fifo.write_elem()</a> and <a href="Graph.queue_inference.html">Graph.queue_inference()</a>.</li>
+  <li>The input_fifo <a href="FifoType.html">FifoType</a> must allow <a href="FifoType.html">write access</a> for the API and the output_fifo must allow <a href="FifoType.html">read access</a> for the API.</li>
+  <li><a href="Fifo.write_elem.html">Fifo.write_elem()</a>, which is called internally by this method, is a blocking call if <a href="FifoOption.html">FifoOption.RW_DONT_BLOCK</a> is false. If the Fifo is full this method will not return until there is space to write to the Fifo.
+    <ul>
+      <li>The Fifo’s capacity is set when you create the Fifo with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a> or <a href="Fifo.allocate.html">Fifo.allocate()</a>.</li>
+      <li>You can check the capacity and the current fill level of the <a href="Fifo.html">Fifo</a> with <a href="Fifo.get_option.html">Fifo.get_option()</a> for <a href="FifoOption.html">FifoOption.RO_CAPACITY</a> and <a href="FifoOption.html">FifoOption.RO_WRITE_FILL_LEVEL</a>.</li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c">#</span>
+<span class="c"># Create and open a Device...</span>
+<span class="c">#</span>
+
+<span class="c"># Create a Graph</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'graph1'</span><span class="p">)</span>
+
+<span class="c"># Read a compiled network graph from file (set the graph_filepath correctly for your graph file)</span>
+<span class="n">graph_filepath</span> <span class="o">=</span> <span class="s">'./graph'</span>
+<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">graph_filepath</span><span class="p">,</span> <span class="s">'rb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+    <span class="n">graph_buffer</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+
+<span class="c"># Allocate the graph on the device and create input and output Fifos</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c"># Write the input to the input_fifo buffer and queue an inference in one call</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">queue_inference_with_fifo_elem</span><span class="p">(</span><span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span><span class="p">,</span> <span class="n">input_tensor</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="s">'object1'</span><span class="p">)</span>
+
+<span class="c">#</span>
+<span class="c"># Read the output from the output_fifo and use it as needed...</span>
+<span class="c">#</span>
+
+<span class="c"># Deallocate and destroy the fifo and graph handles, close the device, and destroy the device handle</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Graph.set_option.html b/docs/ncapi/ncapi2/py_api/Graph.set_option.html
new file mode 100644 (file)
index 0000000..a2b5c00
--- /dev/null
@@ -0,0 +1,131 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="graphset_option">Graph.set_option()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.html">Graph</a>, <a href="GraphOption.html">GraphOption</a>, <a href="Graph.get_option.html">Graph.get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This method sets an option for the graph. The available options and possible values can be found in the <a href="GraphOption.html">GraphOption</a> enumeration.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">graph</span><span class="o">.</span><span class="n">set_option</span><span class="p">(</span><span class="n">option</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A member of the <a href="GraphOption.html">GraphOption</a> enumeration that specifies which graph option to set.</td>
+    </tr>
+    <tr>
+      <td>value</td>
+      <td><em>varies</em></td>
+      <td>The new value to which the graph option will be set.<br /><br />The type to pass for this parameter depends on which option is being set. See the <a href="GraphOption.html">GraphOption</a> enumeration for the type that corresponds to each option.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a <a href="Status.html">Status.INVALID_PARAMETERS</a> code if an invalid option is passed or Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>The <a href="GraphOption.html">GraphOption.RW_EXECUTORS_NUM</a> option must be set before this <a href="Graph.html">Graph</a> is allocated with <a href="Graph.allocate.html">Graph.allocate()</a> or <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a>.</li>
+  <li>The <a href="GraphState.html">GraphState</a> must be CREATED.</li>
+</ul>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Create a Graph</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'mygraph'</span><span class="p">)</span>
+
+<span class="c"># Set the RW_EXECUTORS_NUM for the Graph</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">set_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">GraphOption</span><span class="o">.</span><span class="n">RW_EXECUTORS_NUM</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
+
+<span class="c"># Destroy the Graph when done using it</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/GraphOption.html b/docs/ncapi/ncapi2/py_api/GraphOption.html
new file mode 100644 (file)
index 0000000..2e4395d
--- /dev/null
@@ -0,0 +1,167 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-graphoptionenumenum">class GraphOption(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.html">Graph</a>, <a href="Graph.get_option.html">Graph.get_option()</a>, <a href="Graph.set_option.html">Graph.set_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>GraphOption is an enumeration that defines <a href="Graph.html">Graph</a> options that can be read with <a href="Graph.get_option.html">Graph.get_option()</a> or set with <a href="Graph.set_option.html">Graph.set_option()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Option</th>
+      <th>Option Type</th>
+      <th>Possible Values</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>RO_GRAPH_STATE</td>
+      <td>int</td>
+      <td>Values in the <a href="GraphState.html">GraphState</a> enumeration</td>
+      <td>The current state of the <a href="Graph.html">Graph</a>.</td>
+    </tr>
+    <tr>
+      <td>RO_TIME_TAKEN</td>
+      <td>numpy.ndarray of floats</td>
+      <td>Unbounded positive floats</td>
+      <td>The times taken per graph layer for the last inference.</td>
+    </tr>
+    <tr>
+      <td>RO_INPUT_COUNT</td>
+      <td>int</td>
+      <td>1</td>
+      <td>The number of inputs expected by the graph. This is the length of the RO_INPUT_TENSOR_DESCRIPTORS list.<br /><br /><em>Only 1 currently supported.</em></td>
+    </tr>
+    <tr>
+      <td>RO_OUTPUT_COUNT</td>
+      <td>int</td>
+      <td>1</td>
+      <td>The number of outputs expected by the graph.  This is the length of the RO_OUTPUT_TENSOR_DESCRIPTORS list.<br /><br /><em>Only 1 currently supported.</em></td>
+    </tr>
+    <tr>
+      <td>RO_INPUT_TENSOR_<br />DESCRIPTORS</td>
+      <td>list(<a href="TensorDescriptor.html">TensorDescriptor</a>)</td>
+      <td>N/A</td>
+      <td>A list of <a href="TensorDescriptor.html">TensorDescriptor</a> objects that describe the graph inputs.</td>
+    </tr>
+    <tr>
+      <td>RO_OUTPUT_TENSOR_<br />DESCRIPTORS</td>
+      <td>list(<a href="TensorDescriptor.html">TensorDescriptor</a>)</td>
+      <td>N/A</td>
+      <td>A list of <a href="TensorDescriptor.html">TensorDescriptor</a> objects that describe the graph outputs.</td>
+    </tr>
+    <tr>
+      <td>RO_DEBUG_INFO</td>
+      <td>str</td>
+      <td>Any</td>
+      <td>More detailed debug info when the result of a function call was <a href="Status.html">Status.MYRIAD_ERROR</a>.</td>
+    </tr>
+    <tr>
+      <td>RO_GRAPH_NAME</td>
+      <td>str</td>
+      <td>Any</td>
+      <td>The name of the <a href="Graph.html">Graph</a> that was set when the <a href="Graph.html">Graph</a> was created.</td>
+    </tr>
+    <tr>
+      <td>RO_CLASS_LIMIT</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The highest option class supported.</td>
+    </tr>
+    <tr>
+      <td>RO_GRAPH_VERSION</td>
+      <td>numpy.ndarray of unsigned ints</td>
+      <td>[<em>major, minor</em>]</td>
+      <td>The version of the compiled graph file.</td>
+    </tr>
+    <tr>
+      <td>RO_TIME_TAKEN<br />_ARRAY_SIZE</td>
+      <td>int</td>
+      <td>Unbounded positive int</td>
+      <td>The size of the array for RO_TIME_TAKEN.</td>
+    </tr>
+    <tr>
+      <td>RW_EXECUTORS_NUM</td>
+      <td>int</td>
+      <td>Positive int up to <a href="DeviceOption.html">RO_MAX_EXECUTORS_NUM</a></td>
+      <td><em>Reserved for future use.</em></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li><strong>Options prefixed with ‘RW’ have read/write permission and are both gettable and settable.</strong></li>
+  <li><strong>Options prefixed with ‘RO’ have read-only permission and are only gettable.</strong></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/GraphState.html b/docs/ncapi/ncapi2/py_api/GraphState.html
new file mode 100644 (file)
index 0000000..fac49c2
--- /dev/null
@@ -0,0 +1,103 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-graphstateenumenum">class GraphState(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.html">Graph</a>, <a href="GraphOption.html">GraphOption</a>, <a href="Graph.get_option.html">Graph.get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>GraphState is an enumeration that defines states of a <a href="Graph.html">Graph</a>, which can be read with <a href="Graph.get_option.html">Graph.get_option()</a>.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Enumeration Member</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>CREATED</td>
+      <td>The <a href="Graph.html">Graph</a> has been created but has not been allocated for a device.</td>
+    </tr>
+    <tr>
+      <td>ALLOCATED</td>
+      <td>The <a href="Graph.html">Graph</a> has been created and allocated for a device with <a href="Graph.allocate.html">Graph.allocate()</a> or <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a>.</td>
+    </tr>
+    <tr>
+      <td>WAITING_FOR_BUFFERS</td>
+      <td>The <a href="Graph.html">Graph</a> is waiting for input.</td>
+    </tr>
+    <tr>
+      <td>RUNNING</td>
+      <td>The <a href="Graph.html">Graph</a> is currently running an inference.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/Status.html b/docs/ncapi/ncapi2/py_api/Status.html
new file mode 100644 (file)
index 0000000..01805c4
--- /dev/null
@@ -0,0 +1,147 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-statusenumenum">class Status(enum.Enum)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td> </td>
+    </tr>
+  </tbody>
+</table>
+
+<p>Status is an enumeration that defines status codes returned from calls to the API functions. If the underlying C API returns a non-zero status, an exception is usually raised with the corresponding status.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Enumeration Member</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>OK</td>
+      <td>The function call worked as expected.</td>
+    </tr>
+    <tr>
+      <td>BUSY</td>
+      <td>The device is busy; retry later.</td>
+    </tr>
+    <tr>
+      <td>ERROR</td>
+      <td>An unexpected error was encountered during the function call.</td>
+    </tr>
+    <tr>
+      <td>OUT_OF_MEMORY</td>
+      <td>The host is out of memory.</td>
+    </tr>
+    <tr>
+      <td>DEVICE_NOT_FOUND</td>
+      <td>There is no device with the given index or identifier.</td>
+    </tr>
+    <tr>
+      <td>INVALID_PARAMETERS</td>
+      <td>At least one of the given parameters is invalid in the context of the function call.</td>
+    </tr>
+    <tr>
+      <td>TIMEOUT</td>
+      <td>Timeout in the communication with the device.</td>
+    </tr>
+    <tr>
+      <td>MVCMD_NOT_FOUND</td>
+      <td>The file named ‘MvNCAPI.mvcmd’ should be installed in the mvnc directory. This message means that the file has been moved or installer failed.</td>
+    </tr>
+    <tr>
+      <td>NOT_ALLOCATED</td>
+      <td>The <a href="Graph.html">Graph</a> or <a href="Fifo.html">Fifo</a> has not been allocated.</td>
+    </tr>
+    <tr>
+      <td>UNAUTHORIZED</td>
+      <td>An unauthorized operation has been attempted.</td>
+    </tr>
+    <tr>
+      <td>UNSUPPORTED_GRAPH_FILE</td>
+      <td>The graph file is corrupt or may have been created with an incompatible prior version of the NCSDK. Try to recompile the graph file with the version of the toolkit that corresponds to the API version.</td>
+    </tr>
+    <tr>
+      <td>UNSUPPORTED_CONFIGURATION_FILE</td>
+      <td><em>Reserved for future use.</em></td>
+    </tr>
+    <tr>
+      <td>UNSUPPORTED_FEATURE</td>
+      <td>This feature is not supported by this firmware version.</td>
+    </tr>
+    <tr>
+      <td>MYRIAD_ERROR</td>
+      <td>An error has been reported by the Intel® Movidius™ VPU. See <a href="DeviceOption.html">DeviceOption.RO_DEBUG_INFO</a> and <a href="GraphOption.html">GraphOption.RO_DEBUG_INFO</a> to get more information on the error.</td>
+    </tr>
+    <tr>
+      <td>INVALID_DATA_LENGTH</td>
+      <td>An invalid data length has been passed when getting or setting an option.</td>
+    </tr>
+  </tbody>
+</table>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/TensorDescriptor.html b/docs/ncapi/ncapi2/py_api/TensorDescriptor.html
new file mode 100644 (file)
index 0000000..179abb4
--- /dev/null
@@ -0,0 +1,118 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="class-tensordescriptorctypesstructure">class TensorDescriptor(ctypes.Structure)</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Graph.html">Graph</a>, <a href="Fifo.html">Fifo</a>, <a href="GraphOption.html">GraphOption</a>, <a href="FifoOption.html">FifoOption</a>, <a href="Graph.get_option.html">Graph.get_option()</a>, <a href="Fifo.get_option.html">Fifo.get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<p>TensorDescriptor is a structure that describes graph inputs and outputs.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Field</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>n</td>
+      <td>int</td>
+      <td>The number of tensors in the batch.</td>
+    </tr>
+    <tr>
+      <td>c</td>
+      <td>int</td>
+      <td>The number of channels per tensor data element. For image tensors, this is the number of channels per pixel.</td>
+    </tr>
+    <tr>
+      <td>w</td>
+      <td>int</td>
+      <td>For image tensors, this is the width in pixels. For non-image tensors, this is always 1.</td>
+    </tr>
+    <tr>
+      <td>h</td>
+      <td>int</td>
+      <td>For image tensors, this is the height in pixels. For non-image tensors, this is always 1.</td>
+    </tr>
+    <tr>
+      <td>totalSize</td>
+      <td>int</td>
+      <td>The total size of the data. This is the number of bytes required to hold the entire tensor.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>You can use <a href="Graph.get_option.html">Graph.get_option()</a> to get lists of input and output <a href="TensorDescriptor.html">TensorDescriptors</a> for a <a href="Graph.html">Graph</a>.</li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/enumerate_devices.html b/docs/ncapi/ncapi2/py_api/enumerate_devices.html
new file mode 100644 (file)
index 0000000..bc0d613
--- /dev/null
@@ -0,0 +1,105 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="enumerate_devices">enumerate_devices()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="Device.html">Device</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This function returns a list of identifiers for all neural compute devices present in the system. These identifiers can be used to create an instance of the <a href="Device.html">Device</a> class.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+<p>None.</p>
+
+<h2 id="return">Return</h2>
+<p>list(ctypes.c_void_p)</p>
+
+<p>A list of identifiers for neural compute devices present in the system.</p>
+
+<h2 id="notes">Notes</h2>
+<p>None.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+
+<span class="k">if</span> <span class="ow">not</span> <span class="n">device_list</span><span class="p">:</span>
+    <span class="k">print</span><span class="p">(</span><span class="s">"Error - No neural compute devices detected."</span><span class="p">)</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="k">print</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">device_list</span><span class="p">),</span> <span class="s">"neural compute devices found!"</span><span class="p">)</span>
+    
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/global_get_option.html b/docs/ncapi/ncapi2/py_api/global_get_option.html
new file mode 100644 (file)
index 0000000..f4838e3
--- /dev/null
@@ -0,0 +1,119 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="global_get_option">global_get_option()</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="GlobalOption.html">GlobalOption</a>, <a href="global_set_option.html">global_set_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This function returns the value of a global option. The available options and possible values can be found in the <a href="GlobalOption.html">GlobalOption</a> enumeration.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">value</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">global_get_option</span><span class="p">(</span><span class="n">option</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A member of the <a href="GlobalOption.html">GlobalOption</a> enumeration that specifies which option value to get.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p><em>value</em></p>
+
+<p>The value for the specified option. The value type depends on the option specified. See the <a href="GlobalOption.html">GlobalOption</a> enumeration for the type that corresponds to each option.</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a <a href="Status.html">Status.INVALID_PARAMETERS</a> code if an invalid option is passed or Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<p>None.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Print the API version</span>
+<span class="k">print</span><span class="p">(</span><span class="s">'NCAPI Version:'</span><span class="p">,</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">global_get_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">GlobalOption</span><span class="o">.</span><span class="n">RO_API_VERSION</span><span class="p">))</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/global_set_option.html b/docs/ncapi/ncapi2/py_api/global_set_option.html
new file mode 100644 (file)
index 0000000..0ac15b6
--- /dev/null
@@ -0,0 +1,122 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="global_set_option">global_set_option</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Info</th>
+      <th>Value</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Package</td>
+      <td>mvnc</td>
+    </tr>
+    <tr>
+      <td>Module</td>
+      <td>mvncapi</td>
+    </tr>
+    <tr>
+      <td>Version</td>
+      <td>2.0</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="GlobalOption.html">GlobalOption</a>, <a href="global_get_option.html">global_get_option()</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+
+<p>This function sets a global option value. The available options and possible values can be found in the <a href="GlobalOption.html">GlobalOption</a> enumeration.</p>
+
+<h2 id="syntax">Syntax</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">mvncapi</span><span class="o">.</span><span class="n">global_set_option</span><span class="p">(</span><span class="n">option</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="parameters">Parameters</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Parameter</th>
+      <th>Type</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>option</td>
+      <td>int</td>
+      <td>A member of the <a href="GlobalOption.html">GlobalOption</a> enumeration that specifies which option value to set.</td>
+    </tr>
+    <tr>
+      <td>value</td>
+      <td><em>varies</em></td>
+      <td>The new value to which the option will be set.<br /><br />The type to pass for this parameter depends on which option is being set. See the <a href="GlobalOption.html">GlobalOption</a> enumeration for the type that corresponds to each option.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="return">Return</h2>
+<p>None</p>
+
+<h2 id="raises">Raises</h2>
+<p>Exception with a <a href="Status.html">Status.INVALID_PARAMETERS</a> code if an invalid option is passed or Exception with a status code from <a href="Status.html">Status</a> if underlying function calls return a status other than Status.OK.</p>
+
+<h2 id="notes">Notes</h2>
+<p>None.</p>
+
+<h2 id="example">Example</h2>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Set the global logging level to debug (full verbosity)</span>
+<span class="n">mvncapi</span><span class="o">.</span><span class="n">global_set_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">GlobalOption</span><span class="o">.</span><span class="n">RW_LOG_LEVEL</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/py_api/readme.html b/docs/ncapi/ncapi2/py_api/readme.html
new file mode 100644 (file)
index 0000000..30a3ecf
--- /dev/null
@@ -0,0 +1,303 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../../assets/css/style.css">
+    <script src="../../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="intel-movidius-neural-compute-sdk-python-api">Intel® Movidius™ Neural Compute SDK Python API</h1>
+
+<p>The Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) comes with a Python Language API that enables applications that utilize hardware accelerated Deep Neural Networks via neural compute devices such as the <a href="../../../ncs.html">Intel® Movidius™ Neural Compute Stick</a>.</p>
+
+<p>The Python API is provided as a single Python module (mvncapi.py), which is placed on the development computer when the NCSDK is installed. It has been validated with Python 2.7 and 3.5.</p>
+
+<h2 id="python-api-documentation">Python API Documentation</h2>
+
+<table>
+  <thead>
+    <tr>
+      <th>Enumerations</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="DeviceHwVersion.html">DeviceHwVersion</a></td>
+      <td>Contains neural compute device hardware versions.</td>
+    </tr>
+    <tr>
+      <td><a href="DeviceOption.html">DeviceOption</a></td>
+      <td>Contains neural compute device options.</td>
+    </tr>
+    <tr>
+      <td><a href="DeviceState.html">DeviceState</a></td>
+      <td>Contains neural compute device NCAPI states.</td>
+    </tr>
+    <tr>
+      <td><a href="FifoDataType.html">FifoDataType</a></td>
+      <td>Contains FIFO queue element data types.</td>
+    </tr>
+    <tr>
+      <td><a href="FifoOption.html">FifoOption</a></td>
+      <td>Contains FIFO queue options.</td>
+    </tr>
+    <tr>
+      <td><a href="FifoState.html">FifoState</a></td>
+      <td>Contains FIFO queue NCAPI states.</td>
+    </tr>
+    <tr>
+      <td><a href="FifoType.html">FifoType</a></td>
+      <td>Contains FIFO queue access types.</td>
+    </tr>
+    <tr>
+      <td><a href="GlobalOption.html">GlobalOption</a></td>
+      <td>Contains global (application-level) options.</td>
+    </tr>
+    <tr>
+      <td><a href="GraphOption.html">GraphOption</a></td>
+      <td>Contains network graph options.</td>
+    </tr>
+    <tr>
+      <td><a href="GraphState.html">GraphState</a></td>
+      <td>Contains network graph NCAPI states.</td>
+    </tr>
+    <tr>
+      <td><a href="Status.html">Status</a></td>
+      <td>Contains status code return values for NCAPI functions.</td>
+    </tr>
+  </tbody>
+</table>
+
+<table>
+  <thead>
+    <tr>
+      <th>Structures</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="TensorDescriptor.html">TensorDescriptor</a></td>
+      <td>Holds information that describes the shape of a tensor.</td>
+    </tr>
+  </tbody>
+</table>
+
+<table>
+  <thead>
+    <tr>
+      <th>Global Functions</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="enumerate_devices.html">enumerate_devices()</a></td>
+      <td>Returns a list of identifiers for neural compute devices present in the system.</td>
+    </tr>
+    <tr>
+      <td><a href="global_get_option.html">global_get_option()</a></td>
+      <td>Gets the value of a global option for the application.</td>
+    </tr>
+    <tr>
+      <td><a href="global_set_option.html">global_set_option()</a></td>
+      <td>Sets the value of a global option for the application.</td>
+    </tr>
+  </tbody>
+</table>
+
+<table>
+  <thead>
+    <tr>
+      <th>Classes</th>
+      <th> </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="Device.html">Device</a></td>
+      <td>Represents a neural compute device and provides methods to communicate with the device.</td>
+    </tr>
+    <tr>
+      <td><a href="Fifo.html">Fifo</a></td>
+      <td>Represents a first in, first out (FIFO) queue for network input and output.</td>
+    </tr>
+    <tr>
+      <td><a href="Graph.html">Graph</a></td>
+      <td>Represents a neural network graph and provides methods to perform inferences.</td>
+    </tr>
+  </tbody>
+</table>
+
+<p><br /></p>
+
+<h2 id="python-ncapi-overview">Python NCAPI Overview</h2>
+
+<h3 id="1-import-the-ncapi-module">1. Import the NCAPI module</h3>
+
+<p>The Python NCAPI is in the mvncapi module within the mvnc package.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+</code></pre></div></div>
+
+<p>You can get and set application-level information and options with <a href="global_get_option.html">global_get_option()</a> and <a href="global_set_option.html">global_set_option()</a> for options in the <a href="GlobalOption.html">GlobalOption</a> enumeration.</p>
+
+<h3 id="2-set-up-a-neural-compute-device">2. Set up a neural compute device</h3>
+
+<p>The <a href="Device.html">Device</a> class represents a neural compute device and provides methods to communicate with the device.</p>
+
+<p>The global function <a href="enumerate_devices.html">enumerate_devices()</a> is used to get a list of neural compute devices that are attached to your host system.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Get a list of available device identifiers</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+</code></pre></div></div>
+
+<p>Initialize the <a href="Device.html">Device</a> with one of the device identifiers obtained from the call to <a href="enumerate_devices.html">enumerate_devices()</a>.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Initialize a Device</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+</code></pre></div></div>
+
+<p>Initialize the neural compute device and open communication with <a href="Device.open.html">Device.open()</a>.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Initialize the device and open communication</span>
+<span class="n">device</span><span class="o">.</span><span class="nb">open</span><span class="p">()</span>
+</code></pre></div></div>
+
+<p>You can get information about the device using <a href="Device.get_option.html">Device.get_option()</a> for options in the <a href="DeviceOption.html">DeviceOption</a> enumeration.</p>
+
+<p><em>Note: If you are using more than one neural compute device, you must create and open a separate <a href="Device.html">Device</a> for each.</em></p>
+
+<h3 id="3-set-up-a-network-graph-and-associated-fifo-queues-for-the-device">3. Set up a network graph and associated FIFO queues for the device</h3>
+
+<p>The NCSDK requires a neural network graph file compiled with the <a href="../../../tools/compile.html">mvNCCompile</a> NCSDK tool.
+Many network models from <a href="../../../tensorflow.html">TensorFlow™</a> and <a href="../../../caffe.html">Caffe</a> are supported.
+See <a href="../../../configure_network.html">Configuring Your Network for the Intel® Movidius™ Neural Compute SDK</a> for more information about preparing your network model for use with the NCSDK.</p>
+
+<p>When you have a compiled graph, load the graph file data to a buffer.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Load graph file data</span>
+<span class="n">GRAPH_FILEPATH</span> <span class="o">=</span> <span class="s">'./graph'</span>
+<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">GRAPH_FILEPATH</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'rb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+    <span class="n">graph_buffer</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+</code></pre></div></div>
+
+<p>The <a href="Graph.html">Graph</a> class provides methods for utilizing your network graph.</p>
+
+<p>Initialize the <a href="Graph.html">Graph</a> with a name string. The name string can be anything you like up to mvncapi.MAX_NAME_SIZE characters, or just an empty string.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Initialize a Graph object</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'graph1'</span><span class="p">)</span>
+</code></pre></div></div>
+
+<p>Graph input and output is done with FIFO (first-in, first-out) queues. The <a href="Fifo.html">Fifo</a> class represents one of these queues and provides methods for managing it.</p>
+
+<p>Create input and output <a href="Fifo.html">Fifo</a> queues for your <a href="Graph.html">Graph</a> and allocate the graph to your device with <a href="Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a>. You can omit the keyword parameters to use default Fifo settings or you can specify other values as needed.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Allocate the graph to the device and create input and output Fifos with default arguments</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_file_buffer</span><span class="p">)</span>
+</code></pre></div></div>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Allocate the graph to the device and create input and output Fifos with keyword arguments (default values shown)</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_file_buffer</span><span class="p">,</span>
+        <span class="n">input_fifo_type</span><span class="o">=</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_WO</span><span class="p">,</span> <span class="n">input_fifo_data_type</span><span class="o">=</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoDataType</span><span class="o">.</span><span class="n">FP32</span><span class="p">,</span> <span class="n">input_fifo_num_elem</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> 
+        <span class="n">output_fifo_type</span><span class="o">=</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_RO</span><span class="p">,</span> <span class="n">output_fifo_data_type</span><span class="o">=</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoDataType</span><span class="o">.</span><span class="n">FP32</span><span class="p">,</span> <span class="n">output_fifo_num_elem</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
+</code></pre></div></div>
+<p>Optional parameters:</p>
+<ul>
+  <li><strong>input_fifo_type/output_fifo_type:</strong> This sets the read/write access for the Fifo. The input_fifo will be used to provide input to your network graph and should be a HOST_WO (write-only) <a href="FifoType.html">FifoType</a>, which allows the API (“HOST”) to write to the Fifo. The output_fifo  will be used to get output from your network graph and should be a HOST_RO (read-only) <a href="FifoType.html">FifoType</a>, which allows the API to read from the Fifo.</li>
+  <li><strong>input_fifo_data_type/output_fifo_data_type:</strong> This sets the type of data the the Fifo will store. The default <a href="FifoDataType.html">data type</a> for Fifos is 32-bit floating point (32FP). You can also set the data type to 16-bit floating point (16FP). Note: Regardless of what data types the input and output Fifos are configured for, the API will convert tensors to 16FP while performing inferences.</li>
+  <li><strong>input_fifo_num_elem/output_fifo/num_elem:</strong> This sets the size of the Fifo queue, or the maximum number of elements that each Fifo will hold. Choose a number that makes sense for your application flow and memory constraints. Also keep in mind that the method to write to the input Fifo will block if the input Fifo is full, and the method to read from the output Fifo will block if the output Fifo is empty.</li>
+</ul>
+
+<p>See the <a href="Fifo.html">Fifo</a> class documentation for more information about individual <a href="Fifo.html">Fifo</a> creation and allocation for greater control over <a href="Fifo.html">Fifo</a> set up.</p>
+
+<p>You can get information about a Graph using <a href="Graph.get_option.html">Graph.get_option()</a> for options in the <a href="GraphOption.html">GraphOption</a> enumeration. You can get information about a Fifo using <a href="Fifo.get_option.html">Fifo.get_option()</a> and <a href="Fifo.set_option.html">Fifo.set_option()</a> for options in the <a href="FifoOption.html">FifoOption</a> enumeration.</p>
+
+<p>*Note: You must create and allocate a <a href="Graph.html">Graph</a> for each network graph file that you wish to use. A <a href="Device.html">Device</a> can have more than one <a href="Graph.html">Graph</a> allocated to it, but each <a href="Graph.html">Graph</a> can only be allocated to a single <a href="Device.html">Device</a>.</p>
+
+<h3 id="4-get-an-input-tensor">4. Get an input tensor</h3>
+
+<p>The way that you obtain and pre-process your input tensor will depend on your individual application. If you are using Python3, the <a href="https://pypi.python.org/pypi/opencv-python">cv2</a> module provides an easy way to load images from file or a camera feed. GStreamer is a popular alternative.</p>
+
+<p>Here is an example of using the cv2 module to read an image from file and resize it to fit your network’s requirements. However, additional pre-processing specific to the network model that you are using and the image that you are loading is probably necessary.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">cv2</span>
+
+<span class="c"># Read an image from file</span>
+<span class="n">tensor</span> <span class="o">=</span> <span class="n">cv2</span><span class="o">.</span><span class="n">imread</span><span class="p">(</span><span class="s">'img.jpg'</span><span class="p">)</span>
+<span class="c"># Do pre-processing specific to this network model (resizing, subtracting network means, etc.)</span>
+</code></pre></div></div>
+
+<p>You can also use <a href="http://www.numpy.org/">numpy</a> to manipulate tensors.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">numpy</span>
+
+<span class="c"># Convert an input tensor to 32FP data type</span>
+<span class="n">tensor</span> <span class="o">=</span> <span class="n">tensor</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span>
+</code></pre></div></div>
+
+<p>Input tensor data must be the data type specified by the <a href="FifoOption.html">RW_DATA_TYPE</a> option for the input <a href="Fifo.html">Fifo</a>. The default is 32-bit floating point, but <a href="Fifo.html">Fifos</a> can also be configured to store 16-bit floating point data. See the <a href="FifoDataType.html">FifoDataType</a> enumeration.</p>
+
+<p><strong>Tensor data should be stored in a numpy ndarray.</strong></p>
+
+<h3 id="5-perform-an-inference">5. Perform an inference</h3>
+
+<p>Use <a href="Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a> to write the input tensor to your input <a href="Fifo.html">Fifo</a> and queue it for inference.
+When the inference is complete the input tensor will be removed from the input_fifo queue and the result tensor will be placed in the output_fifo queue.
+The third parameter must be None. The fourth parameter can be any object that you wish to have associated with this particular tensor when you read the inference results, such as the original tensor or a window handle, or None.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Write the tensor to the input_fifo and queue an inference</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">queue_inference_with_fifo_elem</span><span class="p">(</span><span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span><span class="p">,</span> <span class="n">tensor</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="s">'user object'</span><span class="p">)</span>
+</code></pre></div></div>
+
+<p>If the input <a href="Fifo.html">Fifo</a> is full, this method call will block until there is room to write to the <a href="Fifo.html">Fifo</a>.
+You can check how many elements are in the input and output <a href="Fifo.html">Fifos</a> with <a href="Fifo.get_option.html">Fifo.get_option()</a> for RO_WRITE_FILL_LEVEL and RO_READ_FILL_LEVEL, respectively.
+Note that the inference will take some amount of time to complete, depending on network model speed and device communication latency, so you may need to wait to see updated levels.</p>
+
+<p>After the inference is complete, you can get the inference result with <a href="Fifo.read_elem.html">Fifo.read_elem()</a>. This will also return the user object that you passed to <a href="Fifo.write_elem.html">Fifo.write_elem()</a>.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Get the results from the output queue</span>
+<span class="n">output</span><span class="p">,</span> <span class="n">user_obj</span> <span class="o">=</span> <span class="n">output_fifo</span><span class="o">.</span><span class="n">read_elem</span><span class="p">()</span>
+</code></pre></div></div>
+
+<p>You can then use the output result as intended for your particular network model.</p>
+
+<h3 id="6-clean-up">6. Clean up</h3>
+
+<p>Before closing communication with the device, use <a href="Graph.destroy.html">Graph.destroy()</a> and <a href="Fifo.destroy.html">Fifo.destroy()</a> to destroy the <a href="Graph.html">Graph</a> and <a href="Fifo.html">Fifo</a> objects and clean up associated memory. The <a href="Fifo.html">Fifos</a> must be empty before being destroyed.
+Then use <a href="Device.close.html">Device.close()</a> to close the device and <a href="Device.destroy.html">Device.destroy()</a> to destroy the <a href="Device.html">Device</a> object and clean up associated memory.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Clean up</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/ncapi2/readme.html b/docs/ncapi/ncapi2/readme.html
new file mode 100644 (file)
index 0000000..fb84996
--- /dev/null
@@ -0,0 +1,47 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../../assets/css/style.css">
+    <script src="../../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/python_api_migration.html b/docs/ncapi/python_api_migration.html
new file mode 100644 (file)
index 0000000..920a031
--- /dev/null
@@ -0,0 +1,496 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../assets/css/style.css">
+    <script src="../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <p><a name="Top"></a></p>
+<h1 id="migrating-python-applications-from-ncapi-v1-to-ncapi-v2">Migrating Python Applications from NCAPI v1 to NCAPI v2</h1>
+
+<h4 id="sections">Sections:</h4>
+
+<ul>
+  <li><a href="#Changes">Significant Changes</a></li>
+  <li><a href="#API">Equivalent API Calls</a></li>
+  <li><a href="#Example">Example Code Comparison</a></li>
+</ul>
+
+<p>Complete Python API documentation can be found here:</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v2 Documentation</th>
+      <th>NCAPI v1 Documentation</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncapi2/py_api/readme.html">Python API v2</a></td>
+      <td><a href="ncapi1/py_api/readme.html">Python API v1</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h1 id="significant-changes"><a name="Changes"></a>Significant Changes</h1>
+
+<h2 id="fifo-queues">FIFO queues</h2>
+
+<p>In the Intel® Movidius™ Neural Compute SDK (Intel® Movidius NCSDK) v1, the <a href="ncapi1/py_api/Graph.html">Graph</a> class was used to load an input tensor to a neural compute device and to read the output inference result.</p>
+
+<p>NCAPI v2 introduced the <a href="ncapi2/py_api/Fifo.html">Fifo</a> class for input/output FIFO queues. This allows multiple inputs to be queued for inference and allows multiple graphs to read from the same input queue. Fifo usage is required by the NCAPI v2.</p>
+
+<p>Typical Fifo usage through the NCAPI is as follows:</p>
+
+<ol>
+  <li>Allocate a graph and create and allocate input and output <a href="ncapi2/py_api/Fifo.html">Fifos</a> with <a href="ncapi2/py_api/Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a>.</li>
+  <li>Add input tensors to the input FIFO and queue an inference with <a href="ncapi2/py_api/Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a>.</li>
+  <li>Read the inference result from the output Fifo with <a href="ncapi2/py_api/Fifo.read_elem.html">Fifo.read_elem()</a>.</li>
+  <li>After usage, free <a href="ncapi2/py_api/Fifo.html">Fifo</a> resources with <a href="ncapi2/py_api/Fifo.destroy.html">Fifo.destroy()</a>.</li>
+</ol>
+
+<p>See the <a href="#Example">Example Code Comparison</a> section below for example Fifo usage.</p>
+
+<h2 id="inputoutput-data-types">Input/output data types</h2>
+
+<p>In NCAPI v1, input data for inferences had to be 16 bit floating point data type.</p>
+
+<p>In NCAPI v2, input data for inferences can be 16 bit or 32 bit floating point data type. The default data type is FP32. The data type is set for each <a href="ncapi2/py_api/Fifo.html">Fifo</a> using <a href="ncapi2/py_api/Fifo.set_option.html">Fifo.set_option()</a> with <a href="ncapi2/py_api/FifoDataType.html">FifoDataType</a>.</p>
+
+<p>Note: If the input <a href="ncapi2/py_api/FifoDataType.html">FifoDataType</a> is configured to FP32, the API will convert the data to the FP16 data type automatically when performing inferences. If the output <a href="ncapi2/py_api/FifoDataType.html">FifoDataType</a> is configured to 32FP, the API will convert the output back to the FP32 data type.</p>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">fifo</span><span class="o">.</span><span class="n">set_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoOption</span><span class="o">.</span><span class="n">RW_DATA_TYPE</span><span class="p">,</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoDataType</span><span class="o">.</span><span class="n">FP32</span><span class="p">)</span>
+</code></pre></div></div>
+
+<h2 id="other-changes">Other changes</h2>
+<p>Most class and function names and signatures were updated. Please reference the <a href="ncapi2/py_api/readme.html">NCAPI v2</a> documentation for correct usage.</p>
+
+<p><a href="#Top">Top</a></p>
+
+<h1 id="equivalent-api-calls"><a name="API"></a>Equivalent API Calls</h1>
+
+<h3 id="enumerations">Enumerations</h3>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v1</th>
+      <th>NCAPI v2</th>
+      <th>Notes</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncapi1/py_api/Status.html">Status</a></td>
+      <td><a href="ncapi2/py_api/Status.html">Status</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/DeviceOption.html">DeviceOption</a></td>
+      <td><a href="ncapi2/py_api/DeviceOption.html">DeviceOption</a></td>
+      <td>There are new options in NCAPI v2.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/GlobalOption.html">GlobalOption</a></td>
+      <td><a href="ncapi2/py_api/GlobalOption.html">GlobalOption</a></td>
+      <td>There are new options in NCAPI v2.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/GraphOption.html">GraphOption</a></td>
+      <td><a href="ncapi2/py_api/GraphOption.html">GraphOption</a></td>
+      <td>There are new options in NCAPI v2.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/FifoOption.html">FifoOption</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing options for the new <a href="ncapi2/py_api/Fifo.html">Fifo</a> class.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/DeviceState.html">DeviceState</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing possible <a href="ncapi2/py_api/Device.html">Device</a> states.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/GraphState.html">GraphState</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing possible <a href="ncapi2/py_api/Graph.html">Graph</a> states.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/FifoState.html">FifoState</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing possible <a href="ncapi2/py_api/Fifo.html">Fifo</a> states.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/FifoType.html">FifoType</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing possible <a href="ncapi2/py_api/Fifo.html">Fifo</a> types (i.e. read-only, write-only, etc.).</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/FifoDataType.html">FifoDataType</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing possible <a href="ncapi2/py_api/Fifo.html">Fifo</a> data types.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/DeviceHwVersion.html">DeviceHwVersion</a></td>
+      <td>This is a new enumeration in NCAPI v2 containing neural compute device hardware versions.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h3 id="structures">Structures</h3>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v1</th>
+      <th>NCAPI v2</th>
+      <th>Notes</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/TensorDescriptor.html">TensorDescriptor</a></td>
+      <td>This is a Structure class that describes graph inputs and outputs. Use <a href="ncapi2/py_api/Graph.get_option.html">Graph.get_option()</a> for <a href="ncapi2/py_api/GraphOption.html">GraphOption.INPUT_TENSOR_DESCRIPTORS</a> and <a href="ncapi2/py_api/GraphOption.html">GraphOption.OUTPUT_TENSOR_DESCRIPTORS</a> to get this data.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h3 id="global-functions">Global Functions</h3>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v1</th>
+      <th>NCAPI v2</th>
+      <th>Notes</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncapi1/py_api/EnumerateDevices.html">EnumerateDevices()</a></td>
+      <td><a href="ncapi2/py_api/enumerate_devices.html">enumerate_devices()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/SetGlobalOption.html">SetGlobalOption()</a></td>
+      <td><a href="ncapi2/py_api/global_set_option.html">global_set_option()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/GetGlobalOption.html">GetGlobalOption()</a></td>
+      <td><a href="ncapi2/py_api/global_get_option.html">global_get_option()</a></td>
+      <td> </td>
+    </tr>
+  </tbody>
+</table>
+
+<h3 id="classes">Classes</h3>
+
+<p><strong>Device</strong></p>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v1</th>
+      <th>NCAPI v2</th>
+      <th>Notes</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncapi1/py_api/Device.__init__.html">Device</a></td>
+      <td><a href="ncapi2/py_api/Device.html">Device</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/Device.OpenDevice.html">Device.OpenDevice()</a></td>
+      <td><a href="ncapi2/py_api/Device.open.html">Device.open()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/Device.AllocateGraph.html">Device.AllocateGraph()</a></td>
+      <td><a href="ncapi2/py_api/Graph.html">Graph()</a><br />+<br /><a href="ncapi2/py_api/Graph.allocate.html">Graph.allocate()</a><br /><br />or<br /><a href="ncapi2/py_api/Graph.html">Graph()</a><br />+<br /><a href="ncapi2/py_api/Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a></td>
+      <td>In NCAPI v2 two calls are required to first initialize a <a href="ncapi2/py_api/Graph.html">Graph</a> object and then allocate the graph to the device.<br /><br /><a href="ncapi2/py_api/Graph.allocate_with_fifos.html">Graph.allocate_with_fifos()</a> is a convenience function that creates and returns input and output <a href="ncapi2/py_api/Fifo.html">Fifos</a> in addition to calling <a href="ncapi2/py_api/Graph.allocate.html">Graph.allocate()</a>.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/Device.CloseDevice.html">Device.CloseDevice()</a></td>
+      <td><a href="ncapi2/py_api/Device.close.html">Device.close()</a> + <a href="ncapi2/py_api/Device.destroy.html">Device.destroy()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/Device.GetDeviceOption.html">Device.GetDeviceOption()</a></td>
+      <td><a href="ncapi2/py_api/Device.get_option.html">Device.get_option()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/Device.SetDeviceOption.html">Device.SetDeviceOption()</a></td>
+      <td><a href="ncapi2/py_api/Device.set_option.html">Device.set_option()</a></td>
+      <td> </td>
+    </tr>
+  </tbody>
+</table>
+
+<p><strong>Graph</strong></p>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v1</th>
+      <th>NCAPI v2</th>
+      <th>Notes</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncapi1/py_api/Graph.html">Graph</a></td>
+      <td><a href="ncapi2/py_api/Graph.html">Graph</a></td>
+      <td>In NCAPI v2 <a href="ncapi2/py_api/Graph.html">Graph</a> objects must be initialized before being passed to the <a href="ncapi2/py_api/Graph.allocate.html">Graph.allocate()</a> function.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/Graph.GetResult.html">Graph.GetResult()</a></td>
+      <td><a href="ncapi2/py_api/Fifo.read_elem.html">Fifo.read_elem()</a></td>
+      <td>In NCAPI v2 inference results are read from an output <a href="ncapi2/py_api/Fifo.html">Fifo</a> that was passed to the <a href="ncapi2/py_api/Graph.queue_inference.html">Graph.queue_inference()</a> method.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/Graph.LoadTensor.html">Graph.LoadTensor()</a></td>
+      <td><a href="ncapi2/py_api/Fifo.write_elem.html">Fifo.write_elem()</a><br />+<br /><a href="ncapi2/py_api/Graph.queue_inference.html">Graph.queue_inference()</a><br /><br />or<br /><a href="ncapi2/py_api/Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a></td>
+      <td>In NCAPI v2 input must be written to a properly initialized and created <a href="ncapi2/py_api/Fifo.html">Fifo</a> that will be passed to the <a href="ncapi2/py_api/Graph.queue_inference.html">Graph.queue_inference()</a> method for inference.<br /><br /><a href="ncapi2/py_api/Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a> is a convenience function that combines <a href="ncapi2/py_api/Fifo.write_elem.html">Fifo.write_elem()</a> and <a href="ncapi2/py_api/Graph.queue_inference.html">Graph.queue_inference()</a> into one call.</td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/Graph.DeallocateGraph.html">Graph.DeallocateGraph()</a></td>
+      <td><a href="ncapi2/py_api/Graph.destroy.html">Graph.destroy()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/Graph.GetGraphOption.html">Graph.GetGraphOption()</a></td>
+      <td><a href="ncapi2/py_api/Graph.get_option.html">Graph.get_option()</a></td>
+      <td> </td>
+    </tr>
+    <tr>
+      <td><a href="ncapi1/py_api/Graph.SetGraphOption.html">Graph.SetGraphOption()</a></td>
+      <td><a href="ncapi2/py_api/Graph.set_option.html">Graph.set_option()</a></td>
+      <td> </td>
+    </tr>
+  </tbody>
+</table>
+
+<p><strong>Fifo</strong> <em>(new to NCAPI2)</em></p>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v1</th>
+      <th>NCAPI v2</th>
+      <th>Notes</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/Fifo.html">Fifo</a></td>
+      <td>See the <a href="ncapi2/py_api/Fifo.html">Fifo</a> documentation or the <a href="#Example">Example Code Comparison</a> section below for more complete examples of Fifo usage.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/Fifo.allocate.html">Fifo.allocate()</a></td>
+      <td>This must be called before attempting to read/write to/from the Fifo.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/Fifo.destroy.html">Fifo.destroy()</a></td>
+      <td>When done using the Fifo, this must be called to free associated resources.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/Fifo.read_elem.html">Fifo.read_elem()</a></td>
+      <td>This replaces NCAPI v1’s <a href="ncapi1/py_api/Graph.GetResult.html">Graph.GetResult()</a>.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/Fifo.write_elem.html">Fifo.write_elem()</a></td>
+      <td>This replaces NCAPI v1’s <a href="ncapi1/py_api/Graph.LoadTensor.html">Graph.LoadTensor()</a> when used in conjunction with <a href="ncapi2/py_api/Graph.queue_inference.html">Graph.queue_inference()</a>.<br /><br />The convenience function <a href="ncapi2/py_api/Graph.queue_inference_with_fifo_elem.html">Graph.queue_inference_with_fifo_elem()</a> can be used to combine both NCAPI v2 calls into one.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/Fifo.get_option.html">Fifo.get_option()</a></td>
+      <td>See <a href="ncapi2/py_api/FifoOption.html">FifoOption</a> / <a href="ncapi2/py_api/FifoType.html">FifoType</a> / <a href="ncapi2/py_api/FifoDataType.html">FifoDataType</a>.</td>
+    </tr>
+    <tr>
+      <td><em>n/a</em></td>
+      <td><a href="ncapi2/py_api/Fifo.set_option.html">Fifo.set_option()</a></td>
+      <td>See <a href="ncapi2/py_api/FifoOption.html">FifoOption</a> / <a href="ncapi2/py_api/FifoType.html">FifoType</a> / <a href="ncapi2/py_api/FifoDataType.html">FifoDataType</a>.</td>
+    </tr>
+  </tbody>
+</table>
+
+<p><a href="#Top">Top</a></p>
+
+<h1 id="example-code-comparison"><a name="Example"></a>Example Code Comparison</h1>
+
+<p>This section contains basic usage examples for NCAPI v1, NCAPI v2, and NCAPI v2 with convenience functions for comparison.</p>
+
+<p>NCAPI v1:</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="s">"""NCAPI v1"""</span>
+<span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Open a device</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">EnumerateDevices</span><span class="p">()</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+<span class="n">device</span><span class="o">.</span><span class="n">OpenDevice</span><span class="p">()</span>
+
+<span class="c"># Load a graph from file at some GRAPH_FILEPATH</span>
+<span class="n">GRAPH_FILEPATH</span> <span class="o">=</span> <span class="s">'./graph'</span>
+<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">GRAPH_FILEPATH</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'rb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+       <span class="n">graph_buffer</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+
+<span class="c"># Allocate the graph to the device</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">device</span><span class="o">.</span><span class="n">AllocateGraph</span><span class="p">(</span><span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c"># Read and pre-process input (16 bit floating point data type required)</span>
+<span class="n">input_tensor</span> <span class="o">=</span> <span class="o">...</span>
+
+<span class="c"># Load the image to the device and trigger an inference</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">LoadTensor</span><span class="p">(</span><span class="n">input_tensor</span><span class="p">,</span> <span class="s">'user object'</span><span class="p">)</span>
+
+<span class="c"># Get the results from the device</span>
+<span class="n">output</span><span class="p">,</span> <span class="n">userobj</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">GetResult</span><span class="p">()</span>
+
+<span class="c"># Do something with the results...</span>
+
+<span class="c"># Clean up</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">DeallocateGraph</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">CloseDevice</span><span class="p">()</span>
+</code></pre></div></div>
+
+<p>NCAPI v2:</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="s">"""NCAPI v2"""</span>
+<span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Initialize and open a device</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+<span class="n">device</span><span class="o">.</span><span class="nb">open</span><span class="p">()</span>
+
+<span class="c"># Initialize a graph from file at some GRAPH_FILEPATH</span>
+<span class="n">GRAPH_FILEPATH</span> <span class="o">=</span> <span class="s">'./graph'</span>
+<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">GRAPH_FILEPATH</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'rb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+       <span class="n">graph_buffer</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'graph1'</span><span class="p">)</span>
+
+<span class="c"># Allocate the graph to the device</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">allocate</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c"># Get the graphTensorDescriptor structs (they describe expected graph input/output)</span>
+<span class="n">input_descriptors</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">GraphOption</span><span class="o">.</span><span class="n">INPUT_TENSOR_DESCRIPTORS</span><span class="p">)</span>
+<span class="n">output_descriptors</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">get_option</span><span class="p">(</span><span class="n">mvncapi</span><span class="o">.</span><span class="n">GraphOption</span><span class="o">.</span><span class="n">OUTPUT_TENSOR_DESCRIPTORS</span><span class="p">)</span>
+
+<span class="c"># Create input/output Fifos</span>
+<span class="n">input_fifo</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Fifo</span><span class="p">(</span><span class="s">'input1'</span><span class="p">,</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_WO</span><span class="p">)</span>
+<span class="n">output_fifo</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Fifo</span><span class="p">(</span><span class="s">'output1'</span><span class="p">,</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">FifoType</span><span class="o">.</span><span class="n">HOST_RO</span><span class="p">)</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">allocate</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">input_descriptors</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="mi">2</span><span class="p">)</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">allocate</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">output_descriptors</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="mi">2</span><span class="p">)</span>
+
+<span class="c"># Read and pre-process input (data type must match input Fifo data type)</span>
+<span class="n">input_tensor</span> <span class="o">=</span> <span class="o">...</span>
+
+<span class="c"># Write the image to the input queue</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">write_elem</span><span class="p">(</span><span class="n">input_tensor</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+
+<span class="c"># Queue the inference</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">queue_inference</span><span class="p">(</span><span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span><span class="p">)</span>
+
+<span class="c"># Get the results from the output queue</span>
+<span class="n">output</span><span class="p">,</span> <span class="n">user_obj</span> <span class="o">=</span> <span class="n">output_fifo</span><span class="o">.</span><span class="n">read_elem</span><span class="p">()</span>
+
+<span class="c"># Do something with the results...</span>
+
+<span class="c"># Clean up</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+<p>NCAPI v2 with convenience functions:</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="s">"""NCAPI v2"""</span>
+<span class="kn">from</span> <span class="nn">mvnc</span> <span class="kn">import</span> <span class="n">mvncapi</span>
+
+<span class="c"># Initialize and open a device</span>
+<span class="n">device_list</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">enumerate_devices</span><span class="p">()</span>
+<span class="n">device</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Device</span><span class="p">(</span><span class="n">device_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+<span class="n">device</span><span class="o">.</span><span class="nb">open</span><span class="p">()</span>
+
+<span class="c"># Initialize a graph from file at some GRAPH_FILEPATH</span>
+<span class="n">GRAPH_FILEPATH</span> <span class="o">=</span> <span class="s">'./graph'</span>
+<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">GRAPH_FILEPATH</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'rb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
+       <span class="n">graph_buffer</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+<span class="n">graph</span> <span class="o">=</span> <span class="n">mvncapi</span><span class="o">.</span><span class="n">Graph</span><span class="p">(</span><span class="s">'graph1'</span><span class="p">)</span>
+
+<span class="c"># CONVENIENCE FUNCTION: </span>
+<span class="c"># Allocate the graph to the device and create input/output Fifos with default options in one call</span>
+<span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">allocate_with_fifos</span><span class="p">(</span><span class="n">device</span><span class="p">,</span> <span class="n">graph_buffer</span><span class="p">)</span>
+
+<span class="c"># Read and pre-process input (data type must match input Fifo data type)</span>
+<span class="n">input_tensor</span> <span class="o">=</span> <span class="o">...</span>
+
+<span class="c"># CONVENIENCE FUNCTION: </span>
+<span class="c"># Write the image to the input queue and queue the inference in one call</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">queue_inference_with_fifo_elem</span><span class="p">(</span><span class="n">input_fifo</span><span class="p">,</span> <span class="n">output_fifo</span><span class="p">,</span> <span class="n">input_tensor</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+
+<span class="c"># Get the results from the output queue</span>
+<span class="n">output</span><span class="p">,</span> <span class="n">user_obj</span> <span class="o">=</span> <span class="n">output_fifo</span><span class="o">.</span><span class="n">read_elem</span><span class="p">()</span>
+
+<span class="c"># Do something with the results...</span>
+
+<span class="c"># Clean up</span>
+<span class="n">input_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">output_fifo</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">graph</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+<span class="n">device</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
+</code></pre></div></div>
+
+<p><a href="#Top">Top</a></p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncapi/readme.html b/docs/ncapi/readme.html
new file mode 100644 (file)
index 0000000..552b3ac
--- /dev/null
@@ -0,0 +1,92 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../assets/css/style.css">
+    <script src="../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="neural-compute-api">Neural Compute API</h1>
+<p>Applications for performing inferences with the Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) can be developed in either C/C++ or Python.
+The Neural Compute API (NCAPI) provides a software interface to load network graphs and run inferences on neural compute devices.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>NCAPI v2 Documentation</th>
+      <th>NCAPI v1 Documentation</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="ncapi2/c_api/readme.html">C API v2</a><br /><a href="ncapi2/py_api/readme.html">Python API v2</a></td>
+      <td><a href="ncapi1/c_api/readme.html">C API v1 (legacy)</a><br /><a href="ncapi1/py_api/readme.html">Python API v1 (legacy)</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="ncapi-v1-vs-ncapi-v2">NCAPI v1 vs. NCAPI v2</h2>
+
+<p>The original NCSDK used NCAPI v1.
+That version has been superseded by NCAPI v2, which is not backwards-compatible (i.e. programs written with NCAPI v1 will not compile or run with NCAPI v2).</p>
+
+<p>NCAPI v2 was created to provide developers with more flexibility when developing applications for neural compute devices. Key advantages to NCAPI v2 are:</p>
+
+<ul>
+  <li>Multiple network graphs can be allocated to a single neural compute device (up to 10 graphs per device, limited by device memory)</li>
+  <li>Input/output is handled with first-in, first-out (FIFO) queues, which support queueing multiple inference inputs/outputs</li>
+  <li>32 bit floating point (FP32) input/output is supported</li>
+</ul>
+
+<p>NCAPI v1 is no longer being updated so NCAPI v2 should be used for all new application development.
+Documentation for NCAPI v1 will still be provided for legacy applications.</p>
+
+<h3 id="migrating-applications-from-ncapi-v1-to-ncapi-v2">Migrating Applications from NCAPI v1 to NCAPI v2</h3>
+
+<p>For information about migrating a Python application from NCAPI v1 to NCAPI v2, see:</p>
+<ul>
+  <li><a href="python_api_migration.html">Migrating Python Applications from NCAPI v1 to NCAPI v2</a></li>
+</ul>
+
+<p>For information about migrating a C/C++ application from NCAPI v1 to NCAPI v2, see:</p>
+<ul>
+  <li><a href="c_api_migration.html">Migrating C/C++ Applications from NCAPI v1 to NCAPI v2</a></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncs.html b/docs/ncs.html
new file mode 100644 (file)
index 0000000..cc75801
--- /dev/null
@@ -0,0 +1,74 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <p><a name="Introduction"></a></p>
+<h1 id="introduction">Introduction</h1>
+<p>The Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) enables rapid prototyping of deep neural networks (DNNs) with the Intel® Movidius™ Neural Compute SDK (NCSDK).</p>
+
+<ul>
+  <li><a href="https://developer.movidius.com/buy">Where to Buy</a></li>
+</ul>
+
+<p>To use the NCS, you will need to have the <a href="index.html">Intel® Movidius™ Neural Compute SDK</a> (Intel® Movidius™ NCSDK) and/or Neural Compute API (NCAPI) installed on your development computer.</p>
+
+<h1 id="connecting-the-ncs-to-a-host-machine">Connecting the NCS to a Host Machine</h1>
+<p>The NCS connects to the host machine over a USB 2.0 High Speed interface. You may plug the NCS directly into a USB port on your host machine or into a USB hub that is plugged into your host machine.</p>
+
+<p><img src="images/ncs_plugged.jpg" alt="" /></p>
+
+<h1 id="architecture">Architecture</h1>
+
+<p>The NCS is powered by the Intel® Movidius™ Myriad™ 2 vision processing unit (VPU).</p>
+
+<p>The VPU includes 4Gbits of LPDDR3 DRAM, imaging and vision accelerators, and an array of 12 VLIW vector processors called SHAVE processors. These processors are used to accelerate neural networks by running parts of the neural networks in parallel.</p>
+
+<p>The NCS is connected to a host machine using the USB interface on the VPU. The USB3 interface can be used both in Super Speed (5 Gbps) or High Speed (480 Mbps) modes.</p>
+
+<p>The VPU also has a SPARC microprocessor core that runs custom firmware. When the NCS is first plugged in, there is no firmware loaded onto it. The VPU boots from the internal ROM and connects to the host machine as a USB 2.0 device. Applications executing on the host machine communicate to the VPU SOC using the Neural Compute API (NCAPI). When the NCAPI initializes and opens a device, the firmware from the Neural Compute SDK (NCSDK) is loaded onto the NCS. At this time, the NCS resets and reconnects to the host machine as either a USB 2.0 or USB 3.0 device (depending on the host type). It is now ready to accept the neural network graph files and instructions to execute inferences.</p>
+
+<p>A graph file is loaded into the DRAM attached to the VPU via the NCAPI. A LEON processor coordinates receiving the graph file and images for inference via the USB connection. It also parses the graph file and schedules kernels to the SHAVE neural compute accelerator engines. In addition, the LEON processor also takes care of monitoring die temperature and throttling processing on high temperature alerts. The output of the neural network and associated statistics are sent back to the host machine via the USB connection and are received by the host application via the NCAPI.</p>
+
+<p><img src="images/NCS1_ArchDiagram.jpg" alt="" /></p>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/ncs1arch.md b/docs/ncs1arch.md
deleted file mode 100644 (file)
index c91b3eb..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Introduction
-
-The Neural Compute SDK works on compiling and executing a given Caffe or TensorFlow™ Neural Network on the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS). Read on for a detailed explanation.
-
-# Architecture Details
-The following diagram shows the inner workings of the Intel Movidius NCS. The Intel Movidius NCS primarily contains the Intel® Movidius™ Myriad™ 2 vision processing unit (VPU) and some power delivery voltage regulators. The Intel Movidius Myriad 2 VPU includes 4 Gbit of LPDDR3 DRAM, and its architecture includes specific imaging and vision accelerators and an array of 12 VLIW vector processors called SHAVE processors. These processors are used to accelerate neural networks by running parts of the neural networks in parallel for achieving the highest performance. The Intel Movidius NCS is connected to an application processor (AP), such as a Raspberry Pi or UP Squared board, using the USB interface on the Intel Movidius Myriad 2 VPU. The USB3 interface can be used both in Super Speed (5 Gbps) or High Speed (480 Mbps) modes.
-
-The CPU in the Intel Movidius Myriad 2 VPU is a SPARC microprocessor core that runs custom firmware. When the Intel Movidius Neural Compute Stick is first plugged in, there is no firmware loaded onto it. The Intel Movidius Myriad 2 VPU boots from the internal ROM and connects to the host computer (application processor) as a USB 2.0 device.
-
-Applications executing on the host computer (AP) communicate to the Intel Movidius Myriad VPU SOC using the Neural Compute API. When the API initializes and opens a device, the firmware from the Neural Compute SDK is loaded onto the Intel Movidius Neural Compute Stick. At this time, the Intel Movidius NCS resets and now shows up to the host computer as a USB 2.0 or USB 3.0 device depending on the host type. It is now ready to accept the neural network graph files and commands to execute inferences on the graph files.
-
-![](images/NCS1_ArchDiagram.jpg)
-
-
-
-A graph file is loaded into the DRAM attached to the Intel Movidius Myriad 2 VPU via the API. The LEON processor coordinates receiving the graph file and images for inference via the USB connection. It also parses the graph file and schedules kernels to the SHAVE neural compute accelerator engines. In addition, the LEON processor also takes care of monitoring die temperature and throttling processing on high temperature alerts. Statistics and the output of the neural network are sent back to the host computer via the USB connection, and they are received by a host application via the API.
-
-In addition to the API, the NCSDK provides the tools mvNCCompile, mvNCCheck, and mvNCProfile that run on the host computer during application and neural network development. The checker and profiler tools run an inference on the Intel Movidius Neural Compute Stick to validate against Caffe/TensorFlow and generate per layer statistics respectively.
diff --git a/docs/py_api/Device.AllocateGraph.md b/docs/py_api/Device.AllocateGraph.md
deleted file mode 100644 (file)
index 779eca8..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-# Device.AllocateGraph()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also|[Graph](Graph.md)<br>[Graph.DeallocateGraph()](Graph.DeallocateGraph.md)<br>|
-
-## Overview
-This function is used to create an instance of a Graph that represents a neural network, which can be used to infer results via methods Graph.LoadTensor() and Graph.GetResult().
-
-## Syntax
-
-```python
-dev.AllocateGraph(graphPath)
-```
-
-## Parameters
-
-|Parameter      | Description |
-|---------------|---------------|
-|graphPath      | A string that is the path to the graph file. The graph file must have been created with the NC SDK graph compiler.|
-
-## Return
-Returns an instance of a Graph object that is ready to use.  
-
-## Known Issues
-After the Graph that is created is no longer needed, Graph.DeallocateGraph() must be called to free the graph resources. 
-
-## Example
-```python
-
-from mvnc import mvncapi as ncs
-# Enumerate Devices
-device_List = ncs.Enumerate()
-
-# Initialize and open the first device
-device = ncs.Device(device_List[0])
-device.OpenDevice()
-
-# Allocate a graph on the device by specifying the path to a graph file 
-graph = device.AllocateGraph("../networks/myNetwork/graph")
-
-# Use graph here
-
-# Deallocate the graph to free resources
-graph.DeallocateGraph()
-
-#close device
-```
diff --git a/docs/py_api/Device.CloseDevice.md b/docs/py_api/Device.CloseDevice.md
deleted file mode 100644 (file)
index 6c5dc47..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# Device.CloseDevice()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also|[Device.\_\_init\_\_()](Device.__init__.md) <br>[Device.OpenDevice()](Device.OpenDevice.md)|
-
-## Overview
-This function is used to cease communication and reset the device.
-
-## Syntax
-```python
-dev.CloseDevice()
-```
-
-## Parameters
-None.
-
-## Return
-None.
-
-## Known Issues
-
-## Example
-```Python
-# Open and close the first NCS device
-import mvnc.mvncapi as ncs
-
-deviceNames = ncs.EnumerateDevices()
-firstDevice = ncs.Device(deviceNames[0])
-
-# Open the device
-firstDevice.OpenDevice()
-
-# Use device here
-
-# Close the device 
-firstDevice.CloseDevice()
-```
diff --git a/docs/py_api/Device.GetDeviceOption.md b/docs/py_api/Device.GetDeviceOption.md
deleted file mode 100644 (file)
index f3850c2..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# Device.GetDeviceOption()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |[Device.SetDeviceOption()](Device.SetDeviceOption.md) <br>[DeviceOption](DeviceOption.md)|
-
-## Overview
-This function is used to get an option for the device. The options can be found in the [DeviceOption](DeviceOption.md) enumeration table.  
-
-## Syntax
-```python
-GetDeviceOption(option)
-```
-
-## Parameters
-
-|Parameter      | Description |
-|---------------|---------------|
-| option        | Member of the DeviceOption enumeration that specifies which option to get.|
-
-## Return
-The value for the specified device option. The type of the returned value depends on the option specified. See the [DeviceOption](DeviceOption.md) enumeration for the type that will be returned for each option.
-
-## Known Issues
-
-## Example
-```python
-import mvnc.mvncapi as ncs
-
-# Initialize and open device
-
-# Get the device option THERMAL_THROTTLING_LEVEL
-optionValue = device.GetDeviceOption(mvnc.DeviceOption.THERMAL_THROTTLING_LEVEL)
-
-```
diff --git a/docs/py_api/Device.OpenDevice.md b/docs/py_api/Device.OpenDevice.md
deleted file mode 100644 (file)
index d36befc..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# Device.OpenDevice()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also|[Device.\_\_init\_\_()](Device.__init__.md) <br>[Device.CloseDevice()](Device.CloseDevice.md)|
-
-## Overview
-This function is used to initialize the device.  
-
-## Syntax
-```python
-OpenDevice()
-```
-
-## Parameters
-None.
-
-## Return
-None.
-
-## Known Issues
-
-## Example
-```python
-#############################################
-# Open first device only
-import mvnc.mvncapi as ncs
-deviceNames = ncs.EnumerateDevices()
-firstDevice = ncs.Device(deviceNames[0])
-firstDevice.OpenDevice()
-# Use device
-firstDevice.CloseDevice()
-#############################################
-
-
-#############################################
-# Open all devices
-import mvnc.mvncapi as ncs
-devices = ncs.EnumerateDevices()
-devlist = list()
-for devnum in range(len(devices)):
-    devlist.append(ncs.Device(devices[devnum]))
-    devlist[devnum].OpenDevice()
-#
-# Use devices in devlist
-#
-for dev in devList:
-    dev.CloseDevice()
-#############################################
-    
-```
diff --git a/docs/py_api/Device.SetDeviceOption.md b/docs/py_api/Device.SetDeviceOption.md
deleted file mode 100644 (file)
index 6200dd9..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# Device.SetDeviceOption()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |[Device.GetDeviceOption()](Device.GetDeviceOption.md) <br>[DeviceOption](DeviceOption.md)|
-
-## Overview
-This function is used to set an option for the device. The options can be found in the [DeviceOption](DeviceOption.md) enumeration class.  
-
-## Syntax
-```python
-SetDeviceOption(option, value)
-```
-
-## Parameters
-
-|Parameter  | Description |
-|-----------|---------------|
-|option     | Member of the DeviceOption enumeration class that specifies which device option to set. |
-|value      | The new value to which the device option will be set. The type to pass for this parameter depends on which option is being set. See the [DeviceOption](DeviceOption.md) enumeration class for the types that correspond to each option.|
-
-
-## Return
-None.
-
-## Known Issues
-
-## Example
-```python
-
-
-```
diff --git a/docs/py_api/Device.__init__.md b/docs/py_api/Device.__init__.md
deleted file mode 100644 (file)
index e1260ba..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# Device.\_\_init\_\_()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also||
-
-## Overview
-This function is used to initialize a device object.
-
-## Syntax
-
-```python
-mvnc.Device("device name here")
-```
-
-## Parameters
-
-|Parameter      | Description |
-|---------------|---------------|
-|deviceName     | The name of the device to initialize. This must come from calling mvncapi module function EnumerateDevices().|
-
-## Return 
-None.
-
-## Known Issues
-
-## Example
-```python
-import mvnc.mvncapi as ncs
-
-# Enumerate devices
-deviceNames = ncs.EnumerateDevices()
-
-# Create and init a device instance
-ncsDevice = ncs.Device(deviceNames[0])
-
-# Open device, use device, close device
-
-```
diff --git a/docs/py_api/Device.md b/docs/py_api/Device.md
deleted file mode 100644 (file)
index c7f3bca..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# Device Class
-
-The Device class represents the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) device. Typically one instance of this class is created for each physical NCS device that is plugged into the system, so multiple instances may exist if you have multiple devices attached to your system.
-
-## Usage
-To use the Device class, you must create and initialize it by name. The valid names to use can be determined by calling the mvncapi module function EnumerateDevices(). Once you have successfully created an instance of this class, the typical usage is to call OpenDevice(), AllocateGraph(), use the graph, and CloseDevice(). 
-
-## Device methods
-- [\_\_init\_\_](Device.__init__.md)
-- [OpenDevice](Device.OpenDevice.md)
-- [CloseDevice](Device.CloseDevice.md)
-- [SetDeviceOption](Device.SetDeviceOption.md)
-- [GetDeviceOption](Device.GetDeviceOption.md)
-- [AllocateGraph](Device.AllocateGraph.md)
diff --git a/docs/py_api/DeviceOption.md b/docs/py_api/DeviceOption.md
deleted file mode 100644 (file)
index 2d6ec16..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# DeviceOption Enumeration Class
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |[Device.SetDeviceOption()](Device.SetDeviceOption.md) <br>[Device.GetDeviceOption()](Device.GetDeviceOption.md)|
-
-
-
-## Overview
-The DeviceOption class is an enumeration class that defines the options that are passed to and received from the SetDeviceOption and the GetDeviceOption functions.
-
-
-enum                     | option type | possible values|get/set|Description
------------------------- | ----------- | -------------- |-------|-----------
-THERMAL_THROTTLING_LEVEL | int         | 1, 2           | get   |1: if lower guard temperature threshold of chip sensor is reached. This indicates short throttling time is in action between inferences to protect the device. <br>2: if upper guard temperature of chip sensor is reached. This indicates long throttling time is in action between inferences to protect the device.
-
diff --git a/docs/py_api/EnumerateDevices.md b/docs/py_api/EnumerateDevices.md
deleted file mode 100644 (file)
index 2f88186..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# EnumerateDevices()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |  [Device](Device.md)       |
-
-## Overview
-This function is used to get a list of the names of the devices present in the system. Each of the names returned can be used to create an instance of the Device class. 
-
-## Syntax
-
-```python
-deviceNames = EnumerateDevices()
-```
-
-## Parameters
-None.
-
-## Return
-An array of device names, each of which can be used to create a new instance of the Device class.
-
-## Known Issues
-
-## Example
-```Python
-import mvnc.mvncapi as ncs
-deviceNames = ncs.EnumerateDevices()
-if len(deviceNames) == 0:
-       print("Error - No devices detected.")
-       quit()
-
-# Open first NCS device found
-device = ncs.Device(deviceNames[0])    
-       
-# Allocate graph / otherwise use device as needed
-
-# Deallocate graph if allocated
-
-device.CloseDevice()
-```
diff --git a/docs/py_api/GetGlobalOption.md b/docs/py_api/GetGlobalOption.md
deleted file mode 100644 (file)
index 950cac7..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# GetGlobalOption
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |  [GlobalOption](GlobalOption.md)<br>[SetGlobalOption()](SetGlobalOption.md)|
-
-## Overview
-This function is used to get a Global option. The available options can be found in the [GlobalOption](GlobalOption.md) enumeration section.
-
-## Syntax
-
-```python
-value = GetGlobalOption(option)
-```
-
-## Parameters
-
-|Parameter      | Description |
-|---------------|---------------|
-|option     |Member of the GlobalOption enumeration that specifies which option to get.|
-
-## Return
-The value for the specified option. The type of the returned value depends on the option specified. See the [GlobalOption](GlobalOption.md) enumeration for the type that will be returned for each option.
-
-## Known Issues
-
-## Example
-```Python
-from mvnc import mvncapi as mvnc
-
-# Get current logging level Global Option
-logLevel = mvnc.GetGlobalOption(mvnc.GlobalOption.LOGLEVEL)
-
-print("The current global logging level is: ", logLevel)
-```
diff --git a/docs/py_api/GlobalOption.md b/docs/py_api/GlobalOption.md
deleted file mode 100644 (file)
index 54ea6b9..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# GlobalOption Enumeration Class
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |  [SetGlobalOption()](SetGlobalOption.md) <br>[GetGlobalOption()](GetGlobalOption.md)|
-
-
-
-## Overview
-The GlobalOption class is an enumeration class that defines the options that are passed to and received from the SetGlobalOption and the GetGlobalOption functions.
-
-
-enum     | option type | possible values|get/set   |Description
--------- | ----------- | -------------- |----------|-----------
-LOGLEVEL | int         | 0, 1, 2        | get, set | 0 = Nothing is printed (default) <br>1 = Print errors only <br>2 = Verbose
-
-
-
-
diff --git a/docs/py_api/Graph.DeallocateGraph.md b/docs/py_api/Graph.DeallocateGraph.md
deleted file mode 100644 (file)
index 202e8f2..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# Graph.DeallocateGraph()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also|[Device.AllocateGraph()](Device.AllocateGraph.md)|
-
-## Overview
-This function is used to deallocate a graph that was allocated for an Intel® Movidius™ NCS device with the Device.AllocateGraph() method.  This should be called for every graph that is created to free resources associated with the graph. 
-
-## Syntax
-
-```python
-graph.DeallocateGraph()
-```
-## Parameters
-None.
-
-## Return
-None.
-
-## Known Issues
-The Graph class can only be created via the Device.AllocateGraph() function.  
-
-## Example
-```python
-
-import mvnc.mvncapi as ncs
-deviceNames = ncs.EnumerateDevices()
-if len(deviceNames) == 0:
-       print("Error - No devices detected.")
-       quit()
-
-# Open first NCS device found
-device = mvnc.Device(devices[0])
-
-# Allocate the graph 
-device.AllocateGraph("my_graph")
-
-# Use device here
-
-graph.DeallocateGraph()
-
-device.CloseDevice()
-```
diff --git a/docs/py_api/Graph.GetGraphOption.md b/docs/py_api/Graph.GetGraphOption.md
deleted file mode 100644 (file)
index 1514b63..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# Graph.GetGraphOption()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also|[Graph.SetGraphOption()](Graph.SetGraphOption.md) <br>[GraphOption](GraphOption.md)|
-
-## Overview
-This function is used to get a graph option. The available options can be found in [GraphOption](GraphOption.md) enumeration class. 
-
-## Syntax
-```python
-value = graph.GetGraphOption(option)
-```
-
-## Parameters
-
-|Parameter      | Description |
-|---------------|---------------|
-|option   |  A value from the GraphOption enumeration to specify which option's value should be returned. |
-
-## Return
-The value for the specified GraphOption is returned. The type of the returned value depends on the option specified. See the [GraphOption](GraphOption.md) class for the value types for each option.
-
-## Known Issues
-
-## Example
-```python
-import mvnc.mvncapi as ncs
-deviceNames = ncs.EnumerateDevices()
-ncsDevice = ncs.Device(deviceNames[0])
-ncsDevice.OpenDevice()
-graph = ncsDevice.AllocateGraph("../networks/myNetwork/graph")
-
-# Get the graph option
-optionValue = graph.GetGraphOption(mvnc.GraphOption.DONTBLOCK)
-
-# Use device here
-
-graph.DeallocateGraph()
-ncsDevice.CloseDevice()    
-
-
-
-```
diff --git a/docs/py_api/Graph.GetResult.md b/docs/py_api/Graph.GetResult.md
deleted file mode 100644 (file)
index 04eab4a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# Graph.GetResult()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |[Graph.LoadTensor()](Graph.LoadTensor.md)|
-
-## Overview
-This function retrieves the result of an inference that was initiated via Graph.LoadTensor() on the specified graph.  
-
-## Syntax
-```python
-inferenceResult, userObj = graph.GetResult()
-```
-
-## Parameters
-None.
-
-## Return
-The inference result and user object that was specified in the Graph.LoadTensor() call that initiated this inference.
-
-## Known Issues
-
-## Example
-```python
-
-# Open NCS device and allocate a graph
-
-graph.LoadTensor(img.astype(numpy.float16), "user object for this inference")
-inferenceResult, userObj = graph.GetResult()
-
-# Deallocate graph
-# Close device
-
-```
diff --git a/docs/py_api/Graph.LoadTensor.md b/docs/py_api/Graph.LoadTensor.md
deleted file mode 100644 (file)
index 602d9dd..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# Graph.LoadTensor()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |[Graph.GetResult()](Graph.GetResult.md)|
-
-## Overview
-This function initiates an inference on the specified graph via the associated Intel® Movidius™ NCS device. After calling this function, use the Graph.GetResult() function to retrieve the inference result.
-
-## Syntax
-
-```python
-graph.LoadTensor(inputTensor, userObject)
-```
-## Parameters
-
-|Parameter      | Description |
-|---------------|---------------|
-|inputTensor   |  Input data on which an inference will be run. The data must be passed in a NumPy ndarray of half precision floats (float 16). |         |
-|userObject    |  A user-defined parameter that is returned by the GetResult function along with the inference result for this tensor.|
-
-## Return
-Returns True if the function works, False if not. When the graph is in non-blocking mode (GraphOption.DONTBLOCK), this function will return False if the device is busy. 
-
-## Known Issues
-
-## Example
-```python
-
-# Enumerate Device
-# Open Device, # Allocate Graph, # Set Graph Option
-# Read an image, resize the image and adjust for mean if necessary to match the network expected size
-
-if (graph.LoadTensor(img.astype(numpy.float16), 'user object')):
-    print("LoadTensor success")
-    output, userobj = graph.GetResult()
-
-# Deallocate the graph and Close the device
-```
diff --git a/docs/py_api/Graph.SetGraphOption.md b/docs/py_api/Graph.SetGraphOption.md
deleted file mode 100644 (file)
index 91e5a86..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# Graph.SetGraphOption()
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also|[Graph.GetGraphOption()](Graph.GetGraphOption.md) <br>[GraphOption](GraphOption.md)|
-
-## Overview
-This function is used to set a graph option. The available options can be found in the [GraphOption](GraphOption.md) enumeration class. 
-
-## Syntax
-```python
-graph.SetGraphOption(option, value)
-```
-
-## Parameters
-
-Parameter      | Description
----------------|---------------
-option         | Member of the GraphOption enumeration specifying which option's value will be set.
-value          | The new value to which the specified graph option will be set. See the [GraphOption](GraphOption.md) enumeration class for the type of value for each option.
-
-
-## Return
-None.
-
-## Known Issues
-
-## Example
-```python
-import mvnc.mvncapi as ncs
-deviceNames = ncs.EnumerateDevices()
-ncsDevice = ncs.Device(deviceNames[0])
-ncsDevice.OpenDevice()
-graph = ncsDevice.AllocateGraph("../networks/myNetwork/graph")
-
-graph.SetGraphOption(mvnc.GraphOption.DONTBLOCK, 1)
-
-# Use device here
-
-graph.DeallocateGraph()
-ncsDevice.CloseDevice()    
-```
diff --git a/docs/py_api/Graph.md b/docs/py_api/Graph.md
deleted file mode 100644 (file)
index b9c3b30..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Graph Class
-
-The Graph class is a container for a neural network graph file that is associated with a particular Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) device. 
-
-## Usage
-To use the Graph class, you must create a graph handle by calling AllocateGraph() from the Device class. The location of the graph file will be passed to AllocateGraph(), and it will return an instance of the Graph class. Once you have successfully created an instance of this class, the typical usage is to optionally get/set graph options, then call LoadTensor() and GetResult() to perform inferencing with the graph that was allocated. Finally, call DeallocateGraph() when the neural network is no longer needed. 
-
-## Graph methods
-- [DeallocateGraph](Graph.DeallocateGraph.md)
-- [SetGraphOption](Graph.SetGraphOption.md)
-- [GetGraphOption](Graph.GetGraphOption.md)
-- [LoadTensor](Graph.LoadTensor.md)
-- [GetResult](Graph.GetResult.md)
diff --git a/docs/py_api/GraphOption.md b/docs/py_api/GraphOption.md
deleted file mode 100644 (file)
index 05eee91..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# GraphOption Enumeration Class
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |  [Graph.SetGraphOption()](Graph.SetGraphOption.md) <br>[Graph.GetGraphOption()](Graph.GetGraphOption.md)|
-
-
-
-## Overview
-The GraphOption class is an enumeration class that defines the options that are passed to and received from the SetDeviceOption and the GetDeviceOption functions.
-
-
-enum| option type | possible values|get/set|Description
---- | ----------- | -------------- |-------|-----------
-DONTBLOCK |int    |0 or 1|get/set|0: Calls to Graph.LoadTensor() and Graph.GetResult() will block (won't return until the action is completed) (Default)<br>1: Calls to those functions don't block (they will return immediately).  If the action coudn't be completed the return value will indicate why.  Graph.LoadTensor() will return MVNC_BUSY when the NCS isn't able to perform the action because its busy, try again later.  Graph.GetResult() will return MVNC_NO_DATA unless there is an inference that is ready to be returned.  In this case try again later and when there is a completed inference the results will be returned.
-TIMETAKEN |string |any|get|Return a NumPy float array [numpy.array()] of inference times per layer in float data type.
-DEBUGINFO |string |any|get|Return a string with the error text as returned by the device.
diff --git a/docs/py_api/SetGlobalOption.md b/docs/py_api/SetGlobalOption.md
deleted file mode 100644 (file)
index 09959eb..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-# SetGlobalOption
-
-|Info      | Value |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |  [GlobalOption](GlobalOption.md)<br>[GetGlobalOption()](GetGlobalOption.md)|
-
-## Overview
-This function is used to set a Global option. The available Global options and possible values can be found in the documentation for the [GlobalOption](GlobalOption.md) enumeration.
-
-## Syntax
-
-```python
-SetGlobalOption(option, value)
-```
-
-## Paramerers
-
-|Parameter      | Description |
-|---------------|---------------|
-|option|Member of the GlobalOptions enumeration that specifies which option to set.|
-|value |The new value to which the option will be set. See the [GlobalOption](GlobalOption.md) enumeration class for the type of value for each option.| 
-
-## Known Issues
-
-## Example
-```Python
-import mvnc.mvncapi as ncs
-
-# Set the global logging level to verbose
-ncs.SetGlobalOption(ncs.GlobalOption.LOGLEVEL, 2)
-```
diff --git a/docs/py_api/Status.md b/docs/py_api/Status.md
deleted file mode 100644 (file)
index 8713b49..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# Status Enumeration Class
-
-|Info      | Value         |
-|----------|---------------|
-|Package   |  mvnc         |
-|Module    |  mvncapi      |
-|Version   |  1.0          |
-|See also  |               |
-
-
-## Overview
-The Status class is an enumeration class that defines status codes returned from calls to the API functions. If the underlying API returns a non-zero status, an exception is usually raised with the corresponding status. The possible status codes are shown below. 
-
-
-Enumeration Values|Description
------------- | -------------
-MVNC_OK |The function call worked as expected.
-MVNC_BUSY |The device is busy, retry later.
-MVNC_ERROR |An unexpected error was encountered during the function call.
-MVNC_OUT_OF_MEMORY |The host is out of memory.
-MVNC_DEVICE_NOT_FOUND |There is no device at the given index or name.
-MVNC_INVALID_PARAMETERS |At least one of the given parameters is invalid in the context of the function call.
-MVNC_TIMEOUT |Timeout in the communication with the device
-MVNC_MVCMD_NOT_FOUND |The file named MvNCAPI.mvcmd is installed in the mvnc directory. This message means that the file has been moved or installer failed.
-MVNC_NO_DATA |No data to return.
-MVNC_GONE |The graph or device has been closed during the operation.
-MVNC_UNSUPPORTED_GRAPH_FILE |The graph file is corrupt or may have been created with an incompatible prior version of the NCS toolkit. Try to recompile the graph file with the version of the toolkit that corresponds to the API version.
-MVNC_MYRIAD_ERROR |An error has been reported by the Intel® Movidius™ VPU. Use MVNC_DEBUGINFO.
-
diff --git a/docs/py_api/readme.md b/docs/py_api/readme.md
deleted file mode 100644 (file)
index c0880d2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# Intel® Movidius™ Neural Compute SDK Python API
-
-The Intel® Movidius™ Neural Compute SDK comes with a Python3 Language API that enables applications that utilize hardware accelerated Deep Neural Networks via the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS). The API is provided as a single Python script (mvncapi.py), which is placed on the development computer when the SDK is installed. Details of the Python API are provided below and within the documents linked from here. 
-
-## Class Diagram
-The Python class diagram follows. In this diagram, it is shown that the entire Python API is in the mvnc Python package. Within the mvnc package, there is one Python module, which is mvncapi. The mvncapi module is defined by the contents of the mvncapi.py file.
-
-![](../images/python_api_class_diagram.jpg)
-
-The details of the elements within the mvncapi module are provided in the lists that follow. These include module level enumerations, functions that are global to the module, and the classes defined in the module. 
-
-## Enumerations
-- [GlobalOption](GlobalOption.md)
-- [DeviceOption](DeviceOption.md)
-- [GraphOption](GraphOption.md)
-- [Status](Status.md)
-
-## Global Functions
-- [EnumerateDevices](EnumerateDevices.md)
-- [SetGlobalOption](SetGlobalOption.md)
-- [GetGlobalOption](GetGlobalOption.md)
-
-
-## Classes
-- [Device](Device.md)
-- [Graph](Graph.md)
-
-
diff --git a/docs/readme.md b/docs/readme.md
deleted file mode 100644 (file)
index 0ed35b0..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-
-<a name="Introduction"></a>
-# Introduction 
-The Intel® Movidius™ Neural Compute SDK (NCSDK) and Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) enable rapid prototyping, validation, and deployment of deep neural networks (DNNs).
-
-The NCS is used in two primary scenarios:
-- Profiling, tuning, and compiling a DNN on a development computer (host system) with the tools provided in the Intel Movidius Neural Compute SDK. In this scenario, the host system is typically a desktop or laptop machine running Ubuntu 16.04 desktop (x86, 64 bit), but you can use any supported platform for these steps.
-
-- Prototyping a user application on a development computer (host system), which accesses the hardware of the Intel Movidius NCS to accelerate DNN inferences via the API provided with the Intel Movidius Neural Compute SDK. In this scenario, the host system can be a developer workstation or any developer system that runs an operating system compatible with the API. 
-
-The following diagram shows the typical workflow for development with the Intel Movidius NCS:
-![](images/ncs_workflow.jpg)
-
-The training phase does not utilize the Intel Movidius NCS hardware or NCSDK, while the subsequent phases of “profiling, tuning, and compiling” and “prototyping” do require the Intel Movidius NCS hardware and the accompanying Intel Movidius Neural Compute SDK.
-
-The NCSDK contains a set of software tools to compile, profile, and check validity of your DNN as well as an API for both the C and Python programming languages. The API is provided to allow users to create software that offloads the neural network computation onto the Intel Movidius Neural Compute Stick.
-
-The following is more information on the [architecture](ncs1arch.md) of the Intel Movidius Neural Compute Stick:
-
-<a name="Frameworks"></a>
-# Frameworks
-Neural Compute SDK currently supports two Deep Learning frameworks.
-1. [Caffe](Caffe.md): Caffe is a deep learning framework from Berkeley Vision Labs.
-2. [TensorFlow™](TensorFlow.md): TensorFlow™ is a deep learning framework from Google.
-
-[See how to use networks from these supported frameworks with Intel Movidius NCS.](configure_network.md)
-
-
-<a name="InstallAndExamples"></a>
-# Installation and Examples 
-The following commands install NCSDK and run examples. Detailed instructions for [installation and configuration](install.md):
-
-```
-git clone http://github.com/Movidius/ncsdk && cd ncsdk && make install && make examples
-
-```
-<a name="NcSdkTools"></a>
-# Intel® Movidius™ Neural Compute SDK Tools
-The SDK comes with a set of tools to assist in development and deployment of applications that utilize hardware accelerated Deep Neural Networks via the Intel Movidius Neural Compute Stick. Each tool and its usage is described below:
-
-* [mvNCCompile](tools/compile.md): Converts Caffe/TF network and weights to Intel Movidius technology internal compiled format
-
-* [mvNCProfile](tools/profile.md): Provides layer-by-layer statistics to evaluate the performance of Caffe/TF networks on the NCS
-
-* [mvNCCheck](tools/check.md): Compares the results from an inference by running the network on the NCS and Caffe/TF
-
-<a name="NcApi"></a>
-# Neural Compute API
-Applications for inferencing with Neural Compute SDK can be developed either in C/C++ or Python. The API provides a software interface to Open/Close Neural Compute Sticks, load graphs into the Intel Movidius NCS, and run inferences on the stick.
-
-* [C API](c_api/readme.md)
-* [Python API](py_api/readme.md)
-
-<a name="UserForum"></a>
-# Intel® Movidius™ Neural Compute Stick User Forum
-
-There is an active user forum in which users of the Intel Movidius Neural Compute Stick discuss ideas and issues they have with regard to the Intel Movidius NCS. Access the Intel Movidius NCS User Forum with the following link:
-
-[https://ncsforum.movidius.com](https://ncsforum.movidius.com)
-
-The forum is a good place to go if you need help troubleshooting an issue. You may find other people who have figured out the issue, or get ideas for how to fix it. The forum is also monitored by Intel Movidius product engineers who provide solutions, as well.
-
-<a name="Examples"></a>
-# Examples
-
-There are several examples, including the following at GitHub:
-* Caffe
-  * GoogLeNet
-  * AlexNet
-  * SqueezeNet
-* TensorFlow™
-  * Inception V1
-  * Inception V3
-* Apps
-  * hello_ncs_py
-  * hello_ncs_cpp
-  * multistick_cpp
-
-The examples demonstrate compiling, profiling, and running inferences using the network on the Intel Movidius Neural Compute Stick.
-Each example contains a Makefile. Running 'make help' in the example's base directory will give possible make targets.
-
-```
-
-git clone http://github.com/Movidius/ncsdk # Already done during installation
-(cd ncsdk/examples && make) # run all examples
-(cd ncsdk/examples/caffe/GoogLeNet && make) # Run just one example
-
-```
-
-<a name="AppZoo"></a>
-# Neural Compute App Zoo
-The Neural Compute App Zoo is a GitHub repository at [http://github.com/Movidius/ncappzoo](http://github.com/Movidius/ncappzoo), which is designed for developers to contribute networks and applications written for the Intel Movidus Neural Compute Stick to the Intel Movidius NCS community.
-
-See [The Neural Compute App Zoo README](https://github.com/Movidius/ncappzoo/blob/master/README.md) for more information.
-
-<a name="TroubleShooting"></a>
-# Troubleshooting and Tech Support
-Be sure to check the [NCS Troubleshooting Guide](https://ncsforum.movidius.com/discussion/370/intel-ncs-troubleshooting-help-and-guidelines#latest) if you run into any issues with the NCS or NCSDK.
-
-Also for general tech support issues the [NCS User Forum](https://developer.movidius.com/forums) is recommended and contains community discussions on many issues and resolutions.
-
-<a name="ReleaseNotes"></a>
-# Release Notes
-See the latests [Release Notes](release_notes.md) for detailed information of the specific release.
diff --git a/docs/release_notes.html b/docs/release_notes.html
new file mode 100644 (file)
index 0000000..63d0b51
--- /dev/null
@@ -0,0 +1,182 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <p>============================================================</p>
+<h1 id="movidius-neural-compute-sdk-release-notes">Movidius Neural Compute SDK Release Notes</h1>
+<h1 id="v20400-2018-05-04">V2.04.00 2018-05-04</h1>
+<p>============================================================</p>
+
+<p>As of V2.04.00, SDK has been refactored and contains many new features and structural changes. It is recommended you read the documentation to familiarize with the new features and contents.</p>
+
+<h2 id="sdk-notes">SDK Notes:</h2>
+
+<h3 id="new-features">New features:</h3>
+<ol>
+  <li>Tensorflow 1.6 supported.  Tensorflow 1.6 is automatically installed on Ubuntu.</li>
+  <li>Multiple network graphs can be allocated to a single neural compute device (up to 10 graphs per device, limited by device memory)</li>
+  <li>32 bit floating point (FP32) input/output is supported</li>
+</ol>
+
+<h4 id="networks">Networks:</h4>
+<ol>
+  <li>No change</li>
+</ol>
+
+<h4 id="layers">Layers:</h4>
+<ol>
+  <li>Support PlaceholderWithDefault nodes in TensorFlow models.</li>
+</ol>
+
+<h2 id="api-notes">API Notes:</h2>
+<ol>
+  <li>API has been heavily refactored, please review <a href="ncapi/readme.html">NCAPI v1 vs. NCAPI v2</a> for feature comparison.</li>
+  <li>Apps written with NCAPI v1 are not compatible with this release and need to be migrated to NCAPI v1, refer to <a href="ncapi/readme.html">Migrating Applications from NCAPI v1 to NCAPI v2</a> for information about migrating apps to the new API.</li>
+</ol>
+
+<h2 id="network-notes">Network Notes:</h2>
+<p>Support for the following networks has been tested.</p>
+
+<h3 id="caffe">Caffe</h3>
+<ol>
+  <li>GoogleNet V1</li>
+  <li>SqueezeNet V1.1</li>
+  <li>LeNet</li>
+  <li>CaffeNet</li>
+  <li>VGG (Sousmith VGG_A)</li>
+  <li>Alexnet</li>
+  <li>Ti1. nyYolo v1</li>
+  <li>VGG 16</li>
+  <li>Resnet 50</li>
+  <li>SSD Mobilenet v1</li>
+</ol>
+
+<h3 id="tensorflow-r16">Tensorflow r1.6</h3>
+<ol>
+  <li>inception-v1</li>
+  <li>inception-v2</li>
+  <li>inception-v3</li>
+  <li>inception-v4</li>
+  <li>Inception ResNet v2</li>
+  <li>VGG 16</li>
+  <li>Mobilenet_V1_1.0 variants:
+    <ul>
+      <li>MobileNet_v1_1.0_224</li>
+      <li>MobileNet_v1_1.0_192</li>
+      <li>MobileNet_v1_1.0_160</li>
+      <li>MobileNet_v1_1.0_128</li>
+      <li>MobileNet_v1_0.75_224</li>
+      <li>MobileNet_v1_0.75_192</li>
+      <li>MobileNet_v1_0.75_160</li>
+      <li>MobileNet_v1_0.75_128</li>
+      <li>MobileNet_v1_0.5_224</li>
+      <li>MobileNet_v1_0.5_192</li>
+      <li>MobileNet_v1_0.5_160</li>
+      <li>MobileNet_v1_0.5_128</li>
+      <li>MobileNet_v1_0.25_224</li>
+      <li>MobileNet_v1_0.25_192</li>
+      <li>MobileNet_v1_0.25_160</li>
+      <li>MobileNet_v1_0.25_128</li>
+    </ul>
+  </li>
+  <li>TinyYolo v2 via Darkflow tranformation</li>
+</ol>
+
+<h2 id="firmware-features">Firmware Features:</h2>
+<ol>
+  <li>Convolutions
+    <ul>
+      <li>NxN Convolution with Stride S.</li>
+      <li>The following cases have been extensively tested: 1x1s1,3x3s1,5x5s1,7x7s1, 7x7s2, 7x7s4</li>
+      <li>Group convolution</li>
+      <li>Depth Convolution</li>
+      <li>Dilated convolution</li>
+    </ul>
+  </li>
+  <li>Max Pooling Radix NxM with Stride S</li>
+  <li>Average Pooling: Radix NxM with Stride S, Global average pooling</li>
+  <li>Local Response Normalization</li>
+  <li>Relu, Relu-X, Prelu (see erattum #10)</li>
+  <li>Softmax</li>
+  <li>Sigmoid</li>
+  <li>Tanh (see erratum #10)</li>
+  <li>Deconvolution</li>
+  <li>Slice</li>
+  <li>Scale</li>
+  <li>ElmWise unit : supported operations - sum, prod, max</li>
+  <li>Fully Connected Layers (limited support – see erratum #8)</li>
+  <li>Reshape</li>
+  <li>Flatten</li>
+  <li>Power</li>
+  <li>Crop</li>
+  <li>ELU</li>
+  <li>Batch Normalization</li>
+  <li>L2 Normalization</li>
+  <li>Input Layer</li>
+</ol>
+
+<h2 id="bug-fixes">Bug Fixes:</h2>
+<ol>
+  <li>Fixed: Facenet and other network regression due to TensorFlow 1.6 changes.</li>
+</ol>
+
+<h2 id="errata">Errata:</h2>
+<ol>
+  <li>Python 2.7 is fully supported for making user applications, but only the helloworld_py example runs as-is in both python 2.7 and 3.5 due to dependencies on modules.</li>
+  <li>Depth-wise convolution may not be supported if channel multiplier &gt; 1.</li>
+  <li>If working behind proxy, proper proxy settings must be applied for the installer to succeed.</li>
+  <li>Although improved, the installer is known to take a long time on Raspberry Pi. Date/time must be correct for SDK installation to succeed on Raspberry Pi.</li>
+  <li>Default system virtual memory swap file size is too small to compile AlexNet, and VGG networks on Raspberry Pi.</li>
+  <li>Raspberry Pi users will need to upgrade to Raspbian Stretch for releases after 1.09.</li>
+  <li>Convolution may fail to find a solution for very large inputs.</li>
+  <li>Depth-wise convolution is tested for 3x3 kernels.</li>
+  <li>A TanH layer’s “top” &amp; “bottom” blobs must have different names.  This is different from a ReLU layer, whose “top” &amp; “bottom” should be named the same as its previous layer.</li>
+  <li>On upgrade from previous versions of SDK, the installer will detect if openCV 3.3.0 was installed, for example from http://github.com/movidius/ncappzoo/apps/stream_ty_gn/install-opencv-from_source.sh.  For this release, the installer will prompt to uninstall this specific version of openCV. This is required for ssd-caffe to run correctly.  After 2.04 installation is complete, openCV 3.3.0 can be re-installed and the ssd-caffe will continue to function.</li>
+  <li>The MTCNN network in the app zoo is showing unexpected behavior for this release, and is being investigated.  To use MTCNN, please use version 1.12.00 of SDK.</li>
+  <li>Although mvNCCheck shows per-pixel error for some metrics for mobilenet_v1_224, classification results are not impacted.</li>
+  <li>Only Ubuntu 16.04 LTS is supported as a host OS for this release.  Ubuntu 18.04 is being evaluated.</li>
+  <li>The visualization graph created by mvNCProfile may have an erroneous connection through the data layer.</li>
+  <li>Initial validation has been done on SSD Mobilenet, TinyYolo v1 and v2, but more thorough evaluation is underway.</li>
+</ol>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/release_notes.md b/docs/release_notes.md
deleted file mode 100644 (file)
index f8987ea..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-============================================================
-# Movidius Neural Compute SDK Release Notes
-# V1.12.00 2018-01-10
-============================================================
-
-## SDK Notes: 
-### New features:
-1. Improved compiler support for custom networks that use variable batch size via Tensorflow. 
-2. Improved description on how to use Tensorflow networks that were built for training.  Please see "Guidence for Compiling TensorFlow Networks" in the SDK documentation
-#### Networks:
-1. Facenet based on inception-resnet-v1 (see erratum #12)
-#### Layers:
-
-## API Notes:
-1. No change
-
-## Network Notes:
-Support for the following networks has been tested.
-
-### Caffe
-1. GoogleNet V1 
-2. SqueezeNet V1.1 
-3. LeNet 
-4. CaffeNet 
-5. VGG (Sousmith VGG_A)
-6. Alexnet
-7. TinyYolo v1
-8. VGG 16
-9. Resnet 50
-10. Resnet-18
-11. SSD Mobilenet v1
-
-
-
-### Tensorflow r1.3
-1. inception-v1
-2. inception-v2
-3. inception-v3
-4. inception-v4
-5. Inception ResNet v2
-6. VGG 16
-7. Mobilenet_V1_1.0 variants: 
-   - MobileNet_v1_1.0_224
-   - MobileNet_v1_1.0_192
-   - MobileNet_v1_1.0_160
-   - MobileNet_v1_1.0_128
-   - MobileNet_v1_0.75_224
-   - MobileNet_v1_0.75_192
-   - MobileNet_v1_0.75_160
-   - MobileNet_v1_0.75_128
-   - MobileNet_v1_0.5_224
-   - MobileNet_v1_0.5_192
-   - MobileNet_v1_0.5_160
-   - MobileNet_v1_0.5_128
-   - MobileNet_v1_0.25_224
-   - MobileNet_v1_0.25_192
-   - MobileNet_v1_0.25_160
-   - MobileNet_v1_0.25_128
-8. TinyYolo v2 via Darkflow tranformation
-9. Facenet based on inception-resnet-v1 (See erratum #12)
-
-## Firmware Features:
-1. Convolutions
-  - NxN Convolution with Stride S.
-  - The following cases have been extensively tested: 1x1s1,3x3s1,5x5s1,7x7s1, 7x7s2, 7x7s4
-  - Group convolution
-  - Depth Convolution
-  - Dilated convolution
-2. Max Pooling Radix NxM with Stride S
-3. Average Pooling: Radix NxM with Stride S, Global average pooling
-4. Local Response Normalization
-5. Relu, Relu-X, Prelu (see erattum #10)
-6. Softmax
-7. Sigmoid
-8. Tanh (see erratum #10)
-9. Deconvolution
-10. Slice
-11. Scale
-12. ElmWise unit : supported operations - sum, prod, max 
-13. Fully Connected Layers (limited support -- see erratum #8)
-14. Reshape
-15. Flatten
-16. Power
-17. Crop
-18. ELU
-19. Batch Normalization
-20. L2 Normalization
-21. Input Layer
-
-## Bug Fixes:
-1. Fixed: Tensorflow FusedBatchNorm doesn't support fully connected layer inputs
-2. Fixed: Mobilenets on Tensforflow 1.4 provide incorrect classification 
-3. Fixed: Resnet-18 on Caffe providing NaN results
-
-## Errata:
-1. Python 2.7 is fully supported for making user applications, but only the helloworld_py example runs as-is in both python 2.7 and 3.5 due to dependencies on modules.
-2. SDK tools for tensorflow on Rasbpian Stretch are not supported for this release, due to lack of an integrated tensorflow installer for Rasbpian in the SDK. TF examples are provided with pre-compiled graph files to allow them to run on Rasperry Pi, however the compile, profile, and check functions will not be available on Raspberry Pi, and 'make examples' will generate failures for the tensorflow examples on Raspberry Pi.
-3. Depth-wise convolution may not be supported if channel multiplier > 1.
-4. If working behind proxy, proper proxy settings must be applied for the installer to succeed. 
-5. Although improved, the installer is known to take a long time on Raspberry Pi. Date/time must be correct for SDK installation to succeed on Raspberry Pi.
-6. Default system virtual memory swap file size is too small to compile AlexNet on Raspberry Pi.  VGG 16 not verified to compile on Pi.
-7. Raspberry Pi users will need to upgrade to Raspbian Stretch for releases after 1.09.
-8. Convolution may fail to find a solution for very large inputs.
-9. Depth convolution is tested for 3x3 kernels.
-10. A TanH layer’s “top” & “bottom” blobs must have different names.  This is different from a ReLU layer, whose “top” & “bottom” should be named the same as its previous layer.
-11. On upgrade from previous versions of SDK, the installer will detect if openCV 3.3.0 was installed, for example from http://github.com/movidius/ncappzoo/apps/stream_ty_gn/install-opencv-from_source.sh.  For this release, the installer will prompt to uninstall this specific version of openCV. This is required for ssd-caffe to run correctly.  After 1.11 installation is complete, openCV 3.3.0 can be re-installed and the ssd-caffe will continue to function.
-12. Facenet requires L2 Normalization be inserted to be used, please see the support forum for a saver script example. 
-13. Although mvNCCheck shows per-pixel error for some metrics for mobilenet_v1_224, classification results are not impacted.
-14. Initial validation has been done on SSD Mobilenet v1 and TinyYolo v2 but more thorough evaluation is underway. 
diff --git a/docs/tensorflow.html b/docs/tensorflow.html
new file mode 100644 (file)
index 0000000..78a8ec0
--- /dev/null
@@ -0,0 +1,95 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="tensorflow-support">TensorFlow™ Support</h1>
+
+<p><a href="https://www.tensorflow.org/">TensorFlow™</a> is a deep learning framework pioneered by Google. The Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) introduced TensorFlow support with the NCSDK v1.09.xx release. TensorFlow validation for each release happens on the TensorFlow version noted in the release notes.</p>
+
+<p><em>Default installation location: /opt/movidius/tensorflow</em></p>
+
+<h3 id="tensorflow-model-zoo">TensorFlow™ Model Zoo</h3>
+
+<p>TensorFlow™ has a GitHub repository for models at <a href="https://github.com/tensorflow/models">https://github.com/tensorflow/models</a>. It contains several models that are maintained by the respective authors.</p>
+
+<h1 id="compiling-tensorflow-networks">Compiling TensorFlow™ Networks</h1>
+
+<ul>
+  <li>If you are compiling a model from the <a href="https://github.com/tensorflow/models">TensorFlow™ Model Zoo</a> for use with the NCSDK and Neural Compute API, follow the <a href="tf_modelzoo.html">Guidance for Compiling TensorFlow™ Model Zoo Networks</a>.</li>
+  <li>If you are compiling a TensorFlow-Slim network for use with the NCSDK and Neural Compute API, follow the <a href="tf_slim.html">Guidance for Compiling TensorFlow-Slim Networks</a>.</li>
+  <li>If you are otherwise training your own TensorFlow™ network model for use with the NCSDK and Neural Compute API, follow the <a href="tf_compile_guidance.html">Guidance for Compiling TensorFlow™ Networks</a>.</li>
+</ul>
+
+<h1 id="supported-networks">Supported Networks</h1>
+<ul>
+  <li>Inception v1</li>
+  <li>Inception v2</li>
+  <li>Inception v3</li>
+  <li>Inception v4</li>
+  <li>Inception ResNet v2</li>
+  <li>MobileNet_v1_1.0 variants:
+    <ul>
+      <li>MobileNet_v1_1.0_224</li>
+      <li>MobileNet_v1_1.0_192</li>
+      <li>MobileNet_v1_1.0_160</li>
+      <li>MobileNet_v1_1.0_128</li>
+      <li>MobileNet_v1_0.75_224</li>
+      <li>MobileNet_v1_0.75_192</li>
+      <li>MobileNet_v1_0.75_160</li>
+      <li>MobileNet_v1_0.75_128</li>
+      <li>MobileNet_v1_0.5_224</li>
+      <li>MobileNet_v1_0.5_192</li>
+      <li>MobileNet_v1_0.5_160</li>
+      <li>MobileNet_v1_0.5_128</li>
+      <li>MobileNet_v1_0.25_224</li>
+      <li>MobileNet_v1_0.25_192</li>
+      <li>MobileNet_v1_0.25_160</li>
+      <li>MobileNet_v1_0.25_128</li>
+    </ul>
+  </li>
+</ul>
+
+<p><em>See <a href="release_notes.html">release notes</a> for supported networks for a particular release.</em></p>
+
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/tf_compile_guidance.html b/docs/tf_compile_guidance.html
new file mode 100644 (file)
index 0000000..c2e5a98
--- /dev/null
@@ -0,0 +1,202 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="guidance-for-compiling-tensorflow-networks">Guidance for Compiling TensorFlow™ Networks</h1>
+<p>Below you will find general guidance for compiling a TensorFlow™ network that was built for training rather than inference.  The general guidance is illustrated with changes to make to the <a href="https://github.com/tensorflow/tensorflow/blob/r1.4/tensorflow/examples/tutorials/mnist/mnist_deep.py">mnist_deep.py available from the TensorFlow™ GitHub repository</a>.  The changes are shown as typical diff output where a ‘-‘ at the front of a line indicates the line is removed, and a ‘+’ at the front of a line indicates the line should be added.  Lines without a ‘-‘ or ‘+’ are unchanged and provided for context.</p>
+
+<p>In order to compile a TensorFlow™ network for use with the Neural Compute API you will need to save a version of the network that is specific to deployment/inference and omits the training features.  The following list of steps includes what users need to do to compile a typical TensorFlow™ network.  Every step may not apply to every network, but should be taken as general guidance.</p>
+
+<ul>
+  <li>Make sure there is a name set for the first layer of the network.  This is not strictly required but makes compiling much easier because if you don’t explicitly name the first and last layer you will need to determine what name those layers were given and provide those to the compiler.  For mnist_deep.py you would make the following change for the first node to give it the name “input”:</li>
+</ul>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>   <span class="c"># Create the model</span>
+<span class="o">-</span>  <span class="n">x</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">placeholder</span><span class="p">(</span><span class="n">tf</span><span class="o">.</span><span class="n">float32</span><span class="p">,</span> <span class="p">[</span><span class="bp">None</span><span class="p">,</span> <span class="mi">784</span><span class="p">])</span>
+<span class="o">+</span>  <span class="n">x</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">placeholder</span><span class="p">(</span><span class="n">tf</span><span class="o">.</span><span class="n">float32</span><span class="p">,</span> <span class="p">[</span><span class="bp">None</span><span class="p">,</span> <span class="mi">784</span><span class="p">],</span> <span class="n">name</span><span class="o">=</span><span class="s">"input"</span><span class="p">)</span>
+</code></pre></div></div>
+
+<ul>
+  <li>Add TensorFlow™ code to save the trained network.  For mnist_deep.py the change to save the trained network is:</li>
+</ul>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">+</span>  <span class="n">saver</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">train</span><span class="o">.</span><span class="n">Saver</span><span class="p">()</span>
+<span class="o">+</span>
+   <span class="k">with</span> <span class="n">tf</span><span class="o">.</span><span class="n">Session</span><span class="p">()</span> <span class="k">as</span> <span class="n">sess</span><span class="p">:</span>
+<span class="o">...</span>
+
+   <span class="k">print</span><span class="p">(</span><span class="s">'test accuracy </span><span class="si">%</span><span class="s">g'</span> <span class="o">%</span> <span class="n">accuracy</span><span class="o">.</span><span class="nb">eval</span><span class="p">(</span><span class="n">feed_dict</span><span class="o">=</span><span class="p">{</span>
+       <span class="n">x</span><span class="p">:</span> <span class="n">mnist</span><span class="o">.</span><span class="n">test</span><span class="o">.</span><span class="n">images</span><span class="p">,</span> <span class="n">y_</span><span class="p">:</span> <span class="n">mnist</span><span class="o">.</span><span class="n">test</span><span class="o">.</span><span class="n">labels</span><span class="p">,</span> <span class="n">keep_prob</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">}))</span>
+<span class="o">+</span>
+<span class="o">+</span>  <span class="n">graph_location</span> <span class="o">=</span> <span class="s">"."</span>
+<span class="o">+</span>  <span class="n">save_path</span> <span class="o">=</span> <span class="n">saver</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">sess</span><span class="p">,</span> <span class="n">graph_location</span> <span class="o">+</span> <span class="s">"/mnist_model"</span><span class="p">)</span>
+</code></pre></div></div>
+
+<ul>
+  <li>Run the code to train the network and make sure saver.save() is called to save the trained network.  After the program completes, if it was successful, saver.save() will have created the following files:
+    <ul>
+      <li>mnist_model.index</li>
+      <li>mnist_model.data-00000-of-00001</li>
+      <li>mnist_model.meta</li>
+    </ul>
+  </li>
+  <li>Remove training specific code from the network, and add code to read in the previously saved network to create an inference only version.  For this step its advised that you copy the original TensorFlow™ code to a new file and modify the new file.  For example if you are working with mnist_deep.py you could copy that to mnist_deep_inference.py.  Things to remove from the inference code are:
+    <ul>
+      <li>Dropout layers</li>
+      <li>Training specific code
+        <ul>
+          <li>Reading or importing training and testing data</li>
+          <li>Cross entropy/accuracy code</li>
+          <li>Placeholders except the input tensor.</li>
+        </ul>
+      </li>
+    </ul>
+  </li>
+</ul>
+
+<p>The ncsdk compiler does not resolve unknown placeholders.  Often extra placeholders are used for training specific variables so they are not necessary for inference.  Placeholder variables that cannot be removed should be replaced by constants in the inference graph.</p>
+
+<p>For mnist_deep.py you would make the following changes</p>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">tempfile</span> 
+<span class="o">-</span>  <span class="kn">from</span> <span class="nn">tensorflow.examples.tutorials.mnist</span> <span class="kn">import</span> <span class="n">input_data</span>
+
+<span class="o">...</span>
+<span class="o">-</span>  <span class="c"># Dropout - controls the complexity of the model, prevents co-adaptation of</span>
+<span class="o">-</span>  <span class="c"># features.</span>
+<span class="o">-</span>  <span class="k">with</span> <span class="n">tf</span><span class="o">.</span><span class="n">name_scope</span><span class="p">(</span><span class="s">'dropout'</span><span class="p">):</span>
+<span class="o">-</span>    <span class="n">keep_prob</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">placeholder</span><span class="p">(</span><span class="n">tf</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span>
+<span class="o">-</span>    <span class="n">h_fc1_drop</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">nn</span><span class="o">.</span><span class="n">dropout</span><span class="p">(</span><span class="n">h_fc1</span><span class="p">,</span> <span class="n">keep_prob</span><span class="p">)</span>
+
+<span class="o">...</span>
+
+<span class="o">-</span>    <span class="n">y_conv</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="n">h_fc1_drop</span><span class="p">,</span> <span class="n">W_fc2</span><span class="p">)</span> <span class="o">+</span> <span class="n">b_fc2</span>
+<span class="o">-</span>  <span class="k">return</span> <span class="n">y_conv</span><span class="p">,</span> <span class="n">keep_prob</span>
+<span class="o">+</span>    <span class="n">y_conv</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">matmul</span><span class="p">(</span><span class="n">h_fc1</span><span class="p">,</span> <span class="n">W_fc2</span><span class="p">)</span> <span class="o">+</span> <span class="n">b_fc2</span>
+<span class="o">+</span>  <span class="k">return</span> <span class="n">y_conv</span>
+  
+<span class="o">...</span>
+
+<span class="o">-</span>  <span class="c"># Import data</span>
+<span class="o">-</span>  <span class="n">mnist</span> <span class="o">=</span> <span class="n">input_data</span><span class="o">.</span><span class="n">read_data_sets</span><span class="p">(</span><span class="n">FLAGS</span><span class="o">.</span><span class="n">data_dir</span><span class="p">,</span> <span class="n">one_hot</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+
+<span class="o">...</span>
+
+<span class="o">-</span>  <span class="c"># Define loss and optimizer</span>
+<span class="o">-</span>  <span class="n">y_</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">placeholder</span><span class="p">(</span><span class="n">tf</span><span class="o">.</span><span class="n">float32</span><span class="p">,</span> <span class="p">[</span><span class="bp">None</span><span class="p">,</span> <span class="mi">10</span><span class="p">])</span>
+
+<span class="o">...</span>
+
+   <span class="c"># Build the graph for the deep net</span>
+<span class="o">-</span>  <span class="n">y_conv</span><span class="p">,</span> <span class="n">keep_prob</span> <span class="o">=</span> <span class="n">deepnn</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
+<span class="o">+</span>  <span class="c"># No longer need keep_prob since removing dropout layers.</span>
+<span class="o">+</span>  <span class="n">y_conv</span> <span class="o">=</span> <span class="n">deepnn</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
+
+<span class="o">...</span>
+
+<span class="o">-</span>  <span class="k">with</span> <span class="n">tf</span><span class="o">.</span><span class="n">name_scope</span><span class="p">(</span><span class="s">'loss'</span><span class="p">):</span>
+<span class="o">-</span>    <span class="n">cross_entropy</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">nn</span><span class="o">.</span><span class="n">softmax_cross_entropy_with_logits</span><span class="p">(</span><span class="n">labels</span><span class="o">=</span><span class="n">y_</span><span class="p">,</span>
+<span class="o">-</span>                                                            <span class="n">logits</span><span class="o">=</span><span class="n">y_conv</span><span class="p">)</span>
+<span class="o">-</span>  <span class="n">cross_entropy</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">reduce_mean</span><span class="p">(</span><span class="n">cross_entropy</span><span class="p">)</span>
+<span class="o">-</span>  
+<span class="o">-</span>  <span class="k">with</span> <span class="n">tf</span><span class="o">.</span><span class="n">name_scope</span><span class="p">(</span><span class="s">'adam_optimizer'</span><span class="p">):</span>
+<span class="o">-</span>    <span class="n">train_step</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">train</span><span class="o">.</span><span class="n">AdamOptimizer</span><span class="p">(</span><span class="mf">1e-4</span><span class="p">)</span><span class="o">.</span><span class="n">minimize</span><span class="p">(</span><span class="n">cross_entropy</span><span class="p">)</span>
+<span class="o">-</span>  
+<span class="o">-</span>  <span class="k">with</span> <span class="n">tf</span><span class="o">.</span><span class="n">name_scope</span><span class="p">(</span><span class="s">'accuracy'</span><span class="p">):</span>
+<span class="o">-</span>    <span class="n">correct_prediction</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">equal</span><span class="p">(</span><span class="n">tf</span><span class="o">.</span><span class="n">argmax</span><span class="p">(</span><span class="n">y_conv</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">tf</span><span class="o">.</span><span class="n">argmax</span><span class="p">(</span><span class="n">y_</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
+<span class="o">-</span>    <span class="n">correct_prediction</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">correct_prediction</span><span class="p">,</span> <span class="n">tf</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span>
+<span class="o">-</span>  <span class="n">accuracy</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">reduce_mean</span><span class="p">(</span><span class="n">correct_prediction</span><span class="p">)</span>
+<span class="o">-</span>
+<span class="o">-</span>  <span class="n">graph_location</span> <span class="o">=</span> <span class="n">tempfile</span><span class="o">.</span><span class="n">mkdtemp</span><span class="p">()</span>
+<span class="o">-</span>  <span class="k">print</span><span class="p">(</span><span class="s">'Saving graph to: </span><span class="si">%</span><span class="s">s'</span> <span class="o">%</span> <span class="n">graph_location</span><span class="p">)</span>
+<span class="o">-</span>  <span class="n">train_writer</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">summary</span><span class="o">.</span><span class="n">FileWriter</span><span class="p">(</span><span class="n">graph_location</span><span class="p">)</span>
+<span class="o">-</span>  <span class="n">train_writer</span><span class="o">.</span><span class="n">add_graph</span><span class="p">(</span><span class="n">tf</span><span class="o">.</span><span class="n">get_default_graph</span><span class="p">())</span>
+<span class="o">+</span>  
+<span class="o">+</span>   <span class="n">saver</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">train</span><span class="o">.</span><span class="n">Saver</span><span class="p">(</span><span class="n">tf</span><span class="o">.</span><span class="n">global_variables</span><span class="p">())</span>
+<span class="o">+</span>
+   <span class="k">with</span> <span class="n">tf</span><span class="o">.</span><span class="n">Session</span><span class="p">()</span> <span class="k">as</span> <span class="n">sess</span><span class="p">:</span>
+       <span class="n">sess</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">tf</span><span class="o">.</span><span class="n">global_variables_initializer</span><span class="p">())</span>
+<span class="o">+</span>      <span class="n">sess</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">tf</span><span class="o">.</span><span class="n">local_variables_initializer</span><span class="p">())</span>
+<span class="o">+</span>      <span class="c"># read the previously saved network.</span>
+<span class="o">+</span>      <span class="n">saver</span><span class="o">.</span><span class="n">restore</span><span class="p">(</span><span class="n">sess</span><span class="p">,</span> <span class="s">'.'</span> <span class="o">+</span> <span class="s">'/mnist_model'</span><span class="p">)</span>
+<span class="o">+</span>      <span class="c"># save the version of the network ready that can be compiled for NCS</span>
+<span class="o">+</span>      <span class="n">saver</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">sess</span><span class="p">,</span> <span class="s">'.'</span> <span class="o">+</span> <span class="s">'/mnist_inference'</span><span class="p">)</span>
+
+<span class="o">-</span>  <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">5000</span><span class="p">):</span>
+<span class="o">-</span>    <span class="n">batch</span> <span class="o">=</span> <span class="n">mnist</span><span class="o">.</span><span class="n">train</span><span class="o">.</span><span class="n">next_batch</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
+<span class="o">-</span>    <span class="k">if</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">100</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+<span class="o">-</span>      <span class="n">train_accuracy</span> <span class="o">=</span> <span class="n">accuracy</span><span class="o">.</span><span class="nb">eval</span><span class="p">(</span><span class="n">feed_dict</span><span class="o">=</span><span class="p">{</span>
+<span class="o">-</span>          <span class="n">x</span><span class="p">:</span> <span class="n">batch</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">y_</span><span class="p">:</span> <span class="n">batch</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">keep_prob</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">})</span>
+<span class="o">-</span>      <span class="k">print</span><span class="p">(</span><span class="s">'step </span><span class="si">%</span><span class="s">d, training accuracy </span><span class="si">%</span><span class="s">g'</span> <span class="o">%</span> <span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">train_accuracy</span><span class="p">))</span>
+<span class="o">-</span>    <span class="n">train_step</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">feed_dict</span><span class="o">=</span><span class="p">{</span><span class="n">x</span><span class="p">:</span> <span class="n">batch</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">y_</span><span class="p">:</span> <span class="n">batch</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">keep_prob</span><span class="p">:</span> <span class="mf">0.5</span><span class="p">})</span>
+<span class="o">-</span>    
+<span class="o">-</span>    <span class="k">print</span><span class="p">(</span><span class="s">'test accuracy </span><span class="si">%</span><span class="s">g'</span> <span class="o">%</span> <span class="n">accuracy</span><span class="o">.</span><span class="nb">eval</span><span class="p">(</span><span class="n">feed_dict</span><span class="o">=</span><span class="p">{</span>
+<span class="o">-</span>        <span class="n">x</span><span class="p">:</span> <span class="n">mnist</span><span class="o">.</span><span class="n">test</span><span class="o">.</span><span class="n">images</span><span class="p">,</span> <span class="n">y_</span><span class="p">:</span> <span class="n">mnist</span><span class="o">.</span><span class="n">test</span><span class="o">.</span><span class="n">labels</span><span class="p">,</span> <span class="n">keep_prob</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">}))</span>
+<span class="o">-</span>    <span class="n">save_path</span> <span class="o">=</span> <span class="n">saver</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">sess</span><span class="p">,</span> <span class="s">"./model.ckpt"</span><span class="p">)</span>
+</code></pre></div></div>
+
+<ul>
+  <li>Make sure the last node is named.  As with the first node, this is not strictly required but you need to know the name to compile it.  This is the change to make to mnist_deep.py in order to have a last softmax layer with a node name of “output”:</li>
+</ul>
+
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>   <span class="c"># Build the graph for the deep net</span>
+<span class="o">-</span>  <span class="n">y_conv</span><span class="p">,</span> <span class="n">keep_prob</span> <span class="o">=</span> <span class="n">deepnn</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
+<span class="o">+</span>  <span class="n">y_conv</span> <span class="o">=</span> <span class="n">deepnn</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
+<span class="o">+</span>  <span class="n">output</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">nn</span><span class="o">.</span><span class="n">softmax</span><span class="p">(</span><span class="n">y_conv</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">'output'</span><span class="p">)</span>
+</code></pre></div></div>
+
+<ul>
+  <li>Run the inference version of the code to save a session that is suitable for compiling via the ncsdk compiler.  This will only take a second since its not actually training the network, just re-saving it in an NCS-friendly way.  After you run, if successful, the following files will be created.
+    <ul>
+      <li>mnist_inference.index</li>
+      <li>mnist_inference.data-00000-of-00001</li>
+      <li>mnist_inference.meta</li>
+    </ul>
+  </li>
+  <li>Compile the final saved network with the following command and if it all works you should see the mnist_inference.graph file created in the current directory.  Note you pass in only the weights file prefix “mnist_inference” for the -w option for a TensorFlow™ network on the compile command line.  The full command is below.</li>
+</ul>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCompile mnist_inference.meta <span class="nt">-s</span> 12 <span class="nt">-in</span> input <span class="nt">-on</span> output <span class="nt">-o</span> mnist_inference.graph
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/tf_compile_guidance.md b/docs/tf_compile_guidance.md
deleted file mode 100644 (file)
index e01768d..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-# Guidence for Compiling TensorFlow™ Networks
-Below you will find general guidance for compiling a TensorFlow™ network that was built for training rather than inference.  The general guidance is illustrated with changes to make to the [mnist_deep.py available from the tensorflow github repository](https://github.com/tensorflow/tensorflow/blob/r1.4/tensorflow/examples/tutorials/mnist/mnist_deep.py).  The changes are shown as typical diff output where a '-' at the front of a line indicates the line is removed, and a '+' at the front of a line indicates the line should be added.  Lines without a '-' or '+' are unchanged and provided for context.
-
-In order to compile a TensorFlow™ network for the NCS you will need to save a version of the network that is specific to deployment/inference and omits the training features.  The following list of steps includes what users need to do to compile a typical TensorFlow™ network for the NCS.  Every step may not apply to every network, but should be taken as general guidence.
-
-
-- Make sure there is a name set for the first layer of the network.  This is not strictly required but makes compiling much easier because if you don't explicitly name the first and last layer you will need to determine what name those layers were given and provide those to the compiler.  For mnist_deep.py you would make the following change for the first node to give it the name "input":
-
-```python
-   # Create the model
--  x = tf.placeholder(tf.float32, [None, 784])
-+  x = tf.placeholder(tf.float32, [None, 784], name="input")
-```
-
-- Add tensorflow code to save the trained network.  For mnist_deep.py the change to save the trained network is:
-
-```python
-+  saver = tf.train.Saver()
-+
-   with tf.Session() as sess:
-...
-
-   print('test accuracy %g' % accuracy.eval(feed_dict={
-       x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0}))
-+
-+  graph_location = "."
-+  save_path = saver.save(sess, graph_location + "/mnist_model")
-```
-
-- Run the code to train the network and make sure saver.save() is called to save the trained network.  After the program completes, if it was successful, saver.save() will have created the following files:
-  - mnist_model.index
-  - mnist_model.data-00000-of-00001
-  - mnist_model.meta
-
-- Remove training specific code from the network, and add code to read in the previously saved network to create an inference only version.  For this step its advised that you copy the original tensorflow code to a new file and modify the new file.  For example if you are working with mnist_deep.py you could copy that to mnist_deep_inference.py.  Things to remove from the inference code are:
-  - Dropout layers
-  - Training specific code 
-    - Reading or importing training and testing data
-    - Cross entropy/accuracy code
-    - Placeholders except the input tensor.
-
-The ncsdk compiler does not resolve unknown placeholders.  Often extra placeholders are used for training specific variables so they are not necessary for inference.  Placeholder variables that cannot be removed should be replaced by constants in the inference graph.
-    
-
-For mnist_deep.py you would make the following changes
-
-```python
-import tempfile 
--  from tensorflow.examples.tutorials.mnist import input_data
-
-...
--  # Dropout - controls the complexity of the model, prevents co-adaptation of
--  # features.
--  with tf.name_scope('dropout'):
--    keep_prob = tf.placeholder(tf.float32)
--    h_fc1_drop = tf.nn.dropout(h_fc1, keep_prob)
-
-...
-
--    y_conv = tf.matmul(h_fc1_drop, W_fc2) + b_fc2
--  return y_conv, keep_prob
-+    y_conv = tf.matmul(h_fc1, W_fc2) + b_fc2
-+  return y_conv
-  
-...
-
--  # Import data
--  mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot=True)
-
-...
-
--  # Define loss and optimizer
--  y_ = tf.placeholder(tf.float32, [None, 10])
-
-...
-
-   # Build the graph for the deep net
--  y_conv, keep_prob = deepnn(x)
-+  # No longer need keep_prob since removing dropout layers.
-+  y_conv = deepnn(x)
-
-...
-
--  with tf.name_scope('loss'):
--    cross_entropy = tf.nn.softmax_cross_entropy_with_logits(labels=y_,
--                                                            logits=y_conv)
--  cross_entropy = tf.reduce_mean(cross_entropy)
--  
--  with tf.name_scope('adam_optimizer'):
--    train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)
--  
--  with tf.name_scope('accuracy'):
--    correct_prediction = tf.equal(tf.argmax(y_conv, 1), tf.argmax(y_, 1))
--    correct_prediction = tf.cast(correct_prediction, tf.float32)
--  accuracy = tf.reduce_mean(correct_prediction)
--
--  graph_location = tempfile.mkdtemp()
--  print('Saving graph to: %s' % graph_location)
--  train_writer = tf.summary.FileWriter(graph_location)
--  train_writer.add_graph(tf.get_default_graph())
-+  
-+   saver = tf.train.Saver(tf.global_variables())
-+
-   with tf.Session() as sess:
-       sess.run(tf.global_variables_initializer())
-+      sess.run(tf.local_variables_initializer())
-+      # read the previously saved network.
-+      saver.restore(sess, '.' + '/mnist_model')
-+      # save the version of the network ready that can be compiled for NCS
-+      saver.save(sess, '.' + '/mnist_inference')
-
--  for i in range(5000):
--    batch = mnist.train.next_batch(50)
--    if i % 100 == 0:
--      train_accuracy = accuracy.eval(feed_dict={
--          x: batch[0], y_: batch[1], keep_prob: 1.0})
--      print('step %d, training accuracy %g' % (i, train_accuracy))
--    train_step.run(feed_dict={x: batch[0], y_: batch[1], keep_prob: 0.5})
--    
--    print('test accuracy %g' % accuracy.eval(feed_dict={
--        x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0}))
--    save_path = saver.save(sess, "./model.ckpt")
-```
-
-- Make sure the last node is named.  As with the first node, this is not strictly required but you need to know the name to compile it.  This is the change to make to mnist_deep.py in order to have a last softmax layer with a node name of "output":
-
-```python
-   # Build the graph for the deep net
--  y_conv, keep_prob = deepnn(x)
-+  y_conv = deepnn(x)
-+  output = tf.nn.softmax(y_conv, name='output')
-```
-
-- Run the inference version of the code to save a session that is suitable for compiling via the ncsdk compiler.  This will only take a second since its not actually training the network, just resaving it in an NCS-friendly way.  After you run, if successfull, the following files will be created.
-  - mnist_inference.index
-  - mnist_inference.data-00000-of-00001
-  - mnist_inference.meta
-
-- Compile the final saved network with the following command and if it all works you should see the mnist_inference.graph file created in the current directory.  Note you pass in only the weights file prefix "mnist_inference" for the -w option for a TensorFlow network on the compile command line.  The full command is below.
-
-```bash
-mvNCCompile mnist_inference.meta -w mnist_inference -s 12 -in input -on output -o mnist_inference.graph
-```
diff --git a/docs/tf_modelzoo.html b/docs/tf_modelzoo.html
new file mode 100644 (file)
index 0000000..fd2ca9a
--- /dev/null
@@ -0,0 +1,128 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="guidance-for-compiling-tensorflow-model-zoo-networks">Guidance for Compiling TensorFlow™ Model Zoo Networks</h1>
+
+<p>You can easily compile models from the <a href="https://github.com/tensorflow/models">TensorFlow™ Model Zoo</a> for use with the Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) and Neural Compute API using scripts provided by TensorFlow™.</p>
+
+<p>This diagram shows an overview of the process of converting the TensorFlow™ model to a Movidius™ graph file:
+<img src="images/freezegraph_diagram.jpg" alt="" /></p>
+
+<h2 id="general-steps">General Steps</h2>
+
+<h4 id="clone-tensorflow-source-code-and-tensorflow-model-repositories">Clone TensorFlow™ source code and TensorFlow™ model repositories</h4>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone https://github.com/tensorflow/tensorflow.git
+git clone https://github.com/tensorflow/models.git 
+</code></pre></div></div>
+
+<h4 id="download-and-extract-the-checkpoint-file">Download and extract the checkpoint file</h4>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wget <span class="nt">-nc</span> http://download.tensorflow.org/models/&lt;name of model <span class="nb">tar </span>file&gt;.tar.gz
+<span class="nb">tar</span> <span class="nt">-xvf</span> &lt;name of model <span class="nb">tar </span>file&gt;.tar.gz
+</code></pre></div></div>
+
+<h4 id="export-graphdef-file">Export GraphDef file</h4>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 &lt;path to TF models repo&gt;/research/slim/export_inference_graph.py <span class="se">\</span>
+               <span class="nt">--alsologtostderr</span> <span class="se">\</span>
+               <span class="nt">--model_name</span><span class="o">=</span>&lt;the name of the model&gt; <span class="se">\</span>
+               <span class="nt">--batch_size</span><span class="o">=</span>1 <span class="se">\</span>
+               <span class="nt">--dataset_name</span><span class="o">=</span>&lt;the name of the dataset&gt; <span class="se">\</span>
+               <span class="nt">--image_size</span><span class="o">=</span>&lt;one dimension of image size&gt; <span class="se">\</span>
+               <span class="nt">--output_file</span><span class="o">=</span>&lt;the name of the model&gt;.pb
+</code></pre></div></div>
+
+<h4 id="freeze-model-for-inference">Freeze model for inference</h4>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 &lt;path to TF <span class="nb">source </span>repo&gt;/tensorflow/python/tools/freeze_graph.py <span class="se">\</span>
+               <span class="nt">--input_graph</span><span class="o">=</span>&lt;the name of the model&gt;.pb <span class="se">\</span>
+               <span class="nt">--input_binary</span><span class="o">=</span><span class="nb">true</span> <span class="se">\</span>
+               <span class="nt">--input_checkpoint</span><span class="o">=</span>&lt;the name of the model&gt;.ckpt <span class="se">\</span>
+               <span class="nt">--output_graph</span><span class="o">=</span>&lt;the name of the model&gt;_frozen.pb <span class="se">\</span>
+               <span class="nt">--output_node_name</span><span class="o">=</span>&lt;name of the output node&gt;
+</code></pre></div></div>
+
+<h4 id="compile-the-movidius-graph-file">Compile the Movidius™ graph file</h4>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCompile <span class="nt">-s</span> &lt;number of shaves&gt; &lt;name of the model&gt;_frozen.pb <span class="nt">-in</span><span class="o">=</span>input <span class="nt">-on</span><span class="o">=</span>&lt;name of the output node&gt;
+</code></pre></div></div>
+
+<h2 id="example-using-inception-v3-model">Example Using Inception v3 Model</h2>
+<p>This example shows the above steps for compiling the Inception v3 model for use with the NCSDK.</p>
+
+<p>Download and extract the checkpoint file:</p>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone https://github.com/tensorflow/tensorflow.git
+git clone https://github.com/tensorflow/models.git
+</code></pre></div></div>
+
+<p>Make a directory for the model:</p>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> <span class="nt">-p</span> inception_v3
+<span class="nb">cd </span>inception_v3
+</code></pre></div></div>
+
+<p>Download and extract the checkpoint file:</p>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wget <span class="nt">-nc</span> http://download.tensorflow.org/models/inception_v3_2016_08_28.tar.gz
+<span class="nb">tar</span> <span class="nt">-xvf</span> inception_v3_2016_08_28.tar.gz
+</code></pre></div></div>
+
+<p>Export the GraphDef file:</p>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 ../models/research/slim/export_inference_graph.py <span class="se">\</span>
+               <span class="nt">--alsologtostderr</span> <span class="se">\</span>
+               <span class="nt">--model_name</span><span class="o">=</span>inception_v3 <span class="se">\</span>
+               <span class="nt">--batch_size</span><span class="o">=</span>1 <span class="se">\</span>
+               <span class="nt">--dataset_name</span><span class="o">=</span>imagenet <span class="se">\</span>
+               <span class="nt">--image_size</span><span class="o">=</span>299 <span class="se">\</span>
+               <span class="nt">--output_file</span><span class="o">=</span>inception_v3.pb
+</code></pre></div></div>
+
+<p>Freeze model for inference:</p>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 ../tensorflow/tensorflow/python/tools/freeze_graph.py <span class="se">\</span>
+               <span class="nt">--input_graph</span><span class="o">=</span>inception_v3.pb <span class="se">\</span>
+               <span class="nt">--input_binary</span><span class="o">=</span><span class="nb">true</span> <span class="se">\</span>
+               <span class="nt">--input_checkpoint</span><span class="o">=</span>inception_v3.ckpt <span class="se">\</span>
+               <span class="nt">--output_graph</span><span class="o">=</span>inception_v3_frozen.pb <span class="se">\</span>
+               <span class="nt">--output_node_name</span><span class="o">=</span>InceptionV3/Predictions/Reshape_1
+</code></pre></div></div>
+
+<p>Compile the Movidius™ graph file:</p>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCompile <span class="nt">-s</span> 12 inception_v3_frozen.pb <span class="nt">-in</span><span class="o">=</span>input <span class="nt">-on</span><span class="o">=</span>InceptionV3/Predictions/Reshape_1
+</code></pre></div></div>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/tf_slim.html b/docs/tf_slim.html
new file mode 100644 (file)
index 0000000..50a3485
--- /dev/null
@@ -0,0 +1,81 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="guidance-for-compiling-tensorflow-slim-networks">Guidance for Compiling TensorFlow-Slim Networks</h1>
+
+<p>If you are compiling a <a href="https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/slim">TensorFlow-Slim</a> network for use with the Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) and Neural Compute API, you can follow these steps.</p>
+
+<p>The code below shows how you can save a TensorFlow™ session with graph and checkpoint information.</p>
+<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span>
+<span class="kn">import</span> <span class="nn">tensorflow</span> <span class="k">as</span> <span class="n">tf</span>
+
+<span class="kn">from</span> <span class="nn">tensorflow.contrib.slim.nets</span> <span class="kn">import</span> <span class="n">inception</span>
+
+<span class="n">slim</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">contrib</span><span class="o">.</span><span class="n">slim</span>
+
+<span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">image_size</span><span class="p">,</span> <span class="n">num_classes</span><span class="p">):</span>
+    <span class="k">with</span> <span class="n">tf</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span><span class="o">.</span><span class="n">as_default</span><span class="p">():</span>
+      <span class="n">image</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">placeholder</span><span class="p">(</span><span class="s">"float"</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="n">image_size</span><span class="p">,</span> <span class="n">image_size</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="n">name</span><span class="o">=</span><span class="s">"input"</span><span class="p">)</span>
+      <span class="k">with</span> <span class="n">slim</span><span class="o">.</span><span class="n">arg_scope</span><span class="p">(</span><span class="n">inception</span><span class="o">.</span><span class="n">inception_v1_arg_scope</span><span class="p">()):</span>
+          <span class="n">logits</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">inception</span><span class="o">.</span><span class="n">inception_v1</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="n">num_classes</span><span class="p">,</span> <span class="n">is_training</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">spatial_squeeze</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+      <span class="n">probabilities</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">nn</span><span class="o">.</span><span class="n">softmax</span><span class="p">(</span><span class="n">logits</span><span class="p">)</span>
+      <span class="n">init_fn</span> <span class="o">=</span> <span class="n">slim</span><span class="o">.</span><span class="n">assign_from_checkpoint_fn</span><span class="p">(</span><span class="s">'inception_v1.ckpt'</span><span class="p">,</span> <span class="n">slim</span><span class="o">.</span><span class="n">get_model_variables</span><span class="p">(</span><span class="s">'InceptionV1'</span><span class="p">))</span>
+
+    <span class="k">with</span> <span class="n">tf</span><span class="o">.</span><span class="n">Session</span><span class="p">()</span> <span class="k">as</span> <span class="n">sess</span><span class="p">:</span>
+        <span class="n">init_fn</span><span class="p">(</span><span class="n">sess</span><span class="p">)</span>
+        <span class="n">saver</span> <span class="o">=</span> <span class="n">tf</span><span class="o">.</span><span class="n">train</span><span class="o">.</span><span class="n">Saver</span><span class="p">(</span><span class="n">tf</span><span class="o">.</span><span class="n">global_variables</span><span class="p">())</span>
+        <span class="n">saver</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">sess</span><span class="p">,</span> <span class="s">"output/"</span><span class="o">+</span><span class="n">name</span><span class="p">)</span>
+
+<span class="n">run</span><span class="p">(</span><span class="s">'inception-v1'</span><span class="p">,</span> <span class="mi">224</span><span class="p">,</span> <span class="mi">1001</span><span class="p">)</span>
+</code></pre></div></div>
+
+<p>The <code class="highlighter-rouge">is_training=False</code> parameter is important. This will leave out training-only layers (which aren’t supported by the NCSDK) from the network.</p>
+
+<p>Next, use the NCSDK <a href="tools/compile.html">mvNCCompile</a> tool to compile the saved session from the above code sample for use with the NCSDK and Neural Compute API:</p>
+
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCompile output/inception-v1.meta <span class="nt">-in</span><span class="o">=</span>input <span class="nt">-on</span><span class="o">=</span>InceptionV1/Logits/Predictions/Reshape_1 <span class="nt">-s</span> 12
+</code></pre></div></div>
+
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/thumbnail.png b/docs/thumbnail.png
new file mode 100644 (file)
index 0000000..fb5de03
Binary files /dev/null and b/docs/thumbnail.png differ
diff --git a/docs/tools/check.html b/docs/tools/check.html
new file mode 100644 (file)
index 0000000..5b482c2
--- /dev/null
@@ -0,0 +1,164 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../assets/css/style.css">
+    <script src="../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvnccheck">mvNCCheck</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Library</td>
+      <td>Command Line Tools</td>
+    </tr>
+    <tr>
+      <td>Output</td>
+      <td>None</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="compile.html">mvNCCompile</a>, <a href="profile.html">mvNCProfile</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>mvNCCheck is a command line tool that checks the validity of a Caffe or TensorFlow™ neural network on a neural compute device.</p>
+
+<p>The check is done by running an inference on both the device and in software on the host computer using the supplied network and appropriate framework libraries.  The results for both inferences are compared to determine a if the network passes or fails. The top 5 inference results are provided as output. This tool works best with image classification networks.</p>
+
+<h2 id="syntax">Syntax</h2>
+
+<h3 id="caffe">Caffe</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCheck network.prototxt <span class="o">[</span><span class="nt">-w</span> network.caffemodel] <span class="o">[</span><span class="nt">-s</span> max_number_of_shaves] <span class="o">[</span><span class="nt">-in</span> input_node_name] <span class="o">[</span><span class="nt">-on</span> output_node_name] <span class="o">[</span><span class="nt">-is</span> input_width input_height] <span class="o">[</span><span class="nt">-i</span> input_filename] <span class="o">[</span><span class="nt">-id</span> top1_validation_ID] <span class="o">[</span><span class="nt">-S</span> scale_factor] <span class="o">[</span><span class="nt">-M</span> mean_subtraction_number/npy_filename] <span class="o">[</span><span class="nt">-cs</span> color_sequence] <span class="o">[</span><span class="nt">-es</span><span class="o">]</span>
+</code></pre></div></div>
+
+<h3 id="tensorflow">TensorFlow™</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCheck network.meta <span class="o">[</span><span class="nt">-s</span> max_number_of_shaves] <span class="o">[</span><span class="nt">-in</span> input_node_name] <span class="o">[</span><span class="nt">-on</span> output_node_name] <span class="o">[</span><span class="nt">-is</span> input_width input_height] <span class="o">[</span><span class="nt">-i</span> input_filename] <span class="o">[</span><span class="nt">-id</span> top1_validation_ID] <span class="o">[</span><span class="nt">-S</span> scale_factor] <span class="o">[</span><span class="nt">-M</span> mean_subtraction_number/npy_filename] <span class="o">[</span><span class="nt">-cs</span> color_sequence] <span class="o">[</span><span class="nt">-es</span><span class="o">]</span>
+</code></pre></div></div>
+
+<table>
+  <thead>
+    <tr>
+      <th>Argument</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><em>Caffe</em>:<br />network.prototxt<br /><br /><em>TensorFlow™</em>:<br />network.meta<br />network.pb</td>
+      <td>Name of the network file (required).</td>
+    </tr>
+    <tr>
+      <td>[-h –help]</td>
+      <td>Display help for the command.</td>
+    </tr>
+    <tr>
+      <td>[-w weights_file]</td>
+      <td>Specify the weights filename from training. For Caffe this is the .caffemodel file. If omitted, zero weights will be used.<br /><br /><em>This option is not to be used for TensorFlow™ networks.</em></td>
+    </tr>
+    <tr>
+      <td>[-s max_number_of_shaves]</td>
+      <td>Specify the maximum number of SHAVEs to use for network layers (<em>default: 1</em>).<br /><br />The number of available SHAVEs depends on your neural compute device. The device runtime code may use fewer SHAVEs for some layers where measurements have typically shown no inference performance degradation (and consequently show a power benefit) from using fewer SHAVEs.</td>
+    </tr>
+    <tr>
+      <td>[-in input_node_name]</td>
+      <td>Specify an alternative start point for the network. By default the network’s start point is the input layer. This option enables partial network processing. When used together with the -on option, the user can isolate one or more layers in a network for analysis.<br /><br />This option is required for TensorFlow™ networks. You can use the name parameter (available for most layers) when creating your network and pass that name into this option.<br />To add a named node that doesn’t change the network you can use the following:<br /><code class="highlighter-rouge">x = tensorflow.identity(prev_tensor, name='new_node')</code></td>
+    </tr>
+    <tr>
+      <td>[-on output_node_name]</td>
+      <td>Specify an alternative end point for the network. By default the network’s end point is the output layer. This option enables partial network processing. When used together with the -in option, the user can isolate one or more layers in a network for analysis.<br /><br />Be aware that the parser will stop at the first instance of this node name (e.g., a Relu following a Conv will not be processed if it shares the same name).<br /><br />This option is required for TensorFlow™ networks. You can use the name parameter (available for most layers) when creating your network and pass that name into this option.<br />To add a named node that doesn’t change the network you can use the following:<br /><code class="highlighter-rouge">x = tensorflow.identity(prev_tensor, name='new_node')</code></td>
+    </tr>
+    <tr>
+      <td>[-is input_width input_height]</td>
+      <td>Specify input dimensions for networks that do not have dimension constraints on the input layer.<br /><br />This option assumes that the batch size is 1 and the number of channels is 3.</td>
+    </tr>
+    <tr>
+      <td>[-i input_filename]</td>
+      <td>Specify an input tensor to use for validation. If this is not set, a tensor with randomly generated data will be used.</td>
+    </tr>
+    <tr>
+      <td>[-S scale_factor]</td>
+      <td>Use a divisor to scale each value of the input.<br /><br />Typically images are stored with data for each input channel in range 0 to 255.  If the neural network expects input values in range 0.0 to 1.0, using <code class="highlighter-rouge">-S 255</code> will scale the data to the network’s expected range because each value will be divided by 255. If the network expects values in range -1.0 to 1.0, using <code class="highlighter-rouge">-S 128</code> and <code class="highlighter-rouge">-M 128</code> will scale the data to the network’s expected range.</td>
+    </tr>
+    <tr>
+      <td>[-M mean_subtraction_number]<br />[-M npy_filename]</td>
+      <td>Subtract mean values from the input data prior to passing to the neural network. This can be one value or a numpy mean file filename.</td>
+    </tr>
+    <tr>
+      <td>[-id top1_validation_ID]</td>
+      <td>Provide the expected id for Top-1 validation.</td>
+    </tr>
+    <tr>
+      <td>[-cs color_sequence]</td>
+      <td>Specify the color sequence that the neural network expects:<br />2,1,0 = BGR <em>(default)</em><br />0,1,2 = RGB</td>
+    </tr>
+    <tr>
+      <td>[-ec]</td>
+      <td>Skip certain compiler optimizations for concatenation; this may correct some issues with invalid results from concat layers or compile failures.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="examples">Examples</h2>
+
+<h3 id="caffe-1">Caffe</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCheck deploy.prototxt <span class="nt">-w</span> bvlc_googlenet.caffemodel <span class="nt">-s</span> 12 <span class="nt">-in</span> input <span class="nt">-on</span> prob <span class="nt">-is</span> 224 224 <span class="nt">-cs</span> 2,1,0
+</code></pre></div></div>
+
+<h3 id="tensorflow-1">TensorFlow™</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCheck inception_v1.meta <span class="nt">-s</span> 12 <span class="nt">-in</span><span class="o">=</span>input <span class="nt">-on</span><span class="o">=</span>InceptionV1/Logits/Predictions/Reshape_1 <span class="nt">-is</span> 224 224 <span class="nt">-cs</span> 0,1,2
+</code></pre></div></div>
+
+<h2 id="further-reading">Further Reading</h2>
+
+<ul>
+  <li><a href="https://movidius.github.io/blog/mvNCCheck/">Using and Understanding the Neural Compute SDK: mvNCCheck</a></li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/tools/check.md b/docs/tools/check.md
deleted file mode 100644 (file)
index ec39978..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# mvNCCheck
-
-Type|Function
------------- | -------------
-Library|Command Line Tools
-Output|
-Revision|1.08
-See also| [mvNCCompile](compile.md), [mvNCProfile](profile.md), [TensorFlow™ Info](../TensorFlowUsage.md)
-
-## Overview
-This command line tool validates (checks) a Caffe or TensorFlow™ nerual network on the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS.)  The check is done by running an inference on the NCS and also on the host computer in software using the supplied network and appropriate framework libraries.  The results for both inferences (NCS results vs. framework's expected results) are compared to determine a if the network passes or fails and the top 5 inference results are provided as output. 
-
-
-## Syntax
-
-### Caffe
-```bash
-mvNCCheck network.prototxt [-w weights_file] [-s Max Number of Shaves] [-in Input Node Name] [-on Output Node Name] [-is Input-Width Input-Height] [-o Output Graph Filename] [-i image filename] [-id Top-1 Validation ID] [-S scale factor] [-M Mean Subtraction Number or npy filename] [-cs Color Sequence]
-```
-
-### TensorFlow™
-```bash
-mvNCCheck network.meta [-s Max Number of Shaves] [-in Input Node Name] [-on Output Node Name] [-is Input-Width Input-Height] [-o Output Graph Filename] [-i image filename] [-id Top-1 Validation ID] [-S scale factor] [-M Mean Subtraction Number or npy filename] [-cs Color Sequence]
-```
-
-Argument|Description
------------- | -------------
-network.prototxt(caffe)<br>network.meta(TensorFlow™)|Name of the network file. 
-[-h --help] | Display help for the command
-[-w weights_file]|Weights filename from training. For Caffe this is the .caffemodel file name.  For TensorFlow™ it must be the network name prefix. If omitted zero weights will be used for Caffe models. 
-[-s Max # of Shaves]|Default: 1<br><br>Selects the maximum number of SHAVEs (1,2,4,8, or 12) to use for network layers.<br><br>Note: The NCS runtime code may use less than the MAX SHAVE value for some layers where measurements have typically shown no inference performance degradation (and consequently a power benefit) of using fewer SHAVEs.
-[-in Input Node Name]|By default the network is processed from the input tensor. This option allows a user to select an alternative start point in the network.<br><br>This enables partial network processing. When used together with the -on option, a user can isolate one or more layers in a network for analysis.
-[-on Output Node Name]|By default the network is processed through to the output tensor. This option allows a user to select an alternative end point in the network.<br><br>This enables partial network processing. When used together with the -in option, a user can isolate one or more layers in a network for analysis.
-[-is Input-Width Input-Height]|Input size is typically described as a part of the network. For networks that do not have dimension constraints on the input tensor, this option can be used to set the desired input dimensions.<br><br>Only two dimensions are defined because the batch size is always 1 and the number of color planes is assumed to be 3.
-[-o Output Graph Filename]|Default: "graph"<br><br>Output graph container filename. If not provided, “graph” will be used.
-[-i image filename]|Image to use as input to validation run.<br>If not set, a randomly generated image will be used.
-[-id Top-1 Validation ID]|Expected id for Top-1 validation.
-[-S scale factor]|Scale each value of the input by this amount.<br>E.g., if the network expects input values in the range 0-255, put 255 here (1 is default, as the range 0-1 is the default).
-[-M Mean Subtraction Number or npy filename]|Subtract this from the input (applied after scale). E.g., if the network expects a mean file to be subtracted from the input image, put it here.
-[-cs Color Sequence]|Color Sequence of Input channels:<br>  2,1,0: BGR (Default) <br>  0,1,2 : RGB
-
-## Known Issues
-
-## Example
-### Caffe
-```bash
-
-mvNCCheck deploy.prototxt -w bvlc_googlenet.caffemodel -s 12 -in input -on prob -is 224 224 -o GoogLeNet.graph -cs 2,1,0
-
-```
-### TensorFlow™
-```bash
-mvNCCheck inception_v1.meta -s 12 -in=input -on=InceptionV1/Logits/Predictions/Reshape_1 -is 224 224 -o InceptionV1.graph -cs 0,1,2
-
-```
diff --git a/docs/tools/compile.html b/docs/tools/compile.html
new file mode 100644 (file)
index 0000000..08c9163
--- /dev/null
@@ -0,0 +1,143 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../assets/css/style.css">
+    <script src="../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvnccompile">mvNCCompile</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Library</td>
+      <td>Command Line Tools</td>
+    </tr>
+    <tr>
+      <td>Output</td>
+      <td>Compiled graph file</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="profile.html">mvNCProfile</a>, <a href="check.html">mvNCCheck</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>mvNCCompile is a command line tool that compiles network and weights files for Caffe or TensorFlow™ models into an Intel® Movidius™ graph file format that is compatible with the Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) and Neural Compute API (NCAPI).</p>
+
+<h2 id="syntax">Syntax</h2>
+
+<h3 id="caffe">Caffe</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCompile network.prototxt <span class="o">[</span><span class="nt">-w</span> network.caffemodel] <span class="o">[</span><span class="nt">-s</span> max_number_of_shaves] <span class="o">[</span><span class="nt">-in</span> input_node_name] <span class="o">[</span><span class="nt">-on</span> output_node_name] <span class="o">[</span><span class="nt">-is</span> input_width input_height] <span class="o">[</span><span class="nt">-o</span> output_graph_filename] <span class="o">[</span><span class="nt">-ec</span><span class="o">]</span>
+</code></pre></div></div>
+
+<h3 id="tensorflow">TensorFlow™</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCompile network.meta <span class="o">[</span><span class="nt">-s</span> max_number_of_shaves] <span class="o">[</span><span class="nt">-in</span> input_node_name] <span class="o">[</span><span class="nt">-on</span> output_node_name] <span class="o">[</span><span class="nt">-is</span> input_width input_height] <span class="o">[</span><span class="nt">-o</span> output_graph_filename] <span class="o">[</span><span class="nt">-ec</span><span class="o">]</span>
+</code></pre></div></div>
+
+<table>
+  <thead>
+    <tr>
+      <th>Argument</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><em>Caffe</em>:<br />network.prototxt<br /><br /><em>TensorFlow™</em>:<br />network.meta<br />network.pb</td>
+      <td>Name of the network file (required).</td>
+    </tr>
+    <tr>
+      <td>[-h, –help]</td>
+      <td>Display help for the command.</td>
+    </tr>
+    <tr>
+      <td>[-w weights_file]</td>
+      <td>Specify the weights filename from training. For Caffe this is the .caffemodel file. If omitted, zero weights will be used.<br /><br /><em>This option is not to be used for TensorFlow™ networks.</em></td>
+    </tr>
+    <tr>
+      <td>[-s max_number_of_shaves]</td>
+      <td>Specify the maximum number of SHAVEs to use for network layers (<em>default: 1</em>).<br /><br />The number of available SHAVEs depends on your neural compute device. The device runtime code may use fewer SHAVEs for some layers where measurements have typically shown no inference performance degradation (and consequently show a power benefit) from using fewer SHAVEs.</td>
+    </tr>
+    <tr>
+      <td>[-in input_node_name]</td>
+      <td>Specify an alternative start point for the network. By default the network’s start point is the input layer. This option enables partial network processing. When used together with the -on option, the user can isolate one or more layers in a network for analysis.<br /><br />This option is required for TensorFlow™ networks. You can use the name parameter (available for most layers) when creating your network and pass that name into this option.<br />To add a named node that doesn’t change the network you can use the following:<br /><code class="highlighter-rouge">x = tensorflow.identity(prev_tensor, name='new_node')</code></td>
+    </tr>
+    <tr>
+      <td>[-on output_node_name]</td>
+      <td>Specify an alternative end point for the network. By default the network’s end point is the output layer. This option enables partial network processing. When used together with the -in option, the user can isolate one or more layers in a network for analysis.<br /><br />Be aware that the parser will stop at the first instance of this node name (e.g., a Relu following a Conv will not be processed if it shares the same name).<br /><br />This option is required for TensorFlow™ networks. You can use the name parameter (available for most layers) when creating your network and pass that name into this option.<br />To add a named node that doesn’t change the network you can use the following:<br /><code class="highlighter-rouge">x = tensorflow.identity(prev_tensor, name='new_node')</code></td>
+    </tr>
+    <tr>
+      <td>[-is input_width input_height]</td>
+      <td>Specify input dimensions for networks that do not have dimension constraints on the input layer.<br /><br />This option assumes that the batch size is 1 and the number of channels is 3.</td>
+    </tr>
+    <tr>
+      <td>[-o output_graph_filename]</td>
+      <td>Specify an output graph filename. If this is not provided, “graph” will be used for the filename.</td>
+    </tr>
+    <tr>
+      <td>[-ec]</td>
+      <td>Skip certain compiler optimizations for concatenation; this may correct some issues with invalid results from concat layers or compile failures.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="example">Example</h2>
+<h3 id="caffe-1">Caffe</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCompile deploy.prototxt <span class="nt">-w</span> bvlc_googlenet.caffemodel <span class="nt">-s</span> 12 <span class="nt">-in</span> input <span class="nt">-on</span> prob <span class="nt">-is</span> 224 224 <span class="nt">-o</span> GoogLeNet.graph
+</code></pre></div></div>
+<h3 id="tensorflow-1">TensorFlow™</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCCompile inception-v1.meta <span class="nt">-s</span> 12 <span class="nt">-in</span><span class="o">=</span>input <span class="nt">-on</span><span class="o">=</span>InceptionV1/Logits/Predictions/Reshape_1 <span class="nt">-is</span> 224 224 <span class="nt">-o</span> InceptionV1.graph
+</code></pre></div></div>
+
+<h2 id="notes">Notes</h2>
+<ul>
+  <li>A list of mvNCCompile error codes can be seen <a href="../compiler_error.html">here</a>.</li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/tools/compile.md b/docs/tools/compile.md
deleted file mode 100644 (file)
index d1d89ea..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-# mvNCCompile
-
-Type|Function
------------- | -------------
-Library|Command Line Tools
-Output| Compiled 'graph' file 
-Revision|1.08
-See also| [mvNCProfile](profile.md), [mvNCCheck](check.md), [TensorFlow™ Info](../TensorFlow.md)
-
-## Overview
-This command line tool compiles and converts the network file and weights file described in Caffe or TensorFlow™ into Intel® Movidius™ internal Graphfile format. The graph file is loaded into the Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS)
-during runtime using the NCSDK API. The graph file then can be executed by sending an image to the Intel Movidius NCS for inferencing.
-
-## Syntax
-
-### Caffe
-```bash
-mvNCCompile network.prototxt [-w network.caffemodel] [-s Max Number of Shaves] [-in Input Node Name] [-on Output Node Name] [-is Input-Width Input-Height] [-o Output Graph Filename]
-```
-### TensorFlow™
-```bash
-mvNCCompile network.meta [-w network] [-s Max Number of Shaves] [-in Input Node Name] [-on Output Node Name] [-is Input-Width Input-Height] [-o Output Graph Filename]
-```
-
-Argument|Description
------------- | -------------
-network.prototxt(Caffe)<br>network.meta(TensorFlow™)|Name of the network file. 
-[-w weights_file]|Weights filename from training. For Caffe this is typically the .caffemodel file.  For TensorFlow this is typically the network.data-xxx-of-yyy file, but you should only put the prefix of that file. ie. "network".  If omitted, zero weights will be used. 
-[-s Max # of Shaves]|Default: 1<br><br>Selects the maximum number of SHAVEs (1, 2, 4, 8, or 12) to use for network layers.<br><br>Note: The NCS runtime code may use less than the MAX SHAVE value for some layers where measurements have typically shown no inference performance degradation (and consequently a power benefit) of using fewer SHAVEs.
-[-in Input Node Name]|By default the network is processed from the input tensor. This option allows a user to select an alternative start point in the network.<br><br>This enables partial network processing. When used together with the -on option, a user can isolate one or more layers in a network for analysis.  Use the name parameter available for most tensorflow layers for the first node when creating your network and pass this name into this option.  For example if this is your first layer x = tf.placeholder(tf.float32, [1, 784], name='input') then you can use "-in input"
-[-on Output Node Name]|By default the network is processed through to the output tensor. This option allows a user to select an alternative end point in the network.<br><br>This enables partial network processing. When used together with the -in option, a user can isolate one or more layers in a network for analysis. Note: Beware that the parser stops at the first instance of the output node name (e.g., a Relu following a Conv will not be processed if it shares the same name).  Use the name parameter for most tensorflow layers to specify the name of the node.  To add an output node with a known name that doesn't change the network you can use the following.
-output = tensorflow.identity(prev_tensor, name='output')
-[-is Input-Width Input-Height]|Input size is typically described as a part of the network. For networks that do not have dimension constraints on the input tensor, this option can be used to set the desired input dimensions.<br><br>Only two dimensions are defined because the batch size is always 1 and the number of color planes is assumed to be 3.  if the number of color planes for the network is is not 3, this will need to be described as part of the network and the -is option can not be used.
-[-o Output Graph Filename]|Default: "graph"<br><br>Output graph container filename. If not provided, “graph” will be used.
-
-## Known Issues
-
-## Example
-### Caffe
-```bash
-
-mvNCCompile deploy.prototxt -w bvlc_googlenet.caffemodel -s 12 -in input -on prob -is 224 224 -o GoogLeNet.graph
-
-```
-### TensorFlow™
-```bash
-
-mvNCCompile inception-v1.meta -s 12 -in=input -on=InceptionV1/Logits/Predictions/Reshape_1 -is 224 224 -o InceptionV1.graph
-
-```
-
diff --git a/docs/tools/profile.html b/docs/tools/profile.html
new file mode 100644 (file)
index 0000000..dd26703
--- /dev/null
@@ -0,0 +1,223 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="../assets/css/style.css">
+    <script src="../assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=../index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=../TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=../index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=../ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="mvncprofile">mvNCProfile</h1>
+
+<table>
+  <thead>
+    <tr>
+      <th>Type</th>
+      <th>Function</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>Library</td>
+      <td>Command Line Tools</td>
+    </tr>
+    <tr>
+      <td>Output</td>
+      <td>Profile Data in HTML/graphic/Text Format</td>
+    </tr>
+    <tr>
+      <td>See also</td>
+      <td><a href="compile.html">mvNCCompile</a>, <a href="check.html">mvNCCheck</a></td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="overview">Overview</h2>
+<p>mvNCProfile is a command line tool that compiles a network for use with the Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK), runs the network on a connected neural compute device, and outputs text and HTML profile reports.</p>
+
+<p>The profiling data contains layer-by-layer statistics about the performance of the network. This is helpful in determining how much time is spent on each layer to narrow down potential changes to the network to improve the total inference time.</p>
+
+<h2 id="syntax">Syntax</h2>
+
+<h3 id="caffe">Caffe</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCProfile network.prototxt <span class="o">[</span><span class="nt">-w</span> network.caffemodel] <span class="o">[</span><span class="nt">-s</span> max_number_of_shaves] <span class="o">[</span><span class="nt">-in</span> input_node_name] <span class="o">[</span><span class="nt">-on</span> output_node_name] <span class="o">[</span><span class="nt">-is</span> input_width input_height] <span class="o">[</span><span class="nt">-ec</span><span class="o">]</span>
+</code></pre></div></div>
+<h3 id="tensorflow">TensorFlow™</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCProfile network.meta <span class="o">[</span><span class="nt">-s</span> max_number_of_shaves] <span class="o">[</span><span class="nt">-in</span> input_node_name] <span class="o">[</span><span class="nt">-on</span> output_node_name] <span class="o">[</span><span class="nt">-is</span> input_width input_height] <span class="o">[</span><span class="nt">-ec</span><span class="o">]</span>
+</code></pre></div></div>
+
+<table>
+  <thead>
+    <tr>
+      <th>Argument</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><em>Caffe</em>:<br />network.prototxt<br /><br /><em>TensorFlow™</em>:<br />network.meta<br />network.pb</td>
+      <td>Name of the network file (required).</td>
+    </tr>
+    <tr>
+      <td>[-w weights_file]</td>
+      <td>Specify the weights filename from training. For Caffe this is the .caffemodel file. If omitted, zero weights will be used.<br /><br /><em>This option is not to be used for TensorFlow™ networks.</em></td>
+    </tr>
+    <tr>
+      <td>[-s max_number_of_shaves]</td>
+      <td>Specify the maximum number of SHAVEs to use for network layers (<em>default: 1</em>).<br /><br />The number of available SHAVEs depends on your neural compute device. The device runtime code may use fewer SHAVEs for some layers where measurements have typically shown no inference performance degradation (and consequently show a power benefit) from using fewer SHAVEs.</td>
+    </tr>
+    <tr>
+      <td>[-in input_node_name]</td>
+      <td>Specify an alternative start point for the network. By default the network’s start point is the input layer. This option enables partial network processing. When used together with the -on option, the user can isolate one or more layers in a network for analysis.<br /><br />This option is required for TensorFlow™ networks. You can use the name parameter (available for most layers) when creating your network and pass that name into this option.<br />To add a named node that doesn’t change the network you can use the following:<br /><code class="highlighter-rouge">x = tensorflow.identity(prev_tensor, name='new_node')</code></td>
+    </tr>
+    <tr>
+      <td>[-on output_node_name]</td>
+      <td>Specify an alternative end point for the network. By default the network’s end point is the output layer. This option enables partial network processing. When used together with the -in option, the user can isolate one or more layers in a network for analysis.<br /><br />Be aware that the parser will stop at the first instance of this node name (e.g., a Relu following a Conv will not be processed if it shares the same name).<br /><br />This option is required for TensorFlow™ networks. You can use the name parameter (available for most layers) when creating your network and pass that name into this option.<br />To add a named node that doesn’t change the network you can use the following:<br /><code class="highlighter-rouge">x = tensorflow.identity(prev_tensor, name='new_node')</code></td>
+    </tr>
+    <tr>
+      <td>[-is input_width input_height]</td>
+      <td>Specify input dimensions for networks that do not have dimension constraints on the input layer.<br /><br />This option assumes that the batch size is 1 and the number of channels is 3.</td>
+    </tr>
+    <tr>
+      <td>[-ec]</td>
+      <td>Skip certain compiler optimizations for concatenation; this may correct some issues with invalid results from concat layers or compile failures.</td>
+    </tr>
+  </tbody>
+</table>
+
+<h2 id="examples">Examples</h2>
+<h3 id="caffe-1">Caffe</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCProfile deploy.prototxt <span class="nt">-w</span> bvlc_googlenet.caffemodel <span class="nt">-s</span> 12 <span class="nt">-in</span> input <span class="nt">-on</span> prob <span class="nt">-is</span> 224 224
+</code></pre></div></div>
+<h3 id="tensorflow-1">TensorFlow™</h3>
+<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mvNCProfile inception_v1.meta <span class="nt">-s</span> 12 <span class="nt">-in</span> input <span class="nt">-on</span> InceptionV1/Logits/Predictions/Reshape_1 <span class="nt">-is</span> 224 224
+</code></pre></div></div>
+
+<h1 id="example-profile-output-for-googlenet">Example Profile Output for GoogLeNet</h1>
+
+<h2 id="text-format">Text Format</h2>
+<p>Console output from the mvNCProfile tool is shown below.</p>
+<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Detailed Per Layer Profile
+Layer      Name                                 MFLOPs    Bandwidth MB/s        time(ms)
+========================================================================================
+0          conv1/7x7_s2                        236.028           2505.00            5.63
+1          pool1/3x3_s2                          1.806           1441.66            1.06
+2          pool1/norm1                           0.000            712.67            0.54
+3          conv2/3x3_reduce                     25.690            404.11            0.97
+4          conv2/3x3                           693.633            316.67           11.55
+5          conv2/norm2                           0.000            797.05            1.44
+6          pool2/3x3_s2                          1.355           1495.52            0.77
+7          inception_3a/1x1                     19.268            462.47            0.67
+8          inception_3a/3x3_reduce              28.901            399.64            0.81
+9          inception_3a/3x3                    173.408            333.13            4.52
+10         inception_3a/5x5_reduce               4.817            793.78            0.37
+11         inception_3a/5x5                     20.070            849.91            0.73
+12         inception_3a/pool                     1.355            686.68            0.42
+13         inception_3a/pool_proj                9.634            558.60            0.54
+14         inception_3b/1x1                     51.380            470.46            0.95
+15         inception_3b/3x3_reduce              51.380            472.93            0.94
+16         inception_3b/3x3                    346.817            268.78            7.99
+17         inception_3b/5x5_reduce              12.845           1098.70            0.36
+18         inception_3b/5x5                    120.422            580.92            2.32
+19         inception_3b/pool                     1.806            695.31            0.55
+20         inception_3b/pool_proj               25.690            683.06            0.61
+21         pool3/3x3_s2                          0.847           1305.34            0.55
+22         inception_4a/1x1                     36.127            374.89            0.95
+23         inception_4a/3x3_reduce              18.063            574.14            0.47
+24         inception_4a/3x3                     70.447            320.50            2.09
+25         inception_4a/5x5_reduce               3.011           1034.04            0.19
+26         inception_4a/5x5                      7.526            616.84            0.31
+27         inception_4a/pool                     0.847            630.87            0.28
+28         inception_4a/pool_proj               12.042            661.36            0.36
+29         inception_4b/1x1                     32.113            294.21            1.18
+30         inception_4b/3x3_reduce              22.479            377.09            0.80
+31         inception_4b/3x3                     88.510            313.94            2.58
+32         inception_4b/5x5_reduce               4.817            838.52            0.26
+33         inception_4b/5x5                     15.053            384.82            0.78
+34         inception_4b/pool                     0.903            612.12            0.31
+35         inception_4b/pool_proj               12.845            552.44            0.46
+36         inception_4c/1x1                     25.690            486.52            0.65
+37         inception_4c/3x3_reduce              25.690            488.53            0.65
+38         inception_4c/3x3                    115.606            308.59            3.23
+39         inception_4c/5x5_reduce               4.817            835.81            0.26
+40         inception_4c/5x5                     15.053            387.14            0.78
+41         inception_4c/pool                     0.903            614.42            0.31
+42         inception_4c/pool_proj               12.845            550.52            0.46
+43         inception_4d/1x1                     22.479            393.44            0.77
+44         inception_4d/3x3_reduce              28.901            388.96            0.85
+45         inception_4d/3x3                    146.313            428.44            2.80
+46         inception_4d/5x5_reduce               6.423            725.47            0.31
+47         inception_4d/5x5                     20.070            474.31            0.84
+48         inception_4d/pool                     0.903            657.23            0.29
+49         inception_4d/pool_proj               12.845            583.48            0.44
+50         inception_4e/1x1                     52.986            309.60            1.47
+51         inception_4e/3x3_reduce              33.116            279.09            1.28
+52         inception_4e/3x3                    180.634            307.91            4.62
+53         inception_4e/5x5_reduce               6.623            594.87            0.39
+54         inception_4e/5x5                     40.141            416.06            1.20
+55         inception_4e/pool                     0.931            636.86            0.31
+56         inception_4e/pool_proj               26.493            477.56            0.68
+57         pool4/3x3_s2                          0.367           1303.53            0.24
+58         inception_5a/1x1                     20.873            631.79            0.77
+59         inception_5a/3x3_reduce              13.046            657.84            0.50
+60         inception_5a/3x3                     45.158            615.42            1.66
+61         inception_5a/5x5_reduce               2.609            468.53            0.27
+62         inception_5a/5x5                     10.035            554.62            0.50
+63         inception_5a/pool                     0.367            540.50            0.14
+64         inception_5a/pool_proj               10.437            593.71            0.47
+65         inception_5b/1x1                     31.310            667.18            1.03
+66         inception_5b/3x3_reduce              15.655            688.70            0.56
+67         inception_5b/3x3                     65.028            799.92            1.79
+68         inception_5b/5x5_reduce               3.914            459.85            0.33
+69         inception_5b/5x5                     15.053            563.79            0.73
+70         inception_5b/pool                     0.367            533.47            0.15
+71         inception_5b/pool_proj               10.437            592.62            0.47
+72         pool5/7x7_s1                          0.100            481.97            0.20
+73         loss3/classifier                      0.002           2519.16            0.78
+74         prob                                  0.003             10.62            0.18
+----------------------------------------------------------------------------------------
+           Total inference time                                                    88.66
+----------------------------------------------------------------------------------------
+</code></pre></div></div>
+
+<h2 id="graphical-format">Graphical Format</h2>
+<p>The graphical representation of the profile information (saved as output_report.html and output.gv.svg files) is shown below.
+<img src="../images/GoogLeNet_gv.png" alt="" /></p>
+
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/tools/profile.md b/docs/tools/profile.md
deleted file mode 100644 (file)
index c0c67cc..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-# mvNCProfile
-
-Type|Function
------------- | -------------
-Library|Command Line Tools
-Output|Profile Data in HTML/graphic/Text Format
-Revision|1.08
-See also| [mvNCCompile](compile.md), [mvNCCheck](check.md), [TensorFlow™ info](../TensorFlow.md)
-
-## Overview
-This command line tool compiles the provided network, runs the network on the connected Intel® Movidius™ Neural Compute Stick (Intel® Movidius™ NCS) and creates a text/HTML profiling output. The profiling data contains layer-by-layer stats about the performance of the input network. This is very helpful in determining how much time is spent on each layer, and is helpful in determining changes to the network to improve the total inference time for a network on the Intel Movidius NCS.
-
-The weights file is not required when profiling a network to determine bottlenecks.
-
-## Syntax
-
-### Caffe
-```bash
-mvNCProfile network.prototxt [-w weights_file] [-s Max Number of Shaves] [-in Input Node Name] [-on Output Node Name] [-is Input-Width Input-Height] [-o Output Graph Filename]
-```
-### TensorFlow™
-```bash
-mvNCProfile network.meta [-s Max Number of Shaves] [-in Input Node Name] [-on Output Node Name] [-is Input-Width Input-Height] [-o Output Graph Filename]
-```
-
-Argument|Description
------------- | -------------
-network.prototxt(caffe)<br>network.meta(TensorFlow™)|Name of the network file. 
-[-w weights_file]|Weights filename from training. (Only applies to Caffe, not to be used with TensorFlow™.) If omitted, zero weights will be used. 
-[-s Max # of Shaves]|Default: 1<br><br>Selects the maximum number of SHAVEs (1,2,4,8, or 12.) to use for network layers.<br><br>Note: The NCS runtime code may use less than the MAX SHAVE value for some layers where measurements have typically shown no inference performance degradation (and consequently a power benefit) of using fewer SHAVEs.
-[-in Input Node Name]|By default the network is processed from the input tensor. This option allows a user to select an alternative start point in the network.<br><br>This enables partial network processing. When used together with the -on option a user can isolate one or more layers in a network for analysis.
-[-on Output Node Name]|By default the network is processed through to the output tensor. This option allows a user to select an alternative end point in the network.<br><br>This enables partial network processing. When used together with the -in option, a user can isolate one or more layers in a network for analysis.
-[-is Input-Width Input-Height]|Input size is typically described as a part of the network. For networks that do not have dimension constraints on the input tensor, this option can be used to set the desired input dimensions.<br><br>Only two dimensions are defined because the batch size is always 1 and the number of color planes is assumed to be 3.
-[-o Output Graph Filename]|Default: "graph"<br><br>Output graph container filename. If not provided, “graph” will be used.
-
-
-## Known Issues
-- The -o option is yet to be implemented.
-- the -w option can be omitted if the network's .caffemodel file has the same base filename as the .prototxt file it will be used.
-
-## Example
-### Caffe
-```bash
-
-mvNCProfile deploy.prototxt -w bvlc_googlenet.caffemodel -s 12 -in input -on prob -is 224 224 -o GoogLeNet.graph
-
-```
-### TensorFlow™
-```bash
-
-mvNCProfile inception_v1.meta -s 12 -in=input -on=InceptionV1/Logits/Predictions/Reshape_1 -is 224 224 -o InceptionV1.graph
-
-```
-
-# Profile Output for GoogLeNet
-
-## Text Format
-The console output from mvNCProfile is shown below.
-```
-Detailed Per Layer Profile
-Layer      Name                                 MFLOPs    Bandwidth MB/s        time(ms)
-========================================================================================
-0          conv1/7x7_s2                        236.028           2505.00            5.63
-1          pool1/3x3_s2                          1.806           1441.66            1.06
-2          pool1/norm1                           0.000            712.67            0.54
-3          conv2/3x3_reduce                     25.690            404.11            0.97
-4          conv2/3x3                           693.633            316.67           11.55
-5          conv2/norm2                           0.000            797.05            1.44
-6          pool2/3x3_s2                          1.355           1495.52            0.77
-7          inception_3a/1x1                     19.268            462.47            0.67
-8          inception_3a/3x3_reduce              28.901            399.64            0.81
-9          inception_3a/3x3                    173.408            333.13            4.52
-10         inception_3a/5x5_reduce               4.817            793.78            0.37
-11         inception_3a/5x5                     20.070            849.91            0.73
-12         inception_3a/pool                     1.355            686.68            0.42
-13         inception_3a/pool_proj                9.634            558.60            0.54
-14         inception_3b/1x1                     51.380            470.46            0.95
-15         inception_3b/3x3_reduce              51.380            472.93            0.94
-16         inception_3b/3x3                    346.817            268.78            7.99
-17         inception_3b/5x5_reduce              12.845           1098.70            0.36
-18         inception_3b/5x5                    120.422            580.92            2.32
-19         inception_3b/pool                     1.806            695.31            0.55
-20         inception_3b/pool_proj               25.690            683.06            0.61
-21         pool3/3x3_s2                          0.847           1305.34            0.55
-22         inception_4a/1x1                     36.127            374.89            0.95
-23         inception_4a/3x3_reduce              18.063            574.14            0.47
-24         inception_4a/3x3                     70.447            320.50            2.09
-25         inception_4a/5x5_reduce               3.011           1034.04            0.19
-26         inception_4a/5x5                      7.526            616.84            0.31
-27         inception_4a/pool                     0.847            630.87            0.28
-28         inception_4a/pool_proj               12.042            661.36            0.36
-29         inception_4b/1x1                     32.113            294.21            1.18
-30         inception_4b/3x3_reduce              22.479            377.09            0.80
-31         inception_4b/3x3                     88.510            313.94            2.58
-32         inception_4b/5x5_reduce               4.817            838.52            0.26
-33         inception_4b/5x5                     15.053            384.82            0.78
-34         inception_4b/pool                     0.903            612.12            0.31
-35         inception_4b/pool_proj               12.845            552.44            0.46
-36         inception_4c/1x1                     25.690            486.52            0.65
-37         inception_4c/3x3_reduce              25.690            488.53            0.65
-38         inception_4c/3x3                    115.606            308.59            3.23
-39         inception_4c/5x5_reduce               4.817            835.81            0.26
-40         inception_4c/5x5                     15.053            387.14            0.78
-41         inception_4c/pool                     0.903            614.42            0.31
-42         inception_4c/pool_proj               12.845            550.52            0.46
-43         inception_4d/1x1                     22.479            393.44            0.77
-44         inception_4d/3x3_reduce              28.901            388.96            0.85
-45         inception_4d/3x3                    146.313            428.44            2.80
-46         inception_4d/5x5_reduce               6.423            725.47            0.31
-47         inception_4d/5x5                     20.070            474.31            0.84
-48         inception_4d/pool                     0.903            657.23            0.29
-49         inception_4d/pool_proj               12.845            583.48            0.44
-50         inception_4e/1x1                     52.986            309.60            1.47
-51         inception_4e/3x3_reduce              33.116            279.09            1.28
-52         inception_4e/3x3                    180.634            307.91            4.62
-53         inception_4e/5x5_reduce               6.623            594.87            0.39
-54         inception_4e/5x5                     40.141            416.06            1.20
-55         inception_4e/pool                     0.931            636.86            0.31
-56         inception_4e/pool_proj               26.493            477.56            0.68
-57         pool4/3x3_s2                          0.367           1303.53            0.24
-58         inception_5a/1x1                     20.873            631.79            0.77
-59         inception_5a/3x3_reduce              13.046            657.84            0.50
-60         inception_5a/3x3                     45.158            615.42            1.66
-61         inception_5a/5x5_reduce               2.609            468.53            0.27
-62         inception_5a/5x5                     10.035            554.62            0.50
-63         inception_5a/pool                     0.367            540.50            0.14
-64         inception_5a/pool_proj               10.437            593.71            0.47
-65         inception_5b/1x1                     31.310            667.18            1.03
-66         inception_5b/3x3_reduce              15.655            688.70            0.56
-67         inception_5b/3x3                     65.028            799.92            1.79
-68         inception_5b/5x5_reduce               3.914            459.85            0.33
-69         inception_5b/5x5                     15.053            563.79            0.73
-70         inception_5b/pool                     0.367            533.47            0.15
-71         inception_5b/pool_proj               10.437            592.62            0.47
-72         pool5/7x7_s1                          0.100            481.97            0.20
-73         loss3/classifier                      0.002           2519.16            0.78
-74         prob                                  0.003             10.62            0.18
-----------------------------------------------------------------------------------------
-           Total inference time                                                    88.66
-----------------------------------------------------------------------------------------
-```
-
-## Graphical Format
-The mvNCProfile also creates the output_report.html and output.gv.svg files, which contain a graphcial representation of the profile information as shown below.
-![](../images/GoogLeNet_gv.png)
-
-
diff --git a/docs/virtualenv.html b/docs/virtualenv.html
new file mode 100644 (file)
index 0000000..91bde91
--- /dev/null
@@ -0,0 +1,98 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="using-the-intel-movidius-neural-compute-sdk-with-virtualenv">Using the Intel® Movidius™ Neural Compute SDK with virtualenv</h1>
+
+<p><strong>NOTE: This feature is only available with Intel® Movidius™ Neural Compute SDK 2.x.</strong></p>
+
+<p><a href="https://virtualenv.pypa.io/en/stable/">virtualenv</a> is a tool to create isolated Python environments that help avoid issues caused by conflicting package dependencies for different applications.</p>
+
+<p>To use virtualenv with the Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK), you must enable virtualenv in the NCSDK configuration <strong>before</strong> installing the NCSDK.</p>
+
+<h2 id="enabling-virtualenv">Enabling virtualenv</h2>
+
+<p>Before running the <strong>ncsdk/install.sh</strong> script, open <strong>ncsdk/ncsdk.conf</strong> for editing and set <code class="highlighter-rouge">USE_VIRTUALENV=yes</code> (by default it will say <code class="highlighter-rouge">USE_VIRTUALENV=no</code>).</p>
+
+<p>Save the change and then proceed with NCSDK <a href="install.html">installation</a>.</p>
+
+<h2 id="usage">Usage</h2>
+
+<p>You must activate the virtualenv any time that you want to use the NCSDK.</p>
+
+<ul>
+  <li>
+    <h3 id="activation">Activation</h3>
+
+    <p>To activate the virtualenv for use, enter the following command:</p>
+
+    <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">source</span> /opt/movidius/virtualenv-python/bin/activate
+</code></pre></div>    </div>
+
+    <p>If the virtualenv was successfully activated, you will see <code class="highlighter-rouge">(virtualenv-python)</code> amended to your command prompt.</p>
+  </li>
+  <li>
+    <h3 id="deactivation">Deactivation</h3>
+
+    <p>To leave the virtualenv, enter the following command:</p>
+
+    <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>deactivate
+</code></pre></div>    </div>
+  </li>
+  <li>
+    <h3 id="python-package-location">Python Package Location</h3>
+
+    <p>When using the virtualenv, Python packages will be installed to <strong>/opt/movidius/virtualenv-python/lib/python3.5/site-packages</strong>.</p>
+  </li>
+</ul>
+
+<h2 id="troubleshooting">Troubleshooting</h2>
+<ul>
+  <li>
+    <p><code class="highlighter-rouge">ImportError</code> when running an NCSDK example or tool:</p>
+
+    <p>Make sure that you have activated the virtualenv as shown above.</p>
+  </li>
+</ul>
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
diff --git a/docs/vm_config.html b/docs/vm_config.html
new file mode 100644 (file)
index 0000000..8d8a538
--- /dev/null
@@ -0,0 +1,149 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1">
+
+    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
+    <link rel="stylesheet" href="assets/css/style.css">
+    <script src="assets/js/scale.fix.js"></script>
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+    <!--[if lt IE 9]>
+    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+  </head>
+  <body>
+    <div class="wrapper">
+      <header  class="without-description" >
+        <h1 style="color:#FFFFFF;text-shadow:none"><a href=index.html>Intel® Movidius™ Neural Compute SDK</a></h1>
+        
+        <p class="view"><a href="">View the Project on GitHub <small></small></a></p>
+        <ul>
+        
+          <li>  <a href=TOC.html><small>Table of Contents</small></a> </li>
+          <li>  <a href=index.html#NcSdkTools><small>NCSDK<br>Tools</small></a> </li>
+          <li> <a href=ncapi/readme.html><small>NCAPI Documentation</small></a></li>
+          <li>  <a href="">View On <strong>GitHub</strong></a></li>
+          <li> <a href="https://ncsforum.movidius.com/">User Forum</a></li>
+        </ul>
+      </header>
+
+      <section>
+
+      <h1 id="virtual-machine-configuration">Virtual Machine Configuration</h1>
+
+<p>The Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) can be installed on a virtual machine. This allows you to run the NCSDK on an unsupported host OS and/or to keep the NCSDK installation isolated from your host system.</p>
+
+<p>We have validated the installation with <a href="https://www.virtualbox.org/">VirtualBox</a> but other virtual machine products may also work with customization specific to that product.</p>
+
+<h2 id="general-requirements">General Requirements</h2>
+<ul>
+  <li><a href="https://www.virtualbox.org/wiki/Downloads">VirtualBox</a> (tested with 5.1.34 but other releases should work)
+    <ul>
+      <li>Extension Pack installed (this can be found on the VirtualBox downloads page for your version of VirtualBox)</li>
+    </ul>
+  </li>
+  <li>Host OS (these have been tested, others may work):
+    <ul>
+      <li>OS X Yosemite 10.10.5</li>
+      <li>Windows 10</li>
+      <li>Ubuntu 16.04 Desktop</li>
+    </ul>
+  </li>
+  <li>Guest OS:
+    <ul>
+      <li><a href="https://www.ubuntu.com/download/desktop">Ubuntu 16.04 Desktop</a></li>
+    </ul>
+  </li>
+</ul>
+
+<h2 id="installation">Installation</h2>
+
+<h3 id="virtual-machine-creation">Virtual Machine Creation</h3>
+
+<p>Use an existing Ubuntu virtual machine that meets installation requirements, or set up a new virtual machine with the following settings:</p>
+
+<ul>
+  <li>Name and operating system
+    <ul>
+      <li>Name: NCSDK <em>(…or anything you like)</em></li>
+      <li>Type: Linux</li>
+      <li>Version: Ubuntu (64-bit)</li>
+    </ul>
+  </li>
+  <li>Memory Size
+    <ul>
+      <li>2048 MB or more (Caffe compilation will likely fail without at least 2GB of RAM)</li>
+    </ul>
+  </li>
+  <li>Hard disk
+    <ul>
+      <li>Check “Create a virtual hard disk now”</li>
+    </ul>
+  </li>
+  <li>Hard disk file type
+    <ul>
+      <li>Check “VDI (VirtualBox Disk Image)”</li>
+    </ul>
+  </li>
+  <li>Storage on physical hard disk
+    <ul>
+      <li>Check “Fixed size”</li>
+    </ul>
+  </li>
+  <li>File location and size
+    <ul>
+      <li><em>Use the default location or choose another.</em></li>
+      <li>10.00+ GB</li>
+    </ul>
+  </li>
+</ul>
+
+<p>If necessary, download an <a href="https://www.ubuntu.com/download/desktop">Ubuntu 16.04 Desktop</a> .iso image file on your host machine. Then, start the virtual machine and follow prompts to install Ubuntu 16.04.</p>
+
+<h3 id="usb-configuration">USB Configuration</h3>
+
+<p>You must enable a USB 3.0 controller and create USB whitelist filters for the virtual machine. The USB 3.0 feature requires the VirtualBox Extension Pack.</p>
+
+<ul>
+  <li>Shut down the virtual machine</li>
+  <li>With the virtual machine selected on the VirtualBox Manager:
+    <ul>
+      <li>Open Settings -&gt; USB
+        <ul>
+          <li>Check “Enable USB Controller”</li>
+          <li>Check “USB 3.0 (xHCI) Controller”</li>
+          <li><strong>Add a new USB filter with Vendor ID: 03e7</strong>
+            <ul>
+              <li>The other filter fields can be blank.</li>
+            </ul>
+          </li>
+          <li><strong>Add a new USB filter with Vendor ID: 040e</strong>
+            <ul>
+              <li>The other filter fields can be blank.</li>
+            </ul>
+          </li>
+        </ul>
+      </li>
+    </ul>
+  </li>
+</ul>
+
+<h3 id="install-the-ncsdk">Install the NCSDK</h3>
+
+<p>Start the virtual machine. In the virtual machine, follow <a href="install.html">Intel® Movidius™ Neural Compute SDK Installation and Configuration</a> directions to install the NCSDK.</p>
+
+
+
+      </section>
+    </div>
+    <footer>
+    
+      
+    </footer>
+    <!--[if !IE]><script>fixScale(document);</script><![endif]-->
+
+    
+  </body>
+</html>
index c1dc89eb3417682b9c8fd6af50b9a2b5f5723cb3..301ba9b2363b4010a8651ef88d030a9b6555e537 100644 (file)
@@ -6,6 +6,7 @@ endif
 TOPTARGETS := all clean check profile compile run
 
 SUBDIRS := $(wildcard */.)
+SUBDIRS := $(filter-out win/., $(SUBDIRS))
 
 $(TOPTARGETS): $(SUBDIRS)
 $(SUBDIRS):
index 931ed9d226abc2005ffd73d2d1391a35295d15a2..853d457c7369e9a0a86762d962593ba329e67bc6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2017 Intel Corporation. 
+// Copyright 2018 Intel Corporation.
 // The source code, information and material ("Material") contained herein is  
 // owned by Intel Corporation or its suppliers or licensors, and title to such  
 // Material remains with Intel Corporation or its suppliers or licensors.  
 
 #include <mvnc.h>
 
-// somewhat arbitrary buffer size for the device name
-#define NAME_SIZE 100
-
 
 int main(int argc, char** argv)
 {
-    mvncStatus retCode;
-    void *deviceHandle;
-    char devName[NAME_SIZE];
-    retCode = mvncGetDeviceName(0, devName, NAME_SIZE);
-    if (retCode != MVNC_OK)
-    {   // failed to get device name, maybe none plugged in.
+    struct ncDeviceHandle_t *deviceHandle;
+    int loglevel = 2;
+    ncStatus_t retCode = ncGlobalSetOption(NC_RW_LOG_LEVEL, &loglevel, sizeof(loglevel));
+
+    // Initialize device handle
+    retCode = ncDeviceCreate(0,&deviceHandle);
+    if(retCode != NC_OK)
+    {
         printf("Error - No NCS devices found.\n");
-       printf("    mvncStatus value: %d\n", retCode);
+        printf("    ncStatus value: %d\n", retCode);
         exit(-1);
     }
-    
-    // Try to open the NCS device via the device name
-    retCode = mvncOpenDevice(devName, &deviceHandle);
-    if (retCode != MVNC_OK)
-    {   // failed to open the device.  
-        printf("Error - Could not open NCS device.\n");
-       printf("    mvncStatus value: %d\n", retCode);
+
+    // Open device
+    retCode = ncDeviceOpen(deviceHandle);
+    if(retCode != NC_OK)
+    {
+        printf("Error- ncDeviceOpen failed\n");
+        printf("    ncStatus value: %d\n", retCode);
         exit(-1);
     }
     
@@ -51,13 +50,13 @@ int main(int argc, char** argv)
     // Pass it to other NC API calls as needed and close it when finished.
     printf("Hello NCS! Device opened normally.\n");
 
-    retCode = mvncCloseDevice(deviceHandle);
+    retCode = ncDeviceClose(deviceHandle);
     deviceHandle = NULL;
-    if (retCode != MVNC_OK)
+    if (retCode != NC_OK)
     {
         printf("Error - Could not close NCS device.\n");
-       printf("    mvncStatus value: %d\n", retCode);
-       exit(-1);
+        printf("    ncStatus value: %d\n", retCode);
+        exit(-1);
     }
 
     printf("Goodbye NCS!  Device Closed normally.\n");
index b70deac36930190f2ec5ceb3089eec2de6c9db26..1dd013cb09c5894ff400d21335fc9ace694f773d 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/python3
 #
-# Copyright 2017 Intel Corporation. 
+# Copyright 2018 Intel Corporation.
 # The source code, information and material ("Material") contained herein is  
 # owned by Intel Corporation or its suppliers or licensors, and title to such  
 # Material remains with Intel Corporation or its suppliers or licensors.  
@@ -24,22 +24,22 @@ import mvnc.mvncapi as fx
 if __name__=="__main__":
 
      # set the logging level for the NC API
-    fx.SetGlobalOption(fx.GlobalOption.LOG_LEVEL, 0)
+    fx.global_set_option(fx.GlobalOption.RW_LOG_LEVEL, 0)
 
     # get a list of names for all the devices plugged into the system
-    ncs_names = fx.EnumerateDevices()
-    if (len(ncs_names) < 1):
+    devices = fx.enumerate_devices()
+    if (len(devices) < 1):
         print("Error - no NCS devices detected, verify an NCS device is connected.")
         quit() 
 
 
     # get the first NCS device by its name.  For this program we will always open the first NCS device.
-    dev = fx.Device(ncs_names[0])
+    dev = fx.Device(devices[0])
 
     
     # try to open the device.  this will throw an exception if someone else has it open already
     try:
-        dev.OpenDevice()
+        dev.open()
     except:
         print("Error - Could not open NCS device.")
         quit()
@@ -49,7 +49,7 @@ if __name__=="__main__":
     
 
     try:
-        dev.CloseDevice()
+        dev.close()
     except:
         print("Error - could not close NCS device.")
         quit()
index e769f61d50fd89cd79b150cabe1e6c12d01a585c..f324bd99d8c8207b96ac43d32ee884b53cd045b8 100644 (file)
@@ -19,7 +19,7 @@ multistick_cpp: googlenet squeezenet
        @echo "\nmaking multistick_cpp"
        cp googlenet.graph cpp/googlenet.graph;
        cp squeezenet.graph cpp/squeezenet.graph;
-       g++ cpp/multistick.cpp cpp/fp16.c -o cpp/multistick_cpp -lmvnc
+       g++ cpp/multistick.cpp -o cpp/multistick_cpp -lmvnc
        @echo "Created cpp/multistick_cpp executable"
 
 .PHONY: run
diff --git a/examples/apps/multistick_cpp/cpp/fp16.c b/examples/apps/multistick_cpp/cpp/fp16.c
deleted file mode 100644 (file)
index cfb1d68..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-#include "fp16.h"
-
-// Copied from Numpy
-
-static unsigned half2float(unsigned short h)
-{
-    unsigned short h_exp, h_sig;
-    unsigned f_sgn, f_exp, f_sig;
-
-    h_exp = (h&0x7c00u);
-    f_sgn = ((unsigned)h&0x8000u) << 16;
-    switch (h_exp) {
-        case 0x0000u: /* 0 or subnormal */
-            h_sig = (h&0x03ffu);
-            /* Signed zero */
-            if (h_sig == 0) {
-                return f_sgn;
-            }
-            /* Subnormal */
-            h_sig <<= 1;
-            while ((h_sig&0x0400u) == 0) {
-                h_sig <<= 1;
-                h_exp++;
-            }
-            f_exp = ((unsigned)(127 - 15 - h_exp)) << 23;
-            f_sig = ((unsigned)(h_sig&0x03ffu)) << 13;
-            return f_sgn + f_exp + f_sig;
-        case 0x7c00u: /* inf or NaN */
-            /* All-ones exponent and a copy of the significand */
-            return f_sgn + 0x7f800000u + (((unsigned)(h&0x03ffu)) << 13);
-        default: /* normalized */
-            /* Just need to adjust the exponent and shift */
-            return f_sgn + (((unsigned)(h&0x7fffu) + 0x1c000u) << 13);
-    }
-}
-
-unsigned short float2half(unsigned f)
-{
-    unsigned f_exp, f_sig;
-    unsigned short h_sgn, h_exp, h_sig;
-
-    h_sgn = (unsigned short) ((f&0x80000000u) >> 16);
-    f_exp = (f&0x7f800000u);
-
-    /* Exponent overflow/NaN converts to signed inf/NaN */
-    if (f_exp >= 0x47800000u) {
-        if (f_exp == 0x7f800000u) {
-            /* Inf or NaN */
-            f_sig = (f&0x007fffffu);
-            if (f_sig != 0) {
-                /* NaN - propagate the flag in the significand... */
-                unsigned short ret = (unsigned short) (0x7c00u + (f_sig >> 13));
-                /* ...but make sure it stays a NaN */
-                if (ret == 0x7c00u) {
-                    ret++;
-                }
-                return h_sgn + ret;
-            } else {
-                /* signed inf */
-                return (unsigned short) (h_sgn + 0x7c00u);
-            }
-        } else {
-            /* overflow to signed inf */
-#if NPY_HALF_GENERATE_OVERFLOW
-            npy_set_floatstatus_overflow();
-#endif
-            return (unsigned short) (h_sgn + 0x7c00u);
-        }
-    }
-
-    /* Exponent underflow converts to a subnormal half or signed zero */
-    if (f_exp <= 0x38000000u) {
-        /*
-         * Signed zeros, subnormal floats, and floats with small
-         * exponents all convert to signed zero halfs.
-         */
-        if (f_exp < 0x33000000u) {
-#if NPY_HALF_GENERATE_UNDERFLOW
-            /* If f != 0, it underflowed to 0 */
-            if ((f&0x7fffffff) != 0) {
-                npy_set_floatstatus_underflow();
-            }
-#endif
-            return h_sgn;
-        }
-        /* Make the subnormal significand */
-        f_exp >>= 23;
-        f_sig = (0x00800000u + (f&0x007fffffu));
-#if NPY_HALF_GENERATE_UNDERFLOW
-        /* If it's not exactly represented, it underflowed */
-        if ((f_sig&(((unsigned)1 << (126 - f_exp)) - 1)) != 0) {
-            npy_set_floatstatus_underflow();
-        }
-#endif
-        f_sig >>= (113 - f_exp);
-        /* Handle rounding by adding 1 to the bit beyond half precision */
-#if NPY_HALF_ROUND_TIES_TO_EVEN
-        /*
-         * If the last bit in the half significand is 0 (already even), and
-         * the remaining bit pattern is 1000...0, then we do not add one
-         * to the bit after the half significand.  In all other cases, we do.
-         */
-        if ((f_sig&0x00003fffu) != 0x00001000u) {
-            f_sig += 0x00001000u;
-        }
-#else
-        f_sig += 0x00001000u;
-#endif
-        h_sig = (unsigned short) (f_sig >> 13);
-        /*
-         * If the rounding causes a bit to spill into h_exp, it will
-         * increment h_exp from zero to one and h_sig will be zero.
-         * This is the correct result.
-         */
-        return (unsigned short) (h_sgn + h_sig);
-    }
-
-    /* Regular case with no overflow or underflow */
-    h_exp = (unsigned short) ((f_exp - 0x38000000u) >> 13);
-    /* Handle rounding by adding 1 to the bit beyond half precision */
-    f_sig = (f&0x007fffffu);
-#if NPY_HALF_ROUND_TIES_TO_EVEN
-    /*
-     * If the last bit in the half significand is 0 (already even), and
-     * the remaining bit pattern is 1000...0, then we do not add one
-     * to the bit after the half significand.  In all other cases, we do.
-     */
-    if ((f_sig&0x00003fffu) != 0x00001000u) {
-        f_sig += 0x00001000u;
-    }
-#else
-    f_sig += 0x00001000u;
-#endif
-    h_sig = (unsigned short) (f_sig >> 13);
-    /*
-     * If the rounding causes a bit to spill into h_exp, it will
-     * increment h_exp by one and h_sig will be zero.  This is the
-     * correct result.  h_exp may increment to 15, at greatest, in
-     * which case the result overflows to a signed inf.
-     */
-#if NPY_HALF_GENERATE_OVERFLOW
-    h_sig += h_exp;
-    if (h_sig == 0x7c00u) {
-        npy_set_floatstatus_overflow();
-    }
-    return h_sgn + h_sig;
-#else
-    return h_sgn + h_exp + h_sig;
-#endif
-}
-
-void floattofp16(unsigned char *dst, float *src, unsigned nelem)
-{
-       unsigned i;
-       unsigned short *_dst = (unsigned short *)dst;
-       unsigned *_src = (unsigned *)src;
-       
-       for(i = 0; i < nelem; i++)
-               _dst[i] = float2half(_src[i]);
-}
-
-void fp16tofloat(float *dst, unsigned char *src, unsigned nelem)
-{
-       unsigned i;
-       unsigned *_dst = (unsigned *)dst;
-       unsigned short *_src = (unsigned short *)src;
-       
-       for(i = 0; i < nelem; i++)
-               _dst[i] = half2float(_src[i]);
-}
-
diff --git a/examples/apps/multistick_cpp/cpp/fp16.h b/examples/apps/multistick_cpp/cpp/fp16.h
deleted file mode 100644 (file)
index 50f19ce..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copied from Numpy
-
-
-static unsigned half2float(unsigned short h);
-unsigned short float2half(unsigned f);
-void floattofp16(unsigned char *dst, float *src, unsigned nelem);
-void fp16tofloat(float *dst, unsigned char *src, unsigned nelem);
-
-
index 889c7557442b81067856a8564123479ba11953fa..d7ea48f210fc0fb3012db2ab499778837c5ba001 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2017 Intel Corporation. 
+// Copyright 2018 Intel Corporation.
 // The source code, information and material ("Material") contained herein is  
 // owned by Intel Corporation or its suppliers or licensors, and title to such  
 // Material remains with Intel Corporation or its suppliers or licensors.  
 #define STB_IMAGE_RESIZE_IMPLEMENTATION
 #include "stb_image_resize.h"
 
-#include "fp16.h"
 #include <mvnc.h>
 
-
-// somewhat arbitrary buffer size for the device name
-#define NAME_SIZE 100
-
 // from current director to examples base director
 // #define APP_BASE_DIR "../"
 
 #define SQUEEZENET_IMAGE_FILE_NAME EXAMPLES_BASE_DIR "data/images/nps_baseball.png"
 
 
-// 16 bits.  will use this to store half precision floats since C++ has no 
-// built in support for it.
-typedef unsigned short half;
-
 // GoogleNet image dimensions, network mean values for each channel in BGR order.
 const int networkDimGoogleNet = 224;
 const int networkDimSqueezeNet = 227;
@@ -56,7 +47,7 @@ float networkMeanSqueezeNet[] = {0.40787054*255.0, 0.45752458*255.0, 0.48109378*
 
 // Prototypes
 void *LoadGraphFile(const char *path, unsigned int *length);
-half *LoadImage(const char *path, int reqsize, float *mean);
+float *LoadImage(const char *path, int reqsize, float *mean);
 // end prototypes
 
 // Reads a graph file from the file system and copies it to a buffer
@@ -65,37 +56,37 @@ half *LoadImage(const char *path, int reqsize, float *mean);
 //            graph file on disk before calling
 // Param length must must point to an integer that will get set to the number of bytes 
 //              allocated for the buffer
-// Returns pointer to the buffer allcoated. 
+// Returns pointer to the buffer allcoated.
 // Note: The caller must free the buffer returned.
 void *LoadGraphFile(const char *path, unsigned int *length)
 {
-       FILE *fp;
-       char *buf;
-
-       fp = fopen(path, "rb");
-       if(fp == NULL)
-               return 0;
-       fseek(fp, 0, SEEK_END);
-       *length = ftell(fp);
-       rewind(fp);
-       if(!(buf = (char*) malloc(*length)))
-       {
-               fclose(fp);
-               return 0;
-       }
-       if(fread(buf, 1, *length, fp) != *length)
-       {
-               fclose(fp);
-               free(buf);
-               return 0;
-       }
-       fclose(fp);
-       return buf;
+    FILE *fp;
+    char *buf;
+
+    fp = fopen(path, "rb");
+    if(fp == NULL)
+        return 0;
+    fseek(fp, 0, SEEK_END);
+    *length = ftell(fp);
+    rewind(fp);
+    if(!(buf = (char*) malloc(*length)))
+    {
+        fclose(fp);
+        return 0;
+    }
+    if(fread(buf, 1, *length, fp) != *length)
+    {
+        fclose(fp);
+        free(buf);
+        return 0;
+    }
+    fclose(fp);
+    return buf;
 }
 
 // Reads an image file from disk (8 bit per channel RGB .jpg or .png or other formats 
 // supported by stbi_load.)  Resizes it, subtracts the mean from each channel, and then 
-// converts to an array of half precision floats that is suitable to pass to mvncLoadTensor.  
+// converts to an array of half precision floats that is suitable to pass to ncFifoWriteElem.  
 // The returned array will contain 3 floats for each pixel in the image the first float 
 // for a pixel is it's the Blue channel value the next is Green and then Red.  The array 
 // contains the pixel values in row major order.
@@ -107,64 +98,52 @@ void *LoadGraphFile(const char *path, unsigned int *length)
 //            numbers are the mean values for the blue, green, and red channels in that order.
 //            each B, G, and R value from the image will have this value subtracted from it.
 // Returns a pointer to a buffer that is allocated internally via malloc.  this buffer contains
-//         the 16 bit float values that can be passed to mvncLoadTensor().  The returned buffer 
+//         the 32 bit float values that can be passed to ncFifoWriteElem().  The returned buffer
 //         will contain reqSize*reqSize*3 half floats.
-half *LoadImage(const char *path, int reqSize, float *mean)
+float *LoadImage(const char *path, int reqSize, float *mean)
 {
-       int width, height, cp, i;
-       unsigned char *img, *imgresized;
-       float *imgfp32;
-       half *imgfp16;
-
-       img = stbi_load(path, &width, &height, &cp, 3);
-       if(!img)
-       {
-               printf("Error - the image file %s could not be loaded\n", path);
-               return NULL;
-       }
-       imgresized = (unsigned char*) malloc(3*reqSize*reqSize);
-       if(!imgresized)
-       {
-               free(img);
-               perror("malloc");
-               return NULL;
-       }
-       stbir_resize_uint8(img, width, height, 0, imgresized, reqSize, reqSize, 0, 3);
-       free(img);
-       imgfp32 = (float*) malloc(sizeof(*imgfp32) * reqSize * reqSize * 3);
-       if(!imgfp32)
-       {
-               free(imgresized);
-               perror("malloc");
-               return NULL;
-       }
-       for(i = 0; i < reqSize * reqSize * 3; i++)
-               imgfp32[i] = imgresized[i];
-       free(imgresized);
-       imgfp16 = (half*) malloc(sizeof(*imgfp16) * reqSize * reqSize * 3);
-       if(!imgfp16)
-       {
-               free(imgfp32);
-               perror("malloc");
-               return NULL;
-       }
-       for(i = 0; i < reqSize*reqSize; i++)
-       {
-               float blue, green, red;
-                blue = imgfp32[3*i+2];
-                green = imgfp32[3*i+1];
-                red = imgfp32[3*i+0];
-
-                imgfp32[3*i+0] = blue-mean[0];
-                imgfp32[3*i+1] = green-mean[1]; 
-                imgfp32[3*i+2] = red-mean[2];
-
-                // uncomment to see what values are getting passed to mvncLoadTensor() before conversion to half float
-                //printf("Blue: %f, Grean: %f,  Red: %f \n", imgfp32[3*i+0], imgfp32[3*i+1], imgfp32[3*i+2]);
-       }
-       floattofp16((unsigned char *)imgfp16, imgfp32, 3*reqSize*reqSize);
-       free(imgfp32);
-       return imgfp16;
+    int width, height, cp, i;
+    unsigned char *img, *imgresized;
+    float *imgfp32;
+
+    img = stbi_load(path, &width, &height, &cp, 3);
+    if(!img)
+    {
+        printf("Error - the image file %s could not be loaded\n", path);
+        return NULL;
+    }
+    imgresized = (unsigned char*) malloc(3*reqSize*reqSize);
+    if(!imgresized)
+    {
+        free(img);
+        perror("malloc");
+        return NULL;
+    }
+    stbir_resize_uint8(img, width, height, 0, imgresized, reqSize, reqSize, 0, 3);
+    free(img);
+    imgfp32 = (float*) malloc(sizeof(*imgfp32) * reqSize * reqSize * 3);
+    if(!imgfp32)
+    {
+        free(imgresized);
+        perror("malloc");
+        return 0;
+    }
+    for(i = 0; i < reqSize * reqSize * 3; i++)
+        imgfp32[i] = imgresized[i];
+    free(imgresized);
+
+    for(i = 0; i < reqSize*reqSize; i++)
+    {
+        float blue, green, red;
+        blue = imgfp32[3*i+2];
+        green = imgfp32[3*i+1];
+        red = imgfp32[3*i+0];
+
+        imgfp32[3*i+0] = blue-mean[0];
+        imgfp32[3*i+1] = green-mean[1];
+        imgfp32[3*i+2] = red-mean[2];
+    }
+    return imgfp32;
 }
 
 
@@ -173,20 +152,19 @@ half *LoadImage(const char *path, int reqSize, float *mean)
 // Param deviceHandle is the address of a device handle that will be set 
 //                    if opening is successful
 // Returns true if works or false if doesn't.
-bool OpenOneNCS(int deviceIndex, void** deviceHandle)
+bool OpenOneNCS(int deviceIndex, struct ncDeviceHandle_t **deviceHandle)
 {
-    mvncStatus retCode;
-    char devName[NAME_SIZE];
-    retCode = mvncGetDeviceName(deviceIndex, devName, NAME_SIZE);
-    if (retCode != MVNC_OK)
+    ncStatus_t retCode;
+    retCode = ncDeviceCreate(deviceIndex, deviceHandle);
+    if (retCode != NC_OK)
     {   // failed to get this device's name, maybe none plugged in.
         printf("Error - NCS device at index %d not found\n", deviceIndex);
         return false;
     }
     
     // Try to open the NCS device via the device name
-    retCode = mvncOpenDevice(devName, deviceHandle);
-    if (retCode != MVNC_OK)
+    retCode = ncDeviceOpen(*deviceHandle);
+    if (retCode != NC_OK)
     {   // failed to open the device.  
         printf("Error - Could not open NCS device at index %d\n", deviceIndex);
         return false;
@@ -194,7 +172,7 @@ bool OpenOneNCS(int deviceIndex, void** deviceHandle)
     
     // deviceHandle is ready to use now.  
     // Pass it to other NC API calls as needed and close it when finished.
-    printf("Successfully opened NCS device at index %d!\n", deviceIndex);
+    printf("Successfully opened NCS device at index %d %p!\n", deviceIndex, *deviceHandle);
     return true;
 }
 
@@ -205,26 +183,44 @@ bool OpenOneNCS(int deviceIndex, void** deviceHandle)
 // Param graphHandle is the address of the graph handle that will be created internally.
 //                   the caller must call mvncDeallocateGraph when done with the handle.
 // Returns true if works or false if doesn't.
-bool LoadGraphToNCS(void* deviceHandle, const char* graphFilename, void** graphHandle)
+bool LoadGraphToNCS(struct ncDeviceHandle_t* deviceHandle, const char* graphFilename, struct ncGraphHandle_t** graphHandle)
 {
-    mvncStatus retCode;
+    ncStatus_t retCode;
+    int rc = 0;
+    unsigned int mem, memMax, length;
 
     // Read in a graph file
     unsigned int graphFileLen;
     void* graphFileBuf = LoadGraphFile(graphFilename, &graphFileLen);
 
+    length = sizeof(unsigned int);
+    // Read device memory info
+    rc = ncDeviceGetOption(deviceHandle, NC_RO_DEVICE_CURRENT_MEMORY_USED, (void **)&mem, &length);
+    rc += ncDeviceGetOption(deviceHandle, NC_RO_DEVICE_MEMORY_SIZE, (void **)&memMax, &length);
+    if(rc)
+        printf("ncDeviceGetOption failed, rc=%d\n", rc);
+    else
+        printf("Current memory used on device is %d out of %d\n", mem, memMax);
+
     // allocate the graph
-    retCode = mvncAllocateGraph(deviceHandle, graphHandle, graphFileBuf, graphFileLen);
-    free(graphFileBuf);
-    if (retCode != MVNC_OK)
+    retCode = ncGraphCreate("graph", graphHandle);
+    if (retCode)
+    {
+        printf("ncGraphCreate failed, retCode=%d\n", retCode);
+        return retCode;
+    }
+
+    // Send graph to device
+    retCode = ncGraphAllocate(deviceHandle, *graphHandle, graphFileBuf, graphFileLen);
+    if (retCode != NC_OK)
     {   // error allocating graph
         printf("Could not allocate graph for file: %s\n", graphFilename); 
-        printf("Error from mvncAllocateGraph is: %d\n", retCode);
+        printf("Error from ncGraphAllocate is: %d\n", retCode);
         return false;
     }
 
     // successfully allocated graph.  Now graphHandle is ready to go.  
-    // use graphHandle for other API calls and call mvncDeallocateGraph
+    // use graphHandle for other API calls and call ncGraphDestroy
     // when done with it.
     printf("Successfully allocated graph for %s\n", graphFilename);
 
@@ -242,121 +238,183 @@ bool LoadGraphToNCS(void* deviceHandle, const char* graphFilename, void** graphH
 // Param networkMean is pointer to array of 3 floats that are the mean values for the network
 //                   for each color channel, blue, green, and red in that order.
 // Returns tru if works or false if doesn't
-bool DoInferenceOnImageFile(void* graphHandle, const char* imageFileName, int networkDim, float* networkMean)
+bool DoInferenceOnImageFile(struct ncGraphHandle_t *graphHandle, struct ncDeviceHandle_t *dev,
+                            struct ncFifoHandle_t *bufferIn, struct ncFifoHandle_t *bufferOut,
+                            const char* imageFileName, int networkDim, float* networkMean)
 {
-    mvncStatus retCode;
+    ncStatus_t retCode;
+    struct ncTensorDescriptor_t td;
+    struct ncTensorDescriptor_t resultDesc;
+    unsigned int length;
 
     // LoadImage will read image from disk, convert channels to floats
-    // subtract network mean for each value in each channel.  Then, convert 
-    // floats to half precision floats and return pointer to the buffer 
-    // of half precision floats (Fp16s)
-    half* imageBufFp16 = LoadImage(imageFileName, networkDim, networkMean);
-
-    // calculate the length of the buffer that contains the half precision floats. 
-    // 3 channels * width * height * sizeof a 16bit float 
-    unsigned int lenBufFp16 = 3*networkDim*networkDim*sizeof(*imageBufFp16);
-
-    // start the inference with mvncLoadTensor()
-    retCode = mvncLoadTensor(graphHandle, imageBufFp16, lenBufFp16, NULL);
-    free(imageBufFp16);
-    if (retCode != MVNC_OK)
+    // subtract network mean for each value in each channel.  Then, 
+    // return pointer to the buffer of 32Bit floats
+    float* imageBuf = LoadImage(imageFileName, networkDim, networkMean);
+
+    // calculate the length of the buffer that contains the floats. 
+    // 3 channels * width * height * sizeof a 32bit float 
+    unsigned int lenBuf = 3*networkDim*networkDim*sizeof(*imageBuf);
+
+    // Read descriptor for input tensor
+    length = sizeof(struct ncTensorDescriptor_t);
+    retCode = ncFifoGetOption(bufferIn, NC_RO_FIFO_TENSOR_DESCRIPTOR, &td, &length);
+    if (retCode || length != sizeof(td)){
+        printf("ncFifoGetOption failed, retCode=%d\n", retCode);
+        return false;
+    }
+
+    // Write tensor to input fifo
+    retCode = ncFifoWriteElem(bufferIn, imageBuf, &lenBuf, NULL);
+    if (retCode != NC_OK)
     {   // error loading tensor
         printf("Error - Could not load tensor\n");
-        printf("    mvncStatus from mvncLoadTensor is: %d\n", retCode);
+        printf("    ncStatus_t from mvncLoadTensor is: %d\n", retCode);
         return false;
     }
 
-    // the inference has been started, now call mvncGetResult() for the
+    // Start inference
+    retCode = ncGraphQueueInference(graphHandle, &bufferIn, 1, &bufferOut, 1);
+    if (retCode)
+    {
+        free(imageBuf);
+        printf("ncGraphQueueInference failed, retCode=%d\n", retCode);
+        return false;
+    }
+    free(imageBuf);
+
+    // the inference has been started, now call ncFifoReadElem() for the
     // inference result 
     printf("Successfully loaded the tensor for image %s\n", imageFileName);
     
-    void* resultData16;
+    unsigned int outputDataLength;
+    length = sizeof(unsigned int);
+    retCode = ncFifoGetOption(bufferOut, NC_RO_FIFO_ELEMENT_DATA_SIZE, &outputDataLength, &length);
+    if (retCode || length != sizeof(unsigned int)){
+        printf("ncFifoGetOption failed, rc=%d\n", retCode);
+        exit(-1);
+    }
+    float* resultData = (float*) malloc(outputDataLength);
+
     void* userParam;
-    unsigned int lenResultData;
-    retCode = mvncGetResult(graphHandle, &resultData16, &lenResultData, &userParam);
-    if (retCode != MVNC_OK)
+    // Read output results
+    retCode = ncFifoReadElem(bufferOut, (void*) resultData, &outputDataLength, &userParam);
+    if (retCode != NC_OK)
     {
         printf("Error - Could not get result for image %s\n", imageFileName);
-        printf("    mvncStatus from mvncGetResult is: %d\n", retCode);
+        printf("    ncStatus_t from ncFifoReadElem is: %d\n", retCode);
         return false;
     }
 
     // Successfully got the result.  The inference result is in the buffer pointed to by resultData
     printf("Successfully got the inference result for image %s\n", imageFileName);
-    //printf("resultData is %d bytes which is %d 16-bit floats.\n", lenResultData, lenResultData/(int)sizeof(half));
-
-    // convert half precision floats to full floats
-    int numResults = lenResultData / sizeof(half);
-    float* resultData32;
-    resultData32 = (float*)malloc(numResults * sizeof(*resultData32));
-    fp16tofloat(resultData32, (unsigned char*)resultData16, numResults);
 
+    unsigned int numResults = outputDataLength/sizeof(float);
     float maxResult = 0.0;
     int maxIndex = -1;
     for (int index = 0; index < numResults; index++)
     {
-        // printf("Category %d is: %f\n", index, resultData32[index]);
-        if (resultData32[index] > maxResult)
+        // printf("Category %d is: %f\n", index, resultData[index]);
+        if (resultData[index] > maxResult)
         {
-            maxResult = resultData32[index];
+            maxResult = resultData[index];
             maxIndex = index;
         }
     }
     printf("Index of top result is: %d\n", maxIndex);
-    printf("Probability of top result is: %f\n", resultData32[maxIndex]);
+    printf("Probability of top result is: %f\n", resultData[maxIndex]);
+    free(resultData);
 }
 
 // Main entry point for the program
 int main(int argc, char** argv)
 {
-    mvncStatus retCode;
-    void* devHandle1;
-    void* devHandle2;
-    void* graphHandleGoogleNet; 
-    void* graphHandleSqueezeNet;
-
-    if (!OpenOneNCS(0, &devHandle1)) 
-    {  // couldn't open first NCS device
+    int rc = 0;
+    unsigned int length;
+    struct ncDeviceHandle_t *devHandle1;
+    struct ncDeviceHandle_t *devHandle2;
+    struct ncGraphHandle_t *graphHandleGoogleNet;
+    struct ncGraphHandle_t *graphHandleSqueezeNet;
+    int loglevel = 2;
+    ncStatus_t retCode = ncGlobalSetOption(NC_RW_LOG_LEVEL, &loglevel, sizeof(loglevel));
+
+    if (!OpenOneNCS(0, &devHandle1))
+    {   // couldn't open first NCS device
         exit(-1);
     }
-    if (!OpenOneNCS(1, &devHandle2)) 
+    if (!OpenOneNCS(1, &devHandle2))
     {   // couldn't open second NCS device
         exit(-1);
     }
 
-    void* deviceHandle = devHandle1;
-
     if (!LoadGraphToNCS(devHandle1, GOOGLENET_GRAPH_FILE_NAME, &graphHandleGoogleNet))
     {
-        mvncCloseDevice(devHandle1);
-        mvncCloseDevice(devHandle2);
+        ncDeviceClose(devHandle1);
+        ncDeviceClose(devHandle2);
         exit(-2);
     }
     if (!LoadGraphToNCS(devHandle2, SQUEEZENET_GRAPH_FILE_NAME, &graphHandleSqueezeNet))
     {
-        mvncDeallocateGraph(graphHandleGoogleNet);
+        ncGraphDestroy(&graphHandleGoogleNet);
         graphHandleGoogleNet = NULL;
-        mvncCloseDevice(devHandle1);
-        mvncCloseDevice(devHandle2);
+        ncDeviceClose(devHandle1);
+        ncDeviceClose(devHandle2);
         exit(-2);
     }
 
+    // Read tensor descriptors for Googlenet
+    struct ncTensorDescriptor_t inputTdGooglenet;
+    struct ncTensorDescriptor_t outputTdGooglenet;
+    length = sizeof(struct ncTensorDescriptor_t);
+    ncGraphGetOption(graphHandleGoogleNet, NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS, &inputTdGooglenet,  &length);
+    ncGraphGetOption(graphHandleGoogleNet, NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS, &outputTdGooglenet,  &length);
+
+    // Read tensor descriptors for SqueezeNet
+    struct ncTensorDescriptor_t inputTdSqueezeNet;
+    struct ncTensorDescriptor_t outputTdSqueezeNet;
+    length = sizeof(struct ncTensorDescriptor_t);
+    ncGraphGetOption(graphHandleSqueezeNet, NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS, &inputTdSqueezeNet,  &length);
+    ncGraphGetOption(graphHandleSqueezeNet, NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS, &outputTdSqueezeNet,  &length);
+
+    // Init & Create Fifos for Googlenet
+    struct ncFifoHandle_t * bufferInGooglenet;
+    struct ncFifoHandle_t * bufferOutGooglenet;
+    rc = ncFifoCreate("fifoIn0", NC_FIFO_HOST_WO, &bufferInGooglenet);
+    rc += ncFifoAllocate(bufferInGooglenet, devHandle1, &inputTdGooglenet, 2);
+    rc += ncFifoCreate("fifoOut0", NC_FIFO_HOST_RO, &bufferOutGooglenet);
+    rc += ncFifoAllocate(bufferOutGooglenet, devHandle1, &outputTdGooglenet, 2);
+    if(rc)
+        printf("Fifo allocation failed for Googlenet, rc=%d\n", rc);
+
+    // Init & Create Fifos for SqueezeNet
+    struct ncFifoHandle_t * bufferInSqueezeNet;
+    struct ncFifoHandle_t * bufferOutSqueezeNet;
+    rc = ncFifoCreate("fifoIn1", NC_FIFO_HOST_WO, &bufferInSqueezeNet);
+    rc += ncFifoAllocate(bufferInSqueezeNet, devHandle2, &inputTdSqueezeNet, 2);
+    rc += ncFifoCreate("fifoOut2", NC_FIFO_HOST_RO, &bufferOutSqueezeNet);
+    rc += ncFifoAllocate(bufferOutSqueezeNet, devHandle2, &outputTdSqueezeNet, 2);
+    if(rc)
+        printf("Fifo allocation failed for SqueezeNet, rc=%d\n", rc);
+
     printf("\n--- NCS 1 inference ---\n");
-    DoInferenceOnImageFile(graphHandleGoogleNet, GOOGLENET_IMAGE_FILE_NAME, networkDimGoogleNet, networkMeanGoogleNet);
+    DoInferenceOnImageFile(graphHandleGoogleNet, devHandle1, bufferInGooglenet, bufferOutGooglenet, GOOGLENET_IMAGE_FILE_NAME, networkDimGoogleNet, networkMeanGoogleNet);
     printf("-----------------------\n");
 
     printf("\n--- NCS 2 inference ---\n");
-    DoInferenceOnImageFile(graphHandleSqueezeNet, SQUEEZENET_IMAGE_FILE_NAME, networkDimSqueezeNet, networkMeanSqueezeNet);
+    DoInferenceOnImageFile(graphHandleSqueezeNet, devHandle2, bufferInSqueezeNet, bufferOutSqueezeNet, SQUEEZENET_IMAGE_FILE_NAME, networkDimSqueezeNet, networkMeanSqueezeNet);
     printf("-----------------------\n");
-
-    retCode = mvncDeallocateGraph(graphHandleSqueezeNet);
+    retCode = ncFifoDestroy(&bufferInGooglenet);
+    retCode = ncFifoDestroy(&bufferOutGooglenet);
+    retCode = ncFifoDestroy(&bufferInSqueezeNet);
+    retCode = ncFifoDestroy(&bufferOutSqueezeNet);
+    retCode = ncGraphDestroy(&graphHandleSqueezeNet);
     graphHandleSqueezeNet = NULL;
-    retCode = mvncDeallocateGraph(graphHandleGoogleNet);
+    retCode = ncGraphDestroy(&graphHandleGoogleNet);
     graphHandleGoogleNet = NULL;
   
-    retCode = mvncCloseDevice(devHandle1);
+    retCode = ncDeviceClose(devHandle1);
     devHandle1 = NULL;
 
-    retCode = mvncCloseDevice(devHandle2);
+    retCode = ncDeviceClose(devHandle2);
     devHandle2 = NULL;
 }
index b738de567dad54a3ba585279308eac38a8f0bdad..d089e91eb53bf8c80ed2e4e99495cfae00719bd6 100644 (file)
@@ -96,9 +96,9 @@ run_py: compile
        ./run.py
 
 .PHONY:        cpp
-cpp: cpp/run.cpp cpp/fp16.c
+cpp: cpp/run.cpp
        @echo "\nmaking cpp"
-       g++ cpp/run.cpp cpp/fp16.c -o cpp/run_cpp -lmvnc
+       g++ cpp/run.cpp -o cpp/run_cpp -lmvnc
 
 .PHONY: run_cpp
 run_cpp: compile cpp
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/examples/caffe/AlexNet/cpp/fp16.c b/examples/caffe/AlexNet/cpp/fp16.c
deleted file mode 100644 (file)
index cfb1d68..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-#include "fp16.h"
-
-// Copied from Numpy
-
-static unsigned half2float(unsigned short h)
-{
-    unsigned short h_exp, h_sig;
-    unsigned f_sgn, f_exp, f_sig;
-
-    h_exp = (h&0x7c00u);
-    f_sgn = ((unsigned)h&0x8000u) << 16;
-    switch (h_exp) {
-        case 0x0000u: /* 0 or subnormal */
-            h_sig = (h&0x03ffu);
-            /* Signed zero */
-            if (h_sig == 0) {
-                return f_sgn;
-            }
-            /* Subnormal */
-            h_sig <<= 1;
-            while ((h_sig&0x0400u) == 0) {
-                h_sig <<= 1;
-                h_exp++;
-            }
-            f_exp = ((unsigned)(127 - 15 - h_exp)) << 23;
-            f_sig = ((unsigned)(h_sig&0x03ffu)) << 13;
-            return f_sgn + f_exp + f_sig;
-        case 0x7c00u: /* inf or NaN */
-            /* All-ones exponent and a copy of the significand */
-            return f_sgn + 0x7f800000u + (((unsigned)(h&0x03ffu)) << 13);
-        default: /* normalized */
-            /* Just need to adjust the exponent and shift */
-            return f_sgn + (((unsigned)(h&0x7fffu) + 0x1c000u) << 13);
-    }
-}
-
-unsigned short float2half(unsigned f)
-{
-    unsigned f_exp, f_sig;
-    unsigned short h_sgn, h_exp, h_sig;
-
-    h_sgn = (unsigned short) ((f&0x80000000u) >> 16);
-    f_exp = (f&0x7f800000u);
-
-    /* Exponent overflow/NaN converts to signed inf/NaN */
-    if (f_exp >= 0x47800000u) {
-        if (f_exp == 0x7f800000u) {
-            /* Inf or NaN */
-            f_sig = (f&0x007fffffu);
-            if (f_sig != 0) {
-                /* NaN - propagate the flag in the significand... */
-                unsigned short ret = (unsigned short) (0x7c00u + (f_sig >> 13));
-                /* ...but make sure it stays a NaN */
-                if (ret == 0x7c00u) {
-                    ret++;
-                }
-                return h_sgn + ret;
-            } else {
-                /* signed inf */
-                return (unsigned short) (h_sgn + 0x7c00u);
-            }
-        } else {
-            /* overflow to signed inf */
-#if NPY_HALF_GENERATE_OVERFLOW
-            npy_set_floatstatus_overflow();
-#endif
-            return (unsigned short) (h_sgn + 0x7c00u);
-        }
-    }
-
-    /* Exponent underflow converts to a subnormal half or signed zero */
-    if (f_exp <= 0x38000000u) {
-        /*
-         * Signed zeros, subnormal floats, and floats with small
-         * exponents all convert to signed zero halfs.
-         */
-        if (f_exp < 0x33000000u) {
-#if NPY_HALF_GENERATE_UNDERFLOW
-            /* If f != 0, it underflowed to 0 */
-            if ((f&0x7fffffff) != 0) {
-                npy_set_floatstatus_underflow();
-            }
-#endif
-            return h_sgn;
-        }
-        /* Make the subnormal significand */
-        f_exp >>= 23;
-        f_sig = (0x00800000u + (f&0x007fffffu));
-#if NPY_HALF_GENERATE_UNDERFLOW
-        /* If it's not exactly represented, it underflowed */
-        if ((f_sig&(((unsigned)1 << (126 - f_exp)) - 1)) != 0) {
-            npy_set_floatstatus_underflow();
-        }
-#endif
-        f_sig >>= (113 - f_exp);
-        /* Handle rounding by adding 1 to the bit beyond half precision */
-#if NPY_HALF_ROUND_TIES_TO_EVEN
-        /*
-         * If the last bit in the half significand is 0 (already even), and
-         * the remaining bit pattern is 1000...0, then we do not add one
-         * to the bit after the half significand.  In all other cases, we do.
-         */
-        if ((f_sig&0x00003fffu) != 0x00001000u) {
-            f_sig += 0x00001000u;
-        }
-#else
-        f_sig += 0x00001000u;
-#endif
-        h_sig = (unsigned short) (f_sig >> 13);
-        /*
-         * If the rounding causes a bit to spill into h_exp, it will
-         * increment h_exp from zero to one and h_sig will be zero.
-         * This is the correct result.
-         */
-        return (unsigned short) (h_sgn + h_sig);
-    }
-
-    /* Regular case with no overflow or underflow */
-    h_exp = (unsigned short) ((f_exp - 0x38000000u) >> 13);
-    /* Handle rounding by adding 1 to the bit beyond half precision */
-    f_sig = (f&0x007fffffu);
-#if NPY_HALF_ROUND_TIES_TO_EVEN
-    /*
-     * If the last bit in the half significand is 0 (already even), and
-     * the remaining bit pattern is 1000...0, then we do not add one
-     * to the bit after the half significand.  In all other cases, we do.
-     */
-    if ((f_sig&0x00003fffu) != 0x00001000u) {
-        f_sig += 0x00001000u;
-    }
-#else
-    f_sig += 0x00001000u;
-#endif
-    h_sig = (unsigned short) (f_sig >> 13);
-    /*
-     * If the rounding causes a bit to spill into h_exp, it will
-     * increment h_exp by one and h_sig will be zero.  This is the
-     * correct result.  h_exp may increment to 15, at greatest, in
-     * which case the result overflows to a signed inf.
-     */
-#if NPY_HALF_GENERATE_OVERFLOW
-    h_sig += h_exp;
-    if (h_sig == 0x7c00u) {
-        npy_set_floatstatus_overflow();
-    }
-    return h_sgn + h_sig;
-#else
-    return h_sgn + h_exp + h_sig;
-#endif
-}
-
-void floattofp16(unsigned char *dst, float *src, unsigned nelem)
-{
-       unsigned i;
-       unsigned short *_dst = (unsigned short *)dst;
-       unsigned *_src = (unsigned *)src;
-       
-       for(i = 0; i < nelem; i++)
-               _dst[i] = float2half(_src[i]);
-}
-
-void fp16tofloat(float *dst, unsigned char *src, unsigned nelem)
-{
-       unsigned i;
-       unsigned *_dst = (unsigned *)dst;
-       unsigned short *_src = (unsigned short *)src;
-       
-       for(i = 0; i < nelem; i++)
-               _dst[i] = half2float(_src[i]);
-}
-
diff --git a/examples/caffe/AlexNet/cpp/fp16.h b/examples/caffe/AlexNet/cpp/fp16.h
deleted file mode 100644 (file)
index 50f19ce..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copied from Numpy
-
-
-static unsigned half2float(unsigned short h);
-unsigned short float2half(unsigned f);
-void floattofp16(unsigned char *dst, float *src, unsigned nelem);
-void fp16tofloat(float *dst, unsigned char *src, unsigned nelem);
-
-
index 16fddc9fc5812af6e8e7dce124bc9b3f726653d0..a269f2d1222a3ac5d74ffac1ba77d394411bbeae 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2017 Intel Corporation. 
+// Copyright 2018 Intel Corporation.
 // The source code, information and material ("Material") contained herein is  
 // owned by Intel Corporation or its suppliers or licensors, and title to such  
 // Material remains with Intel Corporation or its suppliers or licensors.  
 #define STB_IMAGE_RESIZE_IMPLEMENTATION
 #include "stb_image_resize.h"
 
-#include "fp16.h"
 #include <mvnc.h>
 
-
-// somewhat arbitrary buffer size for the device name
-#define NAME_SIZE 100
-
 // graph file name - assume we are running in this directory: ncsdk/examples/caffe/GoogLeNet/cpp
 #define GRAPH_FILE_NAME "../graph"
 
 // image file name - assume we are running in this directory: ncsdk/examples/caffe/GoogLeNet/cpp
 #define IMAGE_FILE_NAME "../../../data/images/nps_electric_guitar.png"
 
-
-// 16 bits.  will use this to store half precision floats since C++ has no 
-// built in support for it.
-typedef unsigned short half;
-
 // GoogleNet image dimensions, network mean values for each channel in BGR order.
 const int networkDim = 227;
 float networkMean[] = {0.40787054*255.0, 0.45752458*255.0, 0.48109378*255.0};
@@ -74,12 +64,11 @@ void *LoadFile(const char *path, unsigned int *length)
 }
 
 
-half *LoadImage(const char *path, int reqsize, float *mean)
+float *LoadImage(const char *path, int reqsize, float *mean, unsigned int* imageSize)
 {
        int width, height, cp, i;
        unsigned char *img, *imgresized;
        float *imgfp32;
-       half *imgfp16;
 
        img = stbi_load(path, &width, &height, &cp, 3);
        if(!img)
@@ -96,7 +85,8 @@ half *LoadImage(const char *path, int reqsize, float *mean)
        }
        stbir_resize_uint8(img, width, height, 0, imgresized, reqsize, reqsize, 0, 3);
        free(img);
-       imgfp32 = (float*) malloc(sizeof(*imgfp32) * reqsize * reqsize * 3);
+    *imageSize = sizeof(*imgfp32) * reqsize * reqsize * 3;
+       imgfp32 = (float*) malloc(*imageSize);
        if(!imgfp32)
        {
                free(imgresized);
@@ -106,48 +96,41 @@ half *LoadImage(const char *path, int reqsize, float *mean)
        for(i = 0; i < reqsize * reqsize * 3; i++)
                imgfp32[i] = imgresized[i];
        free(imgresized);
-       imgfp16 = (half*) malloc(sizeof(*imgfp16) * reqsize * reqsize * 3);
-       if(!imgfp16)
-       {
-               free(imgfp32);
-               perror("malloc");
-               return 0;
-       }
        for(i = 0; i < reqsize*reqsize; i++)
        {
                float blue, green, red;
-                blue = imgfp32[3*i+2];
-                green = imgfp32[3*i+1];
-                red = imgfp32[3*i+0];
+               blue = imgfp32[3*i+2];
+               green = imgfp32[3*i+1];
+               red = imgfp32[3*i+0];
 
-                imgfp32[3*i+0] = blue-mean[0];
-                imgfp32[3*i+1] = green-mean[1]; 
-                imgfp32[3*i+2] = red-mean[2];
+               imgfp32[3*i+0] = blue-mean[0];
+               imgfp32[3*i+1] = green-mean[1];
+               imgfp32[3*i+2] = red-mean[2];
 
-                // uncomment to see what values are getting passed to mvncLoadTensor() before conversion to half float
-                //printf("Blue: %f, Grean: %f,  Red: %f \n", imgfp32[3*i+0], imgfp32[3*i+1], imgfp32[3*i+2]);
+               // uncomment to see what values are getting passed to mvncLoadTensor() before conversion to half float
+               //printf("Blue: %f, Grean: %f,  Red: %f \n", imgfp32[3*i+0], imgfp32[3*i+1], imgfp32[3*i+2]);
        }
-       floattofp16((unsigned char *)imgfp16, imgfp32, 3*reqsize*reqsize);
-       free(imgfp32);
-       return imgfp16;
+       return imgfp32;
 }
 
 
 int main(int argc, char** argv)
 {
-    mvncStatus retCode;
-    void *deviceHandle;
-    char devName[NAME_SIZE];
-    retCode = mvncGetDeviceName(0, devName, NAME_SIZE);
-    if (retCode != MVNC_OK)
-    {   // failed to get device name, maybe none plugged in.
-        printf("No NCS devices found\n");
+    struct ncDeviceHandle_t *deviceHandle;
+    int loglevel = 2;
+    ncStatus_t retCode = ncGlobalSetOption(NC_RW_LOG_LEVEL, &loglevel, sizeof(loglevel));
+    // Initialize device handle
+    retCode = ncDeviceCreate(0, &deviceHandle);
+    if(retCode != NC_OK)
+    {
+        printf("Error - No NCS devices found.\n");
+        printf("    ncStatus value: %d\n", retCode);
         exit(-1);
     }
-    
+
     // Try to open the NCS device via the device name
-    retCode = mvncOpenDevice(devName, &deviceHandle);
-    if (retCode != MVNC_OK)
+    retCode = ncDeviceOpen(deviceHandle);
+    if (retCode != NC_OK)
     {   // failed to open the device.  
         printf("Could not open NCS device\n");
         exit(-1);
@@ -158,16 +141,24 @@ int main(int argc, char** argv)
     printf("Successfully opened NCS device!\n");
 
     // Now read in a graph file
+    struct ncGraphHandle_t *graphHandle;
     unsigned int graphFileLen;
     void* graphFileBuf = LoadFile(GRAPH_FILE_NAME, &graphFileLen);
 
-    // allocate the graph
-    void* graphHandle;
-    retCode = mvncAllocateGraph(deviceHandle, &graphHandle, graphFileBuf, graphFileLen);
-    if (retCode != MVNC_OK)
+    // Init graph handle
+    retCode = ncGraphCreate("graph", &graphHandle);
+    if (retCode != NC_OK)
+    {
+        printf("Error - ncGraphCreate failed\n");
+        exit(-1);
+    }
+
+    // Send graph to device
+    retCode = ncGraphAllocate(deviceHandle, graphHandle, graphFileBuf, graphFileLen);
+    if (retCode != NC_OK)
     {   // error allocating graph
         printf("Could not allocate graph for file: %s\n", GRAPH_FILE_NAME); 
-        printf("Error from mvncAllocateGraph is: %d\n", retCode);
+        printf("Error from ncGraphAllocate is: %d\n", retCode);
     }
     else
     {   // successfully allocated graph.  Now graphHandle is ready to go.  
@@ -175,64 +166,133 @@ int main(int argc, char** argv)
         // when done with it.
         printf("Successfully allocated graph for %s\n", GRAPH_FILE_NAME);
 
+        // Read tensor descriptors
+        struct ncTensorDescriptor_t inputTensorDesc;
+        struct ncTensorDescriptor_t outputTensorDesc;
+        unsigned int length = sizeof(struct ncTensorDescriptor_t);
+        ncGraphGetOption(graphHandle, NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS, &inputTensorDesc,  &length);
+        ncGraphGetOption(graphHandle, NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS, &outputTensorDesc,  &length);
+        int dataTypeSize = outputTensorDesc.totalSize/(outputTensorDesc.w* outputTensorDesc.h*outputTensorDesc.c*outputTensorDesc.n);
+
+        // Init & Create Fifos
+        struct ncFifoHandle_t * bufferIn;
+        struct ncFifoHandle_t * bufferOut;
+        retCode = ncFifoCreate("FifoIn0", NC_FIFO_HOST_WO, &bufferIn);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Input Fifo Initialization failed!");
+            exit(-1);
+        }
+        retCode = ncFifoAllocate(bufferIn, deviceHandle, &inputTensorDesc, 2);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Input Fifo allocation failed!");
+            exit(-1);
+        }
+        retCode = ncFifoCreate("FifoOut0", NC_FIFO_HOST_RO, &bufferOut);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Output Fifo Initialization failed!");
+            exit(-1);
+        }
+        retCode = ncFifoAllocate(bufferOut, deviceHandle, &outputTensorDesc, 2);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Output Fifo allocation failed!");
+            exit(-1);
+        }
+
         // LoadImage will read image from disk, convert channels to floats
-        // subtract network mean for each value in each channel.  Then, convert 
-        // floats to half precision floats and return pointer to the buffer 
-        // of half precision floats (Fp16s)
-        half* imageBufFp16 = LoadImage(IMAGE_FILE_NAME, networkDim, networkMean);
-        
-        // calculate the length of the buffer that contains the half precision floats.
-        // 3 channels * width * height * sizeof a 16bit float 
-        unsigned int lenBufFp16 = 3*networkDim*networkDim*sizeof(*imageBufFp16);
-
-        // start the inference with mvncLoadTensor()
-        retCode = mvncLoadTensor(graphHandle, imageBufFp16, lenBufFp16, NULL);
-        if (retCode != MVNC_OK)
-        {   // error loading tensor
-            printf("Could not load tensor\n");
-            printf("Error from mvncLoadTensor is: %d\n", retCode);
+        // subtract network mean for each value in each channel.
+        unsigned int imageSize;
+        float* image = LoadImage(IMAGE_FILE_NAME, networkDim, networkMean, &imageSize);
+
+        // Write tensor to input fifo
+        retCode = ncFifoWriteElem(bufferIn, image, &imageSize, 0);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to write element to Fifo!");
+            exit(-1);
         }
         else
         {   // the inference has been started, now call mvncGetResult() for the
-            // inference result 
+            // inference result
             printf("Successfully loaded the tensor for image %s\n", IMAGE_FILE_NAME);
-            
-            void* resultData16;
-            void* userParam;
-            unsigned int lenResultData;
-            retCode = mvncGetResult(graphHandle, &resultData16, &lenResultData, &userParam);
-            if (retCode == MVNC_OK)
+
+            // queue inference
+            retCode = ncGraphQueueInference(graphHandle, &bufferIn, 1, &bufferOut, 1);
+            if (retCode != NC_OK)
+            {
+                printf("Error - Failed to queue Inference!");
+                exit(-1);
+            }
+            free(image);
+            // Read output results
+            unsigned int outputDataLength;
+            length = sizeof(unsigned int);
+            retCode = ncFifoGetOption(bufferOut, NC_RO_FIFO_ELEMENT_DATA_SIZE, &outputDataLength, &length);
+            if (retCode || length != sizeof(unsigned int)){
+                printf("ncFifoGetOption failed, rc=%d\n", retCode);
+                exit(-1);
+            }
+            void *result = malloc(outputDataLength);
+            if (!result) {
+                printf("malloc failed!\n");
+                exit(-1);
+            }
+            void *userParam;
+            retCode = ncFifoReadElem(bufferOut, result, &outputDataLength, &userParam);
+            if (retCode != NC_OK)
+            {
+                printf("Error - Read Inference result failed!");
+                exit(-1);
+            }
+            else
             {   // Successfully got the result.  The inference result is in the buffer pointed to by resultData
                 printf("Successfully got the inference result for image %s\n", IMAGE_FILE_NAME);
-                printf("resultData is %d bytes which is %d 16-bit floats.\n", lenResultData, lenResultData/(int)sizeof(half));
-                
-                // convert half precision floats to full floats
-                int numResults = lenResultData / sizeof(half);
-                float* resultData32;
-               resultData32 = (float*)malloc(numResults * sizeof(*resultData32));
-                fp16tofloat(resultData32, (unsigned char*)resultData16, numResults);
+                unsigned int numResults =  outputDataLength / sizeof(float);
+                printf("resultData length is %d \n", numResults);
+                float *fresult = (float*) result;
 
                 float maxResult = 0.0;
                 int maxIndex = -1;
                 for (int index = 0; index < numResults; index++)
                 {
                     // printf("Category %d is: %f\n", index, resultData32[index]);
-                    if (resultData32[index] > maxResult)
+                    if (fresult[index] > maxResult)
                     {
-                        maxResult = resultData32[index];
+                        maxResult = fresult[index];
                         maxIndex = index;
                     }
                 }
                 printf("Index of top result is: %d\n", maxIndex);
-                printf("Probability of top result is: %f\n", resultData32[maxIndex]);
-            } 
+                printf("Probability of top result is: %f\n", fresult[maxIndex]);
+            }
+            free(result);
         }
 
-        retCode = mvncDeallocateGraph(graphHandle);
-       graphHandle = NULL;
+        retCode = ncGraphDestroy(&graphHandle);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to deallocate graph!");
+            exit(-1);
+        }
+        retCode = ncFifoDestroy(&bufferOut);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to deallocate fifo!");
+            exit(-1);
+        }
+        retCode = ncFifoDestroy(&bufferIn);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to deallocate fifo!");
+            exit(-1);
+        }
+        graphHandle = NULL;
     }
 
-    free(graphFileBuf);    
-    retCode = mvncCloseDevice(deviceHandle);
+    free(graphFileBuf);
+    retCode = ncDeviceClose(deviceHandle);
     deviceHandle = NULL;
 }
old mode 100644 (file)
new mode 100755 (executable)
index e948803..d993c95
@@ -1,6 +1,6 @@
 #! /usr/bin/env python3
 
-# Copyright 2017 Intel Corporation. 
+# Copyright 2018 Intel Corporation.
 # The source code, information and material ("Material") contained herein is  
 # owned by Intel Corporation or its suppliers or licensors, and title to such  
 # Material remains with Intel Corporation or its suppliers or licensors.  
@@ -16,7 +16,7 @@
 # Any license under such intellectual property rights must be express and  
 # approved by Intel in writing. 
 
-from mvnc import mvncapi as mvnc
+from mvnc import mvncapi as mvnc 
 import sys
 import numpy
 import cv2
@@ -37,12 +37,12 @@ labels=numpy.loadtxt(labels_file,str,delimiter='\t')
 # ***************************************************************
 # configure the NCS
 # ***************************************************************
-mvnc.SetGlobalOption(mvnc.GlobalOption.LOG_LEVEL, 2)
+mvnc.global_set_option(mvnc.GlobalOption.RW_LOG_LEVEL, 2)
 
 # ***************************************************************
 # Get a list of ALL the sticks that are plugged in
 # ***************************************************************
-devices = mvnc.EnumerateDevices()
+devices = mvnc.enumerate_devices()
 if len(devices) == 0:
        print('No devices found')
        quit()
@@ -55,7 +55,7 @@ device = mvnc.Device(devices[0])
 # ***************************************************************
 # Open the NCS
 # ***************************************************************
-device.OpenDevice()
+device.open()
 
 network_blob='graph'
 
@@ -63,7 +63,8 @@ network_blob='graph'
 with open(network_blob, mode='rb') as f:
        blob = f.read()
 
-graph = device.AllocateGraph(blob)
+graph = mvnc.Graph('graph')
+graph.allocate(device, blob)
 
 # ***************************************************************
 # Load the image
@@ -76,15 +77,27 @@ img[:,:,0] = (img[:,:,0] - ilsvrc_mean[0])
 img[:,:,1] = (img[:,:,1] - ilsvrc_mean[1])
 img[:,:,2] = (img[:,:,2] - ilsvrc_mean[2])
 
+# ***************************************************************
+# Initialize Fifos
+# ***************************************************************
+fifoIn = mvnc.Fifo("fifoIn0", mvnc.FifoType.HOST_WO)
+fifoOut = mvnc.Fifo("fifoOut0", mvnc.FifoType.HOST_RO)
+
+descIn = graph.get_option(mvnc.GraphOption.RO_INPUT_TENSOR_DESCRIPTORS)
+descOut = graph.get_option(mvnc.GraphOption.RO_OUTPUT_TENSOR_DESCRIPTORS)
+
+fifoIn.allocate(device, descIn[0], 2)
+fifoOut.allocate(device, descOut[0], 2)
+
 # ***************************************************************
 # Send the image to the NCS
 # ***************************************************************
-graph.LoadTensor(img.astype(numpy.float16), 'user object')
+graph.queue_inference_with_fifo_elem(fifoIn, fifoOut, img, 'user object')
 
 # ***************************************************************
 # Get the result from the NCS
 # ***************************************************************
-output, userobj = graph.GetResult()
+output, userobj = fifoOut.read_elem()
 
 # ***************************************************************
 # Print the results of the inference form the NCS
@@ -98,8 +111,10 @@ for i in range(0,5):
 # ***************************************************************
 # Clean up the graph and the device
 # ***************************************************************
-graph.DeallocateGraph()
-device.CloseDevice()
+fifoIn.destroy()
+fifoOut.destroy()
+graph.destroy()
+device.close()
     
 
 
index 8b0b9184be81b077cbf18290a13da729215a9215..c1c97f5469fc87bdde2fcd658f0f0347cd5186a5 100644 (file)
@@ -97,9 +97,9 @@ run_py: compile
        ./run.py
 
 .PHONY:        cpp
-cpp: cpp/run.cpp cpp/fp16.c
+cpp: cpp/run.cpp
        @echo "\nmaking cpp"
-       g++ cpp/run.cpp cpp/fp16.c -o cpp/run_cpp -lmvnc
+       g++ cpp/run.cpp -o cpp/run_cpp -lmvnc
 
 .PHONY: run_cpp
 run_cpp: compile cpp
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/examples/caffe/GoogLeNet/cpp/fp16.c b/examples/caffe/GoogLeNet/cpp/fp16.c
deleted file mode 100644 (file)
index cfb1d68..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-#include "fp16.h"
-
-// Copied from Numpy
-
-static unsigned half2float(unsigned short h)
-{
-    unsigned short h_exp, h_sig;
-    unsigned f_sgn, f_exp, f_sig;
-
-    h_exp = (h&0x7c00u);
-    f_sgn = ((unsigned)h&0x8000u) << 16;
-    switch (h_exp) {
-        case 0x0000u: /* 0 or subnormal */
-            h_sig = (h&0x03ffu);
-            /* Signed zero */
-            if (h_sig == 0) {
-                return f_sgn;
-            }
-            /* Subnormal */
-            h_sig <<= 1;
-            while ((h_sig&0x0400u) == 0) {
-                h_sig <<= 1;
-                h_exp++;
-            }
-            f_exp = ((unsigned)(127 - 15 - h_exp)) << 23;
-            f_sig = ((unsigned)(h_sig&0x03ffu)) << 13;
-            return f_sgn + f_exp + f_sig;
-        case 0x7c00u: /* inf or NaN */
-            /* All-ones exponent and a copy of the significand */
-            return f_sgn + 0x7f800000u + (((unsigned)(h&0x03ffu)) << 13);
-        default: /* normalized */
-            /* Just need to adjust the exponent and shift */
-            return f_sgn + (((unsigned)(h&0x7fffu) + 0x1c000u) << 13);
-    }
-}
-
-unsigned short float2half(unsigned f)
-{
-    unsigned f_exp, f_sig;
-    unsigned short h_sgn, h_exp, h_sig;
-
-    h_sgn = (unsigned short) ((f&0x80000000u) >> 16);
-    f_exp = (f&0x7f800000u);
-
-    /* Exponent overflow/NaN converts to signed inf/NaN */
-    if (f_exp >= 0x47800000u) {
-        if (f_exp == 0x7f800000u) {
-            /* Inf or NaN */
-            f_sig = (f&0x007fffffu);
-            if (f_sig != 0) {
-                /* NaN - propagate the flag in the significand... */
-                unsigned short ret = (unsigned short) (0x7c00u + (f_sig >> 13));
-                /* ...but make sure it stays a NaN */
-                if (ret == 0x7c00u) {
-                    ret++;
-                }
-                return h_sgn + ret;
-            } else {
-                /* signed inf */
-                return (unsigned short) (h_sgn + 0x7c00u);
-            }
-        } else {
-            /* overflow to signed inf */
-#if NPY_HALF_GENERATE_OVERFLOW
-            npy_set_floatstatus_overflow();
-#endif
-            return (unsigned short) (h_sgn + 0x7c00u);
-        }
-    }
-
-    /* Exponent underflow converts to a subnormal half or signed zero */
-    if (f_exp <= 0x38000000u) {
-        /*
-         * Signed zeros, subnormal floats, and floats with small
-         * exponents all convert to signed zero halfs.
-         */
-        if (f_exp < 0x33000000u) {
-#if NPY_HALF_GENERATE_UNDERFLOW
-            /* If f != 0, it underflowed to 0 */
-            if ((f&0x7fffffff) != 0) {
-                npy_set_floatstatus_underflow();
-            }
-#endif
-            return h_sgn;
-        }
-        /* Make the subnormal significand */
-        f_exp >>= 23;
-        f_sig = (0x00800000u + (f&0x007fffffu));
-#if NPY_HALF_GENERATE_UNDERFLOW
-        /* If it's not exactly represented, it underflowed */
-        if ((f_sig&(((unsigned)1 << (126 - f_exp)) - 1)) != 0) {
-            npy_set_floatstatus_underflow();
-        }
-#endif
-        f_sig >>= (113 - f_exp);
-        /* Handle rounding by adding 1 to the bit beyond half precision */
-#if NPY_HALF_ROUND_TIES_TO_EVEN
-        /*
-         * If the last bit in the half significand is 0 (already even), and
-         * the remaining bit pattern is 1000...0, then we do not add one
-         * to the bit after the half significand.  In all other cases, we do.
-         */
-        if ((f_sig&0x00003fffu) != 0x00001000u) {
-            f_sig += 0x00001000u;
-        }
-#else
-        f_sig += 0x00001000u;
-#endif
-        h_sig = (unsigned short) (f_sig >> 13);
-        /*
-         * If the rounding causes a bit to spill into h_exp, it will
-         * increment h_exp from zero to one and h_sig will be zero.
-         * This is the correct result.
-         */
-        return (unsigned short) (h_sgn + h_sig);
-    }
-
-    /* Regular case with no overflow or underflow */
-    h_exp = (unsigned short) ((f_exp - 0x38000000u) >> 13);
-    /* Handle rounding by adding 1 to the bit beyond half precision */
-    f_sig = (f&0x007fffffu);
-#if NPY_HALF_ROUND_TIES_TO_EVEN
-    /*
-     * If the last bit in the half significand is 0 (already even), and
-     * the remaining bit pattern is 1000...0, then we do not add one
-     * to the bit after the half significand.  In all other cases, we do.
-     */
-    if ((f_sig&0x00003fffu) != 0x00001000u) {
-        f_sig += 0x00001000u;
-    }
-#else
-    f_sig += 0x00001000u;
-#endif
-    h_sig = (unsigned short) (f_sig >> 13);
-    /*
-     * If the rounding causes a bit to spill into h_exp, it will
-     * increment h_exp by one and h_sig will be zero.  This is the
-     * correct result.  h_exp may increment to 15, at greatest, in
-     * which case the result overflows to a signed inf.
-     */
-#if NPY_HALF_GENERATE_OVERFLOW
-    h_sig += h_exp;
-    if (h_sig == 0x7c00u) {
-        npy_set_floatstatus_overflow();
-    }
-    return h_sgn + h_sig;
-#else
-    return h_sgn + h_exp + h_sig;
-#endif
-}
-
-void floattofp16(unsigned char *dst, float *src, unsigned nelem)
-{
-       unsigned i;
-       unsigned short *_dst = (unsigned short *)dst;
-       unsigned *_src = (unsigned *)src;
-       
-       for(i = 0; i < nelem; i++)
-               _dst[i] = float2half(_src[i]);
-}
-
-void fp16tofloat(float *dst, unsigned char *src, unsigned nelem)
-{
-       unsigned i;
-       unsigned *_dst = (unsigned *)dst;
-       unsigned short *_src = (unsigned short *)src;
-       
-       for(i = 0; i < nelem; i++)
-               _dst[i] = half2float(_src[i]);
-}
-
diff --git a/examples/caffe/GoogLeNet/cpp/fp16.h b/examples/caffe/GoogLeNet/cpp/fp16.h
deleted file mode 100644 (file)
index 50f19ce..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copied from Numpy
-
-
-static unsigned half2float(unsigned short h);
-unsigned short float2half(unsigned f);
-void floattofp16(unsigned char *dst, float *src, unsigned nelem);
-void fp16tofloat(float *dst, unsigned char *src, unsigned nelem);
-
-
index 62b23cd9900fc31a5dd35d245e8c8f847c637266..d864450a849417ba2456c0cd3349453747b0fda5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2017 Intel Corporation. 
+// Copyright 2018 Intel Corporation.
 // The source code, information and material ("Material") contained herein is  
 // owned by Intel Corporation or its suppliers or licensors, and title to such  
 // Material remains with Intel Corporation or its suppliers or licensors.  
 #define STB_IMAGE_RESIZE_IMPLEMENTATION
 #include "stb_image_resize.h"
 
-#include "fp16.h"
 #include <mvnc.h>
 
-
-// somewhat arbitrary buffer size for the device name
-#define NAME_SIZE 100
-
 // graph file name - assume we are running in this directory: ncsdk/examples/caffe/GoogLeNet/cpp
 #define GRAPH_FILE_NAME "../graph"
 
 // image file name - assume we are running in this directory: ncsdk/examples/caffe/GoogLeNet/cpp
 #define IMAGE_FILE_NAME "../../../data/images/nps_electric_guitar.png"
 
-
-// 16 bits.  will use this to store half precision floats since C++ has no 
-// built in support for it.
-typedef unsigned short half;
-
 // GoogleNet image dimensions, network mean values for each channel in BGR order.
 const int networkDim = 224;
 float networkMean[] = {0.40787054*255.0, 0.45752458*255.0, 0.48109378*255.0};
@@ -74,12 +64,11 @@ void *LoadFile(const char *path, unsigned int *length)
 }
 
 
-half *LoadImage(const char *path, int reqsize, float *mean)
+float *LoadImage(const char *path, int reqsize, float *mean, unsigned int* imageSize)
 {
        int width, height, cp, i;
        unsigned char *img, *imgresized;
        float *imgfp32;
-       half *imgfp16;
 
        img = stbi_load(path, &width, &height, &cp, 3);
        if(!img)
@@ -96,7 +85,8 @@ half *LoadImage(const char *path, int reqsize, float *mean)
        }
        stbir_resize_uint8(img, width, height, 0, imgresized, reqsize, reqsize, 0, 3);
        free(img);
-       imgfp32 = (float*) malloc(sizeof(*imgfp32) * reqsize * reqsize * 3);
+    *imageSize = sizeof(*imgfp32) * reqsize * reqsize * 3;
+       imgfp32 = (float*) malloc(*imageSize);
        if(!imgfp32)
        {
                free(imgresized);
@@ -106,48 +96,42 @@ half *LoadImage(const char *path, int reqsize, float *mean)
        for(i = 0; i < reqsize * reqsize * 3; i++)
                imgfp32[i] = imgresized[i];
        free(imgresized);
-       imgfp16 = (half*) malloc(sizeof(*imgfp16) * reqsize * reqsize * 3);
-       if(!imgfp16)
-       {
-               free(imgfp32);
-               perror("malloc");
-               return 0;
-       }
        for(i = 0; i < reqsize*reqsize; i++)
        {
                float blue, green, red;
-                blue = imgfp32[3*i+2];
-                green = imgfp32[3*i+1];
-                red = imgfp32[3*i+0];
+               blue = imgfp32[3*i+2];
+               green = imgfp32[3*i+1];
+               red = imgfp32[3*i+0];
 
-                imgfp32[3*i+0] = blue-mean[0];
-                imgfp32[3*i+1] = green-mean[1]; 
-                imgfp32[3*i+2] = red-mean[2];
+               imgfp32[3*i+0] = blue-mean[0];
+               imgfp32[3*i+1] = green-mean[1];
+               imgfp32[3*i+2] = red-mean[2];
 
-                // uncomment to see what values are getting passed to mvncLoadTensor() before conversion to half float
-                //printf("Blue: %f, Grean: %f,  Red: %f \n", imgfp32[3*i+0], imgfp32[3*i+1], imgfp32[3*i+2]);
+               // uncomment to see what values are getting passed to mvncLoadTensor() before conversion to half float
+               //printf("Blue: %f, Grean: %f,  Red: %f \n", imgfp32[3*i+0], imgfp32[3*i+1], imgfp32[3*i+2]);
        }
-       floattofp16((unsigned char *)imgfp16, imgfp32, 3*reqsize*reqsize);
-       free(imgfp32);
-       return imgfp16;
+       return imgfp32;
 }
 
 
 int main(int argc, char** argv)
 {
-    mvncStatus retCode;
-    void *deviceHandle;
-    char devName[NAME_SIZE];
-    retCode = mvncGetDeviceName(0, devName, NAME_SIZE);
-    if (retCode != MVNC_OK)
-    {   // failed to get device name, maybe none plugged in.
-        printf("No NCS devices found\n");
+    struct ncDeviceHandle_t *deviceHandle;
+    int loglevel = 2;
+    ncStatus_t retCode = ncGlobalSetOption(NC_RW_LOG_LEVEL, &loglevel, sizeof(loglevel));
+
+    // Initialize device handle
+    retCode = ncDeviceCreate(0, &deviceHandle);
+    if(retCode != NC_OK)
+    {
+        printf("Error - No NCS devices found.\n");
+        printf("    ncStatus value: %d\n", retCode);
         exit(-1);
     }
-    
+
     // Try to open the NCS device via the device name
-    retCode = mvncOpenDevice(devName, &deviceHandle);
-    if (retCode != MVNC_OK)
+    retCode = ncDeviceOpen(deviceHandle);
+    if (retCode != NC_OK)
     {   // failed to open the device.  
         printf("Could not open NCS device\n");
         exit(-1);
@@ -158,16 +142,24 @@ int main(int argc, char** argv)
     printf("Successfully opened NCS device!\n");
 
     // Now read in a graph file
+    struct ncGraphHandle_t *graphHandle;
     unsigned int graphFileLen;
     void* graphFileBuf = LoadFile(GRAPH_FILE_NAME, &graphFileLen);
 
-    // allocate the graph
-    void* graphHandle;
-    retCode = mvncAllocateGraph(deviceHandle, &graphHandle, graphFileBuf, graphFileLen);
-    if (retCode != MVNC_OK)
+    // Init graph handle
+    retCode = ncGraphCreate("graph", &graphHandle);
+    if (retCode != NC_OK)
+    {
+        printf("Error - ncGraphCreate failed\n");
+        exit(-1);
+    }
+
+    // Send graph to device
+    retCode = ncGraphAllocate(deviceHandle, graphHandle, graphFileBuf, graphFileLen);
+    if (retCode != NC_OK)
     {   // error allocating graph
         printf("Could not allocate graph for file: %s\n", GRAPH_FILE_NAME); 
-        printf("Error from mvncAllocateGraph is: %d\n", retCode);
+        printf("Error from ncGraphAllocate is: %d\n", retCode);
     }
     else
     {   // successfully allocated graph.  Now graphHandle is ready to go.  
@@ -175,64 +167,134 @@ int main(int argc, char** argv)
         // when done with it.
         printf("Successfully allocated graph for %s\n", GRAPH_FILE_NAME);
 
+        // Read tensor descriptors
+        struct ncTensorDescriptor_t inputTensorDesc;
+        struct ncTensorDescriptor_t outputTensorDesc;
+        unsigned int length = sizeof(struct ncTensorDescriptor_t);
+        ncGraphGetOption(graphHandle, NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS, &inputTensorDesc,  &length);
+        ncGraphGetOption(graphHandle, NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS, &outputTensorDesc,  &length);
+        int dataTypeSize = outputTensorDesc.totalSize/(outputTensorDesc.w* outputTensorDesc.h*outputTensorDesc.c*outputTensorDesc.n);
+        //printf("output data type size %d \n", dataTypeSize);
+
+        // Init & Create Fifos
+        struct ncFifoHandle_t * bufferIn;
+        struct ncFifoHandle_t * bufferOut;
+        retCode = ncFifoCreate("FifoIn0",NC_FIFO_HOST_WO, &bufferIn);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Input Fifo Initialization failed!");
+            exit(-1);
+        }
+        retCode = ncFifoAllocate(bufferIn, deviceHandle, &inputTensorDesc, 2);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Input Fifo allocation failed!");
+            exit(-1);
+        }
+        retCode = ncFifoCreate("FifoOut0",NC_FIFO_HOST_RO, &bufferOut);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Output Fifo Initialization failed!");
+            exit(-1);
+        }
+        retCode = ncFifoAllocate(bufferOut, deviceHandle, &outputTensorDesc, 2);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Output Fifo allocation failed!");
+            exit(-1);
+        }
+
         // LoadImage will read image from disk, convert channels to floats
-        // subtract network mean for each value in each channel.  Then, convert 
-        // floats to half precision floats and return pointer to the buffer 
-        // of half precision floats (Fp16s)
-        half* imageBufFp16 = LoadImage(IMAGE_FILE_NAME, networkDim, networkMean);
-        
-        // calculate the length of the buffer that contains the half precision floats.
-        // 3 channels * width * height * sizeof a 16bit float 
-        unsigned int lenBufFp16 = 3*networkDim*networkDim*sizeof(*imageBufFp16);
-
-        // start the inference with mvncLoadTensor()
-        retCode = mvncLoadTensor(graphHandle, imageBufFp16, lenBufFp16, NULL);
-        if (retCode != MVNC_OK)
-        {   // error loading tensor
-            printf("Could not load tensor\n");
-            printf("Error from mvncLoadTensor is: %d\n", retCode);
+        // subtract network mean for each value in each channel.
+        unsigned int imageSize;
+        float* image = LoadImage(IMAGE_FILE_NAME, networkDim, networkMean, &imageSize);
+
+        // Write tensor to input fifo
+        retCode = ncFifoWriteElem(bufferIn, image, &imageSize, 0);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to write element to Fifo!\n");
+            exit(-1);
         }
         else
         {   // the inference has been started, now call mvncGetResult() for the
-            // inference result 
+            // inference result
             printf("Successfully loaded the tensor for image %s\n", IMAGE_FILE_NAME);
-            
-            void* resultData16;
-            void* userParam;
-            unsigned int lenResultData;
-            retCode = mvncGetResult(graphHandle, &resultData16, &lenResultData, &userParam);
-            if (retCode == MVNC_OK)
+
+            // queue inference
+            retCode = ncGraphQueueInference(graphHandle, &bufferIn, 1, &bufferOut, 1);
+            if (retCode != NC_OK)
+            {
+                printf("Error - Failed to queue Inference!");
+                exit(-1);
+            }
+            free(image);
+            // Read output results
+            unsigned int outputDataLength;
+            length = sizeof(unsigned int);
+            retCode = ncFifoGetOption(bufferOut, NC_RO_FIFO_ELEMENT_DATA_SIZE, &outputDataLength, &length);
+            if (retCode || length != sizeof(unsigned int)){
+                printf("ncFifoGetOption failed, rc=%d\n", retCode);
+                exit(-1);
+            }
+            void *result = malloc(outputDataLength);
+            if (!result) {
+                printf("malloc failed!\n");
+                exit(-1);
+            }
+            void *userParam;
+            retCode = ncFifoReadElem(bufferOut, result, &outputDataLength, &userParam);
+            if (retCode != NC_OK)
+            {
+                printf("Error - Read Inference result failed!");
+                exit(-1);
+            }
+            else
             {   // Successfully got the result.  The inference result is in the buffer pointed to by resultData
                 printf("Successfully got the inference result for image %s\n", IMAGE_FILE_NAME);
-                printf("resultData is %d bytes which is %d 16-bit floats.\n", lenResultData, lenResultData/(int)sizeof(half));
-                
-                // convert half precision floats to full floats
-                int numResults = lenResultData / sizeof(half);
-                float* resultData32;
-               resultData32 = (float*)malloc(numResults * sizeof(*resultData32));
-                fp16tofloat(resultData32, (unsigned char*)resultData16, numResults);
+                unsigned int numResults =  outputDataLength / sizeof(float);
+                printf("resultData length is %d \n", numResults);
+                float *fresult = (float*) result;
 
                 float maxResult = 0.0;
                 int maxIndex = -1;
                 for (int index = 0; index < numResults; index++)
                 {
                     // printf("Category %d is: %f\n", index, resultData32[index]);
-                    if (resultData32[index] > maxResult)
+                    if (fresult[index] > maxResult)
                     {
-                        maxResult = resultData32[index];
+                        maxResult = fresult[index];
                         maxIndex = index;
                     }
                 }
                 printf("Index of top result is: %d\n", maxIndex);
-                printf("Probability of top result is: %f\n", resultData32[maxIndex]);
-            } 
+                printf("Probability of top result is: %f\n", fresult[maxIndex]);
+            }
+            free(result);
         }
 
-        retCode = mvncDeallocateGraph(graphHandle);
-       graphHandle = NULL;
+        retCode = ncGraphDestroy(&graphHandle);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to deallocate graph!");
+            exit(-1);
+        }
+        retCode = ncFifoDestroy(&bufferOut);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to deallocate fifo!");
+            exit(-1);
+        }
+        retCode = ncFifoDestroy(&bufferIn);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to deallocate fifo!");
+            exit(-1);
+        }
+        graphHandle = NULL;
     }
 
-    free(graphFileBuf);    
-    retCode = mvncCloseDevice(deviceHandle);
+    free(graphFileBuf);
+    retCode = ncDeviceClose(deviceHandle);
     deviceHandle = NULL;
 }
old mode 100644 (file)
new mode 100755 (executable)
index b61a3f0..33387ea
@@ -1,6 +1,6 @@
 #! /usr/bin/env python3
 
-# Copyright 2017 Intel Corporation. 
+# Copyright 2018 Intel Corporation.
 # The source code, information and material ("Material") contained herein is  
 # owned by Intel Corporation or its suppliers or licensors, and title to such  
 # Material remains with Intel Corporation or its suppliers or licensors.  
@@ -37,12 +37,12 @@ labels=numpy.loadtxt(labels_file,str,delimiter='\t')
 # ***************************************************************
 # configure the NCS
 # ***************************************************************
-mvnc.SetGlobalOption(mvnc.GlobalOption.LOG_LEVEL, 2)
+mvnc.global_set_option(mvnc.GlobalOption.RW_LOG_LEVEL, 2)
 
 # ***************************************************************
 # Get a list of ALL the sticks that are plugged in
 # ***************************************************************
-devices = mvnc.EnumerateDevices()
+devices = mvnc.enumerate_devices()
 if len(devices) == 0:
        print('No devices found')
        quit()
@@ -55,7 +55,7 @@ device = mvnc.Device(devices[0])
 # ***************************************************************
 # Open the NCS
 # ***************************************************************
-device.OpenDevice()
+device.open()
 
 network_blob='graph'
 
@@ -63,7 +63,8 @@ network_blob='graph'
 with open(network_blob, mode='rb') as f:
        blob = f.read()
 
-graph = device.AllocateGraph(blob)
+graph = mvnc.Graph('graph')
+fifoIn, fifoOut = graph.allocate_with_fifos(device, blob)
 
 # ***************************************************************
 # Load the image
@@ -79,12 +80,12 @@ img[:,:,2] = (img[:,:,2] - ilsvrc_mean[2])
 # ***************************************************************
 # Send the image to the NCS
 # ***************************************************************
-graph.LoadTensor(img.astype(numpy.float16), 'user object')
+graph.queue_inference_with_fifo_elem(fifoIn, fifoOut, img, 'user object')
 
 # ***************************************************************
 # Get the result from the NCS
 # ***************************************************************
-output, userobj = graph.GetResult()
+output, userobj = fifoOut.read_elem()
 
 # ***************************************************************
 # Print the results of the inference form the NCS
@@ -98,8 +99,10 @@ for i in range(0,5):
 # ***************************************************************
 # Clean up the graph and the device
 # ***************************************************************
-graph.DeallocateGraph()
-device.CloseDevice()
+fifoIn.destroy()
+fifoOut.destroy()
+graph.destroy()
+device.close()
     
 
 
index 9bb8bf112a55855de80676ecc3dfe01a1a42cab8..4574e0eb0ef3ff4e631679cf6aa90ffea53b7e26 100644 (file)
@@ -5,13 +5,13 @@ endif
 
 TOPTARGETS := all clean check compile profile run
 
-SUBDIRS := $(wildcard */.)
+EXAMPLES := AlexNet GoogLeNet SqueezeNet
 
-$(TOPTARGETS): $(SUBDIRS)
-$(SUBDIRS):
+$(TOPTARGETS): $(EXAMPLES)
+$(EXAMPLES):
        $(MAKE) -C $@ $(MAKECMDGOALS)
 
-.PHONY: $(TOPTARGETS) $(SUBDIRS)
+.PHONY: $(TOPTARGETS) $(EXAMPLES)
 
 .PHONY: help
 help:
index 4d42b16144c4738705a778215db1d47624f0baeb..637978f068b224b85973fb816867026fb5e56702 100644 (file)
@@ -105,9 +105,9 @@ run_py: compile
        ./run.py
 
 .PHONY:        cpp
-cpp: cpp/run.cpp cpp/fp16.c
+cpp: cpp/run.cpp
        @echo "\nmaking cpp"
-       g++ cpp/run.cpp cpp/fp16.c -o cpp/run_cpp -lmvnc
+       g++ cpp/run.cpp -o cpp/run_cpp -lmvnc
 
 .PHONY: run_cpp
 run_cpp: compile cpp
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/examples/caffe/SqueezeNet/cpp/fp16.c b/examples/caffe/SqueezeNet/cpp/fp16.c
deleted file mode 100644 (file)
index cfb1d68..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-#include "fp16.h"
-
-// Copied from Numpy
-
-static unsigned half2float(unsigned short h)
-{
-    unsigned short h_exp, h_sig;
-    unsigned f_sgn, f_exp, f_sig;
-
-    h_exp = (h&0x7c00u);
-    f_sgn = ((unsigned)h&0x8000u) << 16;
-    switch (h_exp) {
-        case 0x0000u: /* 0 or subnormal */
-            h_sig = (h&0x03ffu);
-            /* Signed zero */
-            if (h_sig == 0) {
-                return f_sgn;
-            }
-            /* Subnormal */
-            h_sig <<= 1;
-            while ((h_sig&0x0400u) == 0) {
-                h_sig <<= 1;
-                h_exp++;
-            }
-            f_exp = ((unsigned)(127 - 15 - h_exp)) << 23;
-            f_sig = ((unsigned)(h_sig&0x03ffu)) << 13;
-            return f_sgn + f_exp + f_sig;
-        case 0x7c00u: /* inf or NaN */
-            /* All-ones exponent and a copy of the significand */
-            return f_sgn + 0x7f800000u + (((unsigned)(h&0x03ffu)) << 13);
-        default: /* normalized */
-            /* Just need to adjust the exponent and shift */
-            return f_sgn + (((unsigned)(h&0x7fffu) + 0x1c000u) << 13);
-    }
-}
-
-unsigned short float2half(unsigned f)
-{
-    unsigned f_exp, f_sig;
-    unsigned short h_sgn, h_exp, h_sig;
-
-    h_sgn = (unsigned short) ((f&0x80000000u) >> 16);
-    f_exp = (f&0x7f800000u);
-
-    /* Exponent overflow/NaN converts to signed inf/NaN */
-    if (f_exp >= 0x47800000u) {
-        if (f_exp == 0x7f800000u) {
-            /* Inf or NaN */
-            f_sig = (f&0x007fffffu);
-            if (f_sig != 0) {
-                /* NaN - propagate the flag in the significand... */
-                unsigned short ret = (unsigned short) (0x7c00u + (f_sig >> 13));
-                /* ...but make sure it stays a NaN */
-                if (ret == 0x7c00u) {
-                    ret++;
-                }
-                return h_sgn + ret;
-            } else {
-                /* signed inf */
-                return (unsigned short) (h_sgn + 0x7c00u);
-            }
-        } else {
-            /* overflow to signed inf */
-#if NPY_HALF_GENERATE_OVERFLOW
-            npy_set_floatstatus_overflow();
-#endif
-            return (unsigned short) (h_sgn + 0x7c00u);
-        }
-    }
-
-    /* Exponent underflow converts to a subnormal half or signed zero */
-    if (f_exp <= 0x38000000u) {
-        /*
-         * Signed zeros, subnormal floats, and floats with small
-         * exponents all convert to signed zero halfs.
-         */
-        if (f_exp < 0x33000000u) {
-#if NPY_HALF_GENERATE_UNDERFLOW
-            /* If f != 0, it underflowed to 0 */
-            if ((f&0x7fffffff) != 0) {
-                npy_set_floatstatus_underflow();
-            }
-#endif
-            return h_sgn;
-        }
-        /* Make the subnormal significand */
-        f_exp >>= 23;
-        f_sig = (0x00800000u + (f&0x007fffffu));
-#if NPY_HALF_GENERATE_UNDERFLOW
-        /* If it's not exactly represented, it underflowed */
-        if ((f_sig&(((unsigned)1 << (126 - f_exp)) - 1)) != 0) {
-            npy_set_floatstatus_underflow();
-        }
-#endif
-        f_sig >>= (113 - f_exp);
-        /* Handle rounding by adding 1 to the bit beyond half precision */
-#if NPY_HALF_ROUND_TIES_TO_EVEN
-        /*
-         * If the last bit in the half significand is 0 (already even), and
-         * the remaining bit pattern is 1000...0, then we do not add one
-         * to the bit after the half significand.  In all other cases, we do.
-         */
-        if ((f_sig&0x00003fffu) != 0x00001000u) {
-            f_sig += 0x00001000u;
-        }
-#else
-        f_sig += 0x00001000u;
-#endif
-        h_sig = (unsigned short) (f_sig >> 13);
-        /*
-         * If the rounding causes a bit to spill into h_exp, it will
-         * increment h_exp from zero to one and h_sig will be zero.
-         * This is the correct result.
-         */
-        return (unsigned short) (h_sgn + h_sig);
-    }
-
-    /* Regular case with no overflow or underflow */
-    h_exp = (unsigned short) ((f_exp - 0x38000000u) >> 13);
-    /* Handle rounding by adding 1 to the bit beyond half precision */
-    f_sig = (f&0x007fffffu);
-#if NPY_HALF_ROUND_TIES_TO_EVEN
-    /*
-     * If the last bit in the half significand is 0 (already even), and
-     * the remaining bit pattern is 1000...0, then we do not add one
-     * to the bit after the half significand.  In all other cases, we do.
-     */
-    if ((f_sig&0x00003fffu) != 0x00001000u) {
-        f_sig += 0x00001000u;
-    }
-#else
-    f_sig += 0x00001000u;
-#endif
-    h_sig = (unsigned short) (f_sig >> 13);
-    /*
-     * If the rounding causes a bit to spill into h_exp, it will
-     * increment h_exp by one and h_sig will be zero.  This is the
-     * correct result.  h_exp may increment to 15, at greatest, in
-     * which case the result overflows to a signed inf.
-     */
-#if NPY_HALF_GENERATE_OVERFLOW
-    h_sig += h_exp;
-    if (h_sig == 0x7c00u) {
-        npy_set_floatstatus_overflow();
-    }
-    return h_sgn + h_sig;
-#else
-    return h_sgn + h_exp + h_sig;
-#endif
-}
-
-void floattofp16(unsigned char *dst, float *src, unsigned nelem)
-{
-       unsigned i;
-       unsigned short *_dst = (unsigned short *)dst;
-       unsigned *_src = (unsigned *)src;
-       
-       for(i = 0; i < nelem; i++)
-               _dst[i] = float2half(_src[i]);
-}
-
-void fp16tofloat(float *dst, unsigned char *src, unsigned nelem)
-{
-       unsigned i;
-       unsigned *_dst = (unsigned *)dst;
-       unsigned short *_src = (unsigned short *)src;
-       
-       for(i = 0; i < nelem; i++)
-               _dst[i] = half2float(_src[i]);
-}
-
diff --git a/examples/caffe/SqueezeNet/cpp/fp16.h b/examples/caffe/SqueezeNet/cpp/fp16.h
deleted file mode 100644 (file)
index 50f19ce..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copied from Numpy
-
-
-static unsigned half2float(unsigned short h);
-unsigned short float2half(unsigned f);
-void floattofp16(unsigned char *dst, float *src, unsigned nelem);
-void fp16tofloat(float *dst, unsigned char *src, unsigned nelem);
-
-
index 16fddc9fc5812af6e8e7dce124bc9b3f726653d0..a269f2d1222a3ac5d74ffac1ba77d394411bbeae 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2017 Intel Corporation. 
+// Copyright 2018 Intel Corporation.
 // The source code, information and material ("Material") contained herein is  
 // owned by Intel Corporation or its suppliers or licensors, and title to such  
 // Material remains with Intel Corporation or its suppliers or licensors.  
 #define STB_IMAGE_RESIZE_IMPLEMENTATION
 #include "stb_image_resize.h"
 
-#include "fp16.h"
 #include <mvnc.h>
 
-
-// somewhat arbitrary buffer size for the device name
-#define NAME_SIZE 100
-
 // graph file name - assume we are running in this directory: ncsdk/examples/caffe/GoogLeNet/cpp
 #define GRAPH_FILE_NAME "../graph"
 
 // image file name - assume we are running in this directory: ncsdk/examples/caffe/GoogLeNet/cpp
 #define IMAGE_FILE_NAME "../../../data/images/nps_electric_guitar.png"
 
-
-// 16 bits.  will use this to store half precision floats since C++ has no 
-// built in support for it.
-typedef unsigned short half;
-
 // GoogleNet image dimensions, network mean values for each channel in BGR order.
 const int networkDim = 227;
 float networkMean[] = {0.40787054*255.0, 0.45752458*255.0, 0.48109378*255.0};
@@ -74,12 +64,11 @@ void *LoadFile(const char *path, unsigned int *length)
 }
 
 
-half *LoadImage(const char *path, int reqsize, float *mean)
+float *LoadImage(const char *path, int reqsize, float *mean, unsigned int* imageSize)
 {
        int width, height, cp, i;
        unsigned char *img, *imgresized;
        float *imgfp32;
-       half *imgfp16;
 
        img = stbi_load(path, &width, &height, &cp, 3);
        if(!img)
@@ -96,7 +85,8 @@ half *LoadImage(const char *path, int reqsize, float *mean)
        }
        stbir_resize_uint8(img, width, height, 0, imgresized, reqsize, reqsize, 0, 3);
        free(img);
-       imgfp32 = (float*) malloc(sizeof(*imgfp32) * reqsize * reqsize * 3);
+    *imageSize = sizeof(*imgfp32) * reqsize * reqsize * 3;
+       imgfp32 = (float*) malloc(*imageSize);
        if(!imgfp32)
        {
                free(imgresized);
@@ -106,48 +96,41 @@ half *LoadImage(const char *path, int reqsize, float *mean)
        for(i = 0; i < reqsize * reqsize * 3; i++)
                imgfp32[i] = imgresized[i];
        free(imgresized);
-       imgfp16 = (half*) malloc(sizeof(*imgfp16) * reqsize * reqsize * 3);
-       if(!imgfp16)
-       {
-               free(imgfp32);
-               perror("malloc");
-               return 0;
-       }
        for(i = 0; i < reqsize*reqsize; i++)
        {
                float blue, green, red;
-                blue = imgfp32[3*i+2];
-                green = imgfp32[3*i+1];
-                red = imgfp32[3*i+0];
+               blue = imgfp32[3*i+2];
+               green = imgfp32[3*i+1];
+               red = imgfp32[3*i+0];
 
-                imgfp32[3*i+0] = blue-mean[0];
-                imgfp32[3*i+1] = green-mean[1]; 
-                imgfp32[3*i+2] = red-mean[2];
+               imgfp32[3*i+0] = blue-mean[0];
+               imgfp32[3*i+1] = green-mean[1];
+               imgfp32[3*i+2] = red-mean[2];
 
-                // uncomment to see what values are getting passed to mvncLoadTensor() before conversion to half float
-                //printf("Blue: %f, Grean: %f,  Red: %f \n", imgfp32[3*i+0], imgfp32[3*i+1], imgfp32[3*i+2]);
+               // uncomment to see what values are getting passed to mvncLoadTensor() before conversion to half float
+               //printf("Blue: %f, Grean: %f,  Red: %f \n", imgfp32[3*i+0], imgfp32[3*i+1], imgfp32[3*i+2]);
        }
-       floattofp16((unsigned char *)imgfp16, imgfp32, 3*reqsize*reqsize);
-       free(imgfp32);
-       return imgfp16;
+       return imgfp32;
 }
 
 
 int main(int argc, char** argv)
 {
-    mvncStatus retCode;
-    void *deviceHandle;
-    char devName[NAME_SIZE];
-    retCode = mvncGetDeviceName(0, devName, NAME_SIZE);
-    if (retCode != MVNC_OK)
-    {   // failed to get device name, maybe none plugged in.
-        printf("No NCS devices found\n");
+    struct ncDeviceHandle_t *deviceHandle;
+    int loglevel = 2;
+    ncStatus_t retCode = ncGlobalSetOption(NC_RW_LOG_LEVEL, &loglevel, sizeof(loglevel));
+    // Initialize device handle
+    retCode = ncDeviceCreate(0, &deviceHandle);
+    if(retCode != NC_OK)
+    {
+        printf("Error - No NCS devices found.\n");
+        printf("    ncStatus value: %d\n", retCode);
         exit(-1);
     }
-    
+
     // Try to open the NCS device via the device name
-    retCode = mvncOpenDevice(devName, &deviceHandle);
-    if (retCode != MVNC_OK)
+    retCode = ncDeviceOpen(deviceHandle);
+    if (retCode != NC_OK)
     {   // failed to open the device.  
         printf("Could not open NCS device\n");
         exit(-1);
@@ -158,16 +141,24 @@ int main(int argc, char** argv)
     printf("Successfully opened NCS device!\n");
 
     // Now read in a graph file
+    struct ncGraphHandle_t *graphHandle;
     unsigned int graphFileLen;
     void* graphFileBuf = LoadFile(GRAPH_FILE_NAME, &graphFileLen);
 
-    // allocate the graph
-    void* graphHandle;
-    retCode = mvncAllocateGraph(deviceHandle, &graphHandle, graphFileBuf, graphFileLen);
-    if (retCode != MVNC_OK)
+    // Init graph handle
+    retCode = ncGraphCreate("graph", &graphHandle);
+    if (retCode != NC_OK)
+    {
+        printf("Error - ncGraphCreate failed\n");
+        exit(-1);
+    }
+
+    // Send graph to device
+    retCode = ncGraphAllocate(deviceHandle, graphHandle, graphFileBuf, graphFileLen);
+    if (retCode != NC_OK)
     {   // error allocating graph
         printf("Could not allocate graph for file: %s\n", GRAPH_FILE_NAME); 
-        printf("Error from mvncAllocateGraph is: %d\n", retCode);
+        printf("Error from ncGraphAllocate is: %d\n", retCode);
     }
     else
     {   // successfully allocated graph.  Now graphHandle is ready to go.  
@@ -175,64 +166,133 @@ int main(int argc, char** argv)
         // when done with it.
         printf("Successfully allocated graph for %s\n", GRAPH_FILE_NAME);
 
+        // Read tensor descriptors
+        struct ncTensorDescriptor_t inputTensorDesc;
+        struct ncTensorDescriptor_t outputTensorDesc;
+        unsigned int length = sizeof(struct ncTensorDescriptor_t);
+        ncGraphGetOption(graphHandle, NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS, &inputTensorDesc,  &length);
+        ncGraphGetOption(graphHandle, NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS, &outputTensorDesc,  &length);
+        int dataTypeSize = outputTensorDesc.totalSize/(outputTensorDesc.w* outputTensorDesc.h*outputTensorDesc.c*outputTensorDesc.n);
+
+        // Init & Create Fifos
+        struct ncFifoHandle_t * bufferIn;
+        struct ncFifoHandle_t * bufferOut;
+        retCode = ncFifoCreate("FifoIn0", NC_FIFO_HOST_WO, &bufferIn);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Input Fifo Initialization failed!");
+            exit(-1);
+        }
+        retCode = ncFifoAllocate(bufferIn, deviceHandle, &inputTensorDesc, 2);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Input Fifo allocation failed!");
+            exit(-1);
+        }
+        retCode = ncFifoCreate("FifoOut0", NC_FIFO_HOST_RO, &bufferOut);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Output Fifo Initialization failed!");
+            exit(-1);
+        }
+        retCode = ncFifoAllocate(bufferOut, deviceHandle, &outputTensorDesc, 2);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Output Fifo allocation failed!");
+            exit(-1);
+        }
+
         // LoadImage will read image from disk, convert channels to floats
-        // subtract network mean for each value in each channel.  Then, convert 
-        // floats to half precision floats and return pointer to the buffer 
-        // of half precision floats (Fp16s)
-        half* imageBufFp16 = LoadImage(IMAGE_FILE_NAME, networkDim, networkMean);
-        
-        // calculate the length of the buffer that contains the half precision floats.
-        // 3 channels * width * height * sizeof a 16bit float 
-        unsigned int lenBufFp16 = 3*networkDim*networkDim*sizeof(*imageBufFp16);
-
-        // start the inference with mvncLoadTensor()
-        retCode = mvncLoadTensor(graphHandle, imageBufFp16, lenBufFp16, NULL);
-        if (retCode != MVNC_OK)
-        {   // error loading tensor
-            printf("Could not load tensor\n");
-            printf("Error from mvncLoadTensor is: %d\n", retCode);
+        // subtract network mean for each value in each channel.
+        unsigned int imageSize;
+        float* image = LoadImage(IMAGE_FILE_NAME, networkDim, networkMean, &imageSize);
+
+        // Write tensor to input fifo
+        retCode = ncFifoWriteElem(bufferIn, image, &imageSize, 0);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to write element to Fifo!");
+            exit(-1);
         }
         else
         {   // the inference has been started, now call mvncGetResult() for the
-            // inference result 
+            // inference result
             printf("Successfully loaded the tensor for image %s\n", IMAGE_FILE_NAME);
-            
-            void* resultData16;
-            void* userParam;
-            unsigned int lenResultData;
-            retCode = mvncGetResult(graphHandle, &resultData16, &lenResultData, &userParam);
-            if (retCode == MVNC_OK)
+
+            // queue inference
+            retCode = ncGraphQueueInference(graphHandle, &bufferIn, 1, &bufferOut, 1);
+            if (retCode != NC_OK)
+            {
+                printf("Error - Failed to queue Inference!");
+                exit(-1);
+            }
+            free(image);
+            // Read output results
+            unsigned int outputDataLength;
+            length = sizeof(unsigned int);
+            retCode = ncFifoGetOption(bufferOut, NC_RO_FIFO_ELEMENT_DATA_SIZE, &outputDataLength, &length);
+            if (retCode || length != sizeof(unsigned int)){
+                printf("ncFifoGetOption failed, rc=%d\n", retCode);
+                exit(-1);
+            }
+            void *result = malloc(outputDataLength);
+            if (!result) {
+                printf("malloc failed!\n");
+                exit(-1);
+            }
+            void *userParam;
+            retCode = ncFifoReadElem(bufferOut, result, &outputDataLength, &userParam);
+            if (retCode != NC_OK)
+            {
+                printf("Error - Read Inference result failed!");
+                exit(-1);
+            }
+            else
             {   // Successfully got the result.  The inference result is in the buffer pointed to by resultData
                 printf("Successfully got the inference result for image %s\n", IMAGE_FILE_NAME);
-                printf("resultData is %d bytes which is %d 16-bit floats.\n", lenResultData, lenResultData/(int)sizeof(half));
-                
-                // convert half precision floats to full floats
-                int numResults = lenResultData / sizeof(half);
-                float* resultData32;
-               resultData32 = (float*)malloc(numResults * sizeof(*resultData32));
-                fp16tofloat(resultData32, (unsigned char*)resultData16, numResults);
+                unsigned int numResults =  outputDataLength / sizeof(float);
+                printf("resultData length is %d \n", numResults);
+                float *fresult = (float*) result;
 
                 float maxResult = 0.0;
                 int maxIndex = -1;
                 for (int index = 0; index < numResults; index++)
                 {
                     // printf("Category %d is: %f\n", index, resultData32[index]);
-                    if (resultData32[index] > maxResult)
+                    if (fresult[index] > maxResult)
                     {
-                        maxResult = resultData32[index];
+                        maxResult = fresult[index];
                         maxIndex = index;
                     }
                 }
                 printf("Index of top result is: %d\n", maxIndex);
-                printf("Probability of top result is: %f\n", resultData32[maxIndex]);
-            } 
+                printf("Probability of top result is: %f\n", fresult[maxIndex]);
+            }
+            free(result);
         }
 
-        retCode = mvncDeallocateGraph(graphHandle);
-       graphHandle = NULL;
+        retCode = ncGraphDestroy(&graphHandle);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to deallocate graph!");
+            exit(-1);
+        }
+        retCode = ncFifoDestroy(&bufferOut);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to deallocate fifo!");
+            exit(-1);
+        }
+        retCode = ncFifoDestroy(&bufferIn);
+        if (retCode != NC_OK)
+        {
+            printf("Error - Failed to deallocate fifo!");
+            exit(-1);
+        }
+        graphHandle = NULL;
     }
 
-    free(graphFileBuf);    
-    retCode = mvncCloseDevice(deviceHandle);
+    free(graphFileBuf);
+    retCode = ncDeviceClose(deviceHandle);
     deviceHandle = NULL;
 }
old mode 100644 (file)
new mode 100755 (executable)
index 9e61940..37ceac6
@@ -1,6 +1,6 @@
 #! /usr/bin/env python3
 
-# Copyright 2017 Intel Corporation. 
+# Copyright 2018 Intel Corporation.
 # The source code, information and material ("Material") contained herein is  
 # owned by Intel Corporation or its suppliers or licensors, and title to such  
 # Material remains with Intel Corporation or its suppliers or licensors.  
@@ -37,12 +37,12 @@ labels=numpy.loadtxt(labels_file,str,delimiter='\t')
 # ***************************************************************
 # configure the NCS
 # ***************************************************************
-mvnc.SetGlobalOption(mvnc.GlobalOption.LOG_LEVEL, 2)
+mvnc.global_set_option(mvnc.GlobalOption.RW_LOG_LEVEL, 2)
 
 # ***************************************************************
 # Get a list of ALL the sticks that are plugged in
 # ***************************************************************
-devices = mvnc.EnumerateDevices()
+devices = mvnc.enumerate_devices()
 if len(devices) == 0:
        print('No devices found')
        quit()
@@ -55,7 +55,7 @@ device = mvnc.Device(devices[0])
 # ***************************************************************
 # Open the NCS
 # ***************************************************************
-device.OpenDevice()
+device.open()
 
 network_blob='graph'
 
@@ -63,7 +63,8 @@ network_blob='graph'
 with open(network_blob, mode='rb') as f:
        blob = f.read()
 
-graph = device.AllocateGraph(blob)
+graph = mvnc.Graph('graph')
+fifoIn, fifoOut = graph.allocate_with_fifos(device, blob)
 
 # ***************************************************************
 # Load the image
@@ -79,12 +80,12 @@ img[:,:,2] = (img[:,:,2] - ilsvrc_mean[2])
 # ***************************************************************
 # Send the image to the NCS
 # ***************************************************************
-graph.LoadTensor(img.astype(numpy.float16), 'user object')
+graph.queue_inference_with_fifo_elem(fifoIn, fifoOut, img, 'user object')
 
 # ***************************************************************
 # Get the result from the NCS
 # ***************************************************************
-output, userobj = graph.GetResult()
+output, userobj = fifoOut.read_elem()
 
 # ***************************************************************
 # Print the results of the inference form the NCS
@@ -98,8 +99,10 @@ for i in range(0,5):
 # ***************************************************************
 # Clean up the graph and the device
 # ***************************************************************
-graph.DeallocateGraph()
-device.CloseDevice()
+fifoIn.destroy()
+fifoOut.destroy()
+graph.destroy()
+device.close()
     
 
 
diff --git a/examples/tensorflow/inception_v1/graph b/examples/tensorflow/inception_v1/graph
deleted file mode 100644 (file)
index e5d5ae4..0000000
Binary files a/examples/tensorflow/inception_v1/graph and /dev/null differ
old mode 100644 (file)
new mode 100755 (executable)
index 30afa69..a902f73
@@ -1,6 +1,6 @@
 #! /usr/bin/env python3
 
-# Copyright 2017 Intel Corporation. 
+# Copyright 2018 Intel Corporation.
 # The source code, information and material ("Material") contained herein is  
 # owned by Intel Corporation or its suppliers or licensors, and title to such  
 # Material remains with Intel Corporation or its suppliers or licensors.  
@@ -26,18 +26,18 @@ path_to_images = '../../data/images/'
 graph_filename = 'graph'
 image_filename = path_to_images + 'nps_electric_guitar.png'
 
-#mvnc.SetGlobalOption(mvnc.GlobalOption.LOGLEVEL, 2)
-devices = mvnc.EnumerateDevices()
+#mvnc.global_set_option(mvnc.GlobalOption.RW_LOG_LEVEL, 2)
+devices = mvnc.enumerate_devices()
 if len(devices) == 0:
     print('No devices found')
     quit()
 
 device = mvnc.Device(devices[0])
-device.OpenDevice()
+device.open()
 
 #Load graph
 with open(path_to_networks + graph_filename, mode='rb') as f:
-    graphfile = f.read()
+    graphFileBuff = f.read()
 
 #Load preprocessing data
 mean = 128 
@@ -57,7 +57,8 @@ with open(path_to_networks + 'categories.txt', 'r') as f:
 with open(path_to_networks + 'inputsize.txt', 'r') as f:
     reqsize = int(f.readline().split('\n')[0])
 
-graph = device.AllocateGraph(graphfile)
+graph = mvnc.Graph('graph')
+fifoIn, fifoOut = graph.allocate_with_fifos(device, graphFileBuff)
 
 img = cv2.imread(image_filename).astype(numpy.float32)
 
@@ -76,8 +77,8 @@ for i in range(3):
     img[:,:,i] = (img[:,:,i] - mean) * std
 
 print('Start download to NCS...')
-graph.LoadTensor(img.astype(numpy.float16), 'user object')
-output, userobj = graph.GetResult()
+graph.queue_inference_with_fifo_elem(fifoIn, fifoOut, img, 'user object')
+output, userobj = fifoOut.read_elem()
 
 top_inds = output.argsort()[::-1][:5]
 
@@ -88,6 +89,8 @@ for i in range(5):
     print(top_inds[i], categories[top_inds[i]], output[top_inds[i]])
 
 print(''.join(['*' for i in range(79)]))
-graph.DeallocateGraph()
-device.CloseDevice()
+fifoIn.destroy()
+fifoOut.destroy()
+graph.destroy()
+device.close()
 print('Finished')
index bde24c4549dbf4572389211a107920dc344ad7d4..5872dc1be5098916144b3902b23221f1237c8bce 100644 (file)
@@ -29,11 +29,11 @@ prereqs:
 
 .PHONY: profile
 profile: weights
-       ${NCPROFILE} -s 12 ${MODEL_FILENAME} ${INPUT_NODE_FLAG} ${OUTPUT_NODE_FLAG}
+       ${NCPROFILE} -s 4 ${MODEL_FILENAME} ${INPUT_NODE_FLAG} ${OUTPUT_NODE_FLAG}
 
 .PHONY: browse_profile
 browse_profile: weights
-       ${NCPROFILE} -s 12 ${MODEL_FILENAME} ${INPUT_NODE_FLAG} ${OUTPUT_NODE_FLAG}
+       ${NCPROFILE} -s 4 ${MODEL_FILENAME} ${INPUT_NODE_FLAG} ${OUTPUT_NODE_FLAG}
        firefox output_report.html &
 
 .PHONY: weights
@@ -44,11 +44,11 @@ weights:
 
 .PHONY: compile
 compile: weights
-       test -f graph || ${NCCOMPILE} -s 12 ${MODEL_FILENAME} ${INPUT_NODE_FLAG} ${OUTPUT_NODE_FLAG}
+       test -f graph || ${NCCOMPILE} -s 4 ${MODEL_FILENAME} ${INPUT_NODE_FLAG} ${OUTPUT_NODE_FLAG}
 
 .PHONY: check
 check: weights
-       -${NCCHECK} -s 12 ${MODEL_FILENAME} ${INPUT_NODE_FLAG} ${OUTPUT_NODE_FLAG} -i ../../data/images/cat.jpg -id 917 -M 128 -S 2 -cs 0,1,2 -metric top1
+       -${NCCHECK} -s 4 ${MODEL_FILENAME} ${INPUT_NODE_FLAG} ${OUTPUT_NODE_FLAG} -i ../../data/images/cat.jpg -id 917 -M 128 -S 2 -cs 0,1,2 -metric top1
 
 .PHONY: run
 run: compile
diff --git a/examples/tensorflow/inception_v3/graph b/examples/tensorflow/inception_v3/graph
deleted file mode 100644 (file)
index 3e8ead8..0000000
Binary files a/examples/tensorflow/inception_v3/graph and /dev/null differ
old mode 100644 (file)
new mode 100755 (executable)
index 7154f04..42c186b
@@ -8,16 +8,16 @@ from tensorflow.contrib.slim.nets import inception
 slim = tf.contrib.slim
 
 def run(name, image_size, num_classes):
-    with tf.Graph().as_default():
-      image = tf.placeholder("float", [1, image_size, image_size, 3], name="input")
-      with slim.arg_scope(inception.inception_v3_arg_scope()):
-          logits, _ = inception.inception_v3(image, num_classes, is_training=False, spatial_squeeze=False)
-      probabilities = tf.nn.softmax(logits)
-      init_fn = slim.assign_from_checkpoint_fn('inception_v3.ckpt', slim.get_model_variables('InceptionV3'))
+  with tf.Graph().as_default():
+    image = tf.placeholder("float", [1, image_size, image_size, 3], name="input")
+    with slim.arg_scope(inception.inception_v3_arg_scope()):
+        logits, _ = inception.inception_v3(image, num_classes, is_training=False, spatial_squeeze=False)
+    probabilities = tf.nn.softmax(logits)
+    init_fn = slim.assign_from_checkpoint_fn('inception_v3.ckpt', slim.get_model_variables('InceptionV3'))
 
-      with tf.Session() as sess:
-          init_fn(sess)
-          saver = tf.train.Saver(tf.global_variables())
-          saver.save(sess, "output/"+name)
+    with tf.Session() as sess:
+        init_fn(sess)
+        saver = tf.train.Saver(tf.global_variables())
+        saver.save(sess, "output/"+name)
 
 run('inception-v3', 299, 1001)
old mode 100644 (file)
new mode 100755 (executable)
index 56758b2..9a10a48
@@ -1,6 +1,6 @@
 #! /usr/bin/env python3
 
-# Copyright 2017 Intel Corporation. 
+# Copyright 2018 Intel Corporation.
 # The source code, information and material ("Material") contained herein is  
 # owned by Intel Corporation or its suppliers or licensors, and title to such  
 # Material remains with Intel Corporation or its suppliers or licensors.  
@@ -26,18 +26,18 @@ path_to_images = '../../data/images/'
 graph_filename = 'graph'
 image_filename = path_to_images + 'nps_electric_guitar.png'
 
-#mvnc.SetGlobalOption(mvnc.GlobalOption.LOGLEVEL, 2)
-devices = mvnc.EnumerateDevices()
+#mvnc.global_set_option(mvnc.GlobalOption.RW_LOG_LEVEL, 2)
+devices = mvnc.enumerate_devices()
 if len(devices) == 0:
     print('No devices found')
     quit()
 
 device = mvnc.Device(devices[0])
-device.OpenDevice()
+device.open()
 
 #Load graph
 with open(path_to_networks + graph_filename, mode='rb') as f:
-    graphfile = f.read()
+    graphFileBuff = f.read()
 
 #Load preprocessing data
 mean = 128
@@ -57,15 +57,18 @@ with open(path_to_networks + 'categories.txt', 'r') as f:
 with open(path_to_networks + 'inputsize.txt', 'r') as f:
     reqsize = int(f.readline().split('\n')[0])
 
-graph = device.AllocateGraph(graphfile)
+graph = mvnc.Graph('graph')
+fifoIn, fifoOut = graph.allocate_with_fifos(device, graphFileBuff)
 
 img = cv2.imread(image_filename).astype(numpy.float32)
+
 dx,dy,dz= img.shape
 delta=float(abs(dy-dx))
 if dx > dy: #crop the x dimension
     img=img[int(0.5*delta):dx-int(0.5*delta),0:dy]
 else:
     img=img[0:dx,int(0.5*delta):dy-int(0.5*delta)]
+
 img = cv2.resize(img, (reqsize, reqsize))
 
 img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
@@ -74,8 +77,8 @@ for i in range(3):
     img[:,:,i] = (img[:,:,i] - mean) * std
 
 print('Start download to NCS...')
-graph.LoadTensor(img.astype(numpy.float16), 'user object')
-output, userobj = graph.GetResult()
+graph.queue_inference_with_fifo_elem(fifoIn, fifoOut, img, 'user object')
+output, userobj = fifoOut.read_elem()
 
 top_inds = output.argsort()[::-1][:5]
 
@@ -86,6 +89,8 @@ for i in range(5):
     print(top_inds[i], categories[top_inds[i]], output[top_inds[i]])
 
 print(''.join(['*' for i in range(79)]))
-graph.DeallocateGraph()
-device.CloseDevice()
+fifoIn.destroy()
+fifoOut.destroy()
+graph.destroy()
+device.close()
 print('Finished')
diff --git a/extras/docker/Dockerfile b/extras/docker/Dockerfile
new file mode 100644 (file)
index 0000000..3cdf4a5
--- /dev/null
@@ -0,0 +1,20 @@
+FROM ubuntu:16.04
+
+# Install necessary packages for the installer
+RUN apt-get update && apt-get install -y --no-install-recommends \
+    build-essential \
+    sed \
+    sudo \
+    tar \
+    udev \
+    wget \
+    && apt-get clean
+
+# Copy over the NCSDK
+COPY ./ ncsdk/
+
+# Set the current working directory to the cloned ncsdk directory
+WORKDIR "/ncsdk"
+
+# Run the installer
+RUN make install
diff --git a/extras/docker/README.md b/extras/docker/README.md
new file mode 100644 (file)
index 0000000..7901c34
--- /dev/null
@@ -0,0 +1,27 @@
+# Introduction
+
+This Dockerfile can be used to easily build a Docker image that has the Intel® Movidius™ Neural Compute SDK installed on Ubuntu 16.04.
+
+## Build the image
+
+Use the following command to build the image:
+
+$ docker build -t ncsdk -f ./extras/docker/Dockerfile https://github.com/movidius/ncsdk.git#ncsdk2
+
+If you've already cloned the NCSDK, you can execute the following command from within the ncsdk directory instead:
+
+$ docker build -t ncsdk -f ./extras/docker/Dockerfile .
+
+This creates an image named "ncsdk".
+
+*Note: If you are running Docker behind a proxy you must configure proxy settings for Docker before you can build the image. See the NCSDK Docker documentation for more information.*
+
+## Run the container
+
+After the image is built, execute the following command to run the container that we named "ncsdk":
+
+$ docker run --net=host --privileged -v /dev:/dev --name ncsdk -i -t ncsdk /bin/bash
+
+## Additional Information
+
+See the full NCSDK documentation for Docker at https://movidius.github.io/ncsdk/ for more information.
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index ab293b0..85c8310
 #! /bin/bash
 
-#test for python already installed for opencv
-python3 -c "import cv2" > /dev/null 2>&1
-if [ $? -eq 0 ] ;
-then
-       echo "";
-       echo "OpenCV already setup for python";
-       echo "";
-       exit 0
-fi;
-
-## Install OpenCV
-if [[ `lsb_release -d` =~ .*Raspbian.* ]] 
-then 
-       echo ""
-       echo "************************ Please confirm *******************************"
-       echo " Installing OpenCV on Raspberry Pi may take a long time. "
-       echo " You may skip this part of the installation in which case some examples "
-       echo " may not work without modifications but the rest of the SDK will still "
-       echo " be functional. Select n to skip OpenCV installation or y to install it." 
-       read -p " Continue installing OpenCV (y/n) ? " CONTINUE
-       if [[ "$CONTINUE" == "y" || "$CONTINUE" == "Y" ]]; then
-               echo ""; 
-               echo "Installing OpenCV"; 
-               echo "";
-               sudo apt-get update -y && sudo apt-get upgrade -y
-               sudo apt-get install -y build-essential cmake pkg-config
-               sudo apt-get install -y libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
-               sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
-               sudo apt-get install -y libxvidcore-dev libx264-dev
-               sudo apt-get install -y libgtk2.0-dev libgtk-3-dev
-               sudo apt-get install -y libatlas-base-dev gfortran
-               sudo apt-get install -y python2.7-dev python3-dev
-
-               cd ~
-               wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.3.0.zip
-               unzip opencv.zip
-               wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.3.0.zip
-               unzip opencv_contrib.zip
-               cd ~/opencv-3.3.0/
-               mkdir build
-               cd build
-               cmake -D CMAKE_BUILD_TYPE=RELEASE \
-                     -D CMAKE_INSTALL_PREFIX=/usr/local \
-                     -D INSTALL_PYTHON_EXAMPLES=OFF \
-                     -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \
-                     -D BUILD_EXAMPLES=OFF ..
-               make
-               sudo make install
-               sudo ldconfig
-       else
-               echo "";
-               echo "Skipping OpenCV installation";
-               echo "";
-       fi
-else  
-       echo "Installing opencv python for non-Raspbian";
-       sudo -H pip3 install opencv-python
-       sudo -H pip3 install opencv-contrib-python
-fi
+
+# test if OpenCV already installed for python
+function test_opencv_installed()
+{
+    RC=0
+    python3 -c "import cv2" > /dev/null 2>&1 || RC=$?
+    if [ $RC -eq 0 ] ;
+    then
+        echo "";
+        echo "OpenCV already setup for python3";
+        echo "";
+        exit 0
+    fi;
+}
+
+
+# install_opencv - installs OpenCV
+function install_opencv()
+{
+    # install package lsb-release if application lsb_release isn't installed
+    APT_QUIET="-qq"
+    [ "${VERBOSE}" = "yes" ] && APT_QUIET=""
+    RC=0
+    command -v lsb_release > /dev/null || RC=$?
+    if [ $RC -ne 0 ] ; then
+        exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET update -y"
+        exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y lsb-release"
+    fi
+    
+    if [[ `lsb_release -d` =~ .*Raspbian.* ]] 
+    then 
+        echo ""
+        echo "************************ Please confirm *******************************"
+        echo " Installing OpenCV on Raspberry Pi may take a long time."
+        echo " You may skip this part of the installation in which case some examples "
+        echo " may not work without modifications but the rest of the SDK will still "
+        echo " be functional. Select n to skip OpenCV installation or y to install it." 
+        read -p " Continue installing OpenCV (y/n) ? " CONTINUE
+        if [[ "$CONTINUE" == "y" || "$CONTINUE" == "Y" ]]; then
+            echo ""; 
+            echo "Installing OpenCV"; 
+            echo "";
+            exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET update -y"
+            exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y build-essential cmake pkg-config"
+            exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev"
+            exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev"
+            exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y libxvidcore-dev libx264-dev"
+            exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y libgtk2.0-dev libgtk-3-dev"
+            exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y libatlas-base-dev gfortran"
+            exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y python2.7-dev python3-dev wget python3-pip"
+
+            cd $HOME
+            VERSION="3.3.0"
+            exec_and_search_errors "wget -O opencv.zip https://github.com/Itseez/opencv/archive/${VERSION}.zip"
+            ZIP_QUIET="-q"
+            [ "${VERBOSE}" = "yes" ] && ZIP_QUIET=""
+            unzip ${ZIP_QUIET} opencv.zip
+            exec_and_search_errors "wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/${VERSION}.zip"
+            unzip ${ZIP_QUIET} opencv_contrib.zip
+            cd ${HOME}/opencv-${VERSION}/
+            mkdir -p build
+            cd build
+            cmake -D CMAKE_BUILD_TYPE=RELEASE \
+                  -D CMAKE_INSTALL_PREFIX=/usr/local \
+                  -D INSTALL_PYTHON_EXAMPLES=OFF \
+                  -D OPENCV_EXTRA_MODULES_PATH=${HOME}/opencv_contrib-${VERSION}/modules \
+                  -D BUILD_DOCS=OFF \
+                  -D BUILD_PERF_TESTS=OFF \
+                  -D BUILD_TESTS=OFF \
+                  -D BUILD_EXAMPLES=OFF ..
+
+            # build and trap for errors in case we ran out of memory running make -j ${MAKE_NJOBS}
+            RC=0
+            make -j ${MAKE_NJOBS} || RC=$?
+            if [ $RC -ne 0 ] ; then
+                echo -e "${RED}  Running make -j ${MAKE_NJOBS} failed."
+                if [ ${MAKE_NJOBS} -gt 2 ] ; then
+                    echo "MAKE_NJOBS=${MAKE_NJOBS}, suggestion is to increase swap space and edit ncsdk.conf to uncomment #MAKE_NJOBS=1 and change to MAKE_NJOBS=2 or MAKE_NJOBS=1 and try again"
+                else
+                    if [ ${MAKE_NJOBS} -gt 1 ] ; then
+                        echo "MAKE_NJOBS=${MAKE_NJOBS}, suggestion is increase swap space and edit ncsdk.conf to uncomment #MAKE_NJOBS=1 and try again"
+                    else
+                        echo "MAKE_NJOBS=${MAKE_NJOBS}, suggestion is to increase swap space and try again"  
+                    fi
+                fi
+                echo -e "Error on line $LINENO.  Will exit${NC}"
+                exit 1
+            fi            
+
+            $SUDO_PREFIX make install
+            $SUDO_PREFIX ldconfig
+        else
+            echo "";
+            echo "Skipping OpenCV installation based on user input";
+            echo "";
+        fi
+    else  
+        echo "Installing opencv python for non-Raspbian";
+
+        # check if pip3 is available on the system via 'command'
+        RC=0
+        command -v pip3 > /dev/null || RC=$?
+        if [ $RC -ne 0 ] ; then
+            exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET update -y"
+            exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y python3-pip"
+        fi
+
+        PIP_QUIET=--quiet
+        [ "${VERBOSE}" = "yes" ] && PIP_QUIET=""
+        
+        exec_and_search_errors "$PIP_PREFIX pip3 install $PIP_QUIET opencv-python>=3.4.0.12"
+        exec_and_search_errors "$PIP_PREFIX pip3 install $PIP_QUIET opencv-contrib-python>=3.4.0.12"
+    fi
+}
+
+
+
+# main - this is the main function that runs the OpenCV install
+function main()
+{
+    echo "OpenCV Installation Starting"
+    
+    # Test if OpenCV is installed.  If OpenCV is already installed for python, script will exit 
+    test_opencv_installed
+
+    
+    ### initialization 
+    # read in functions shared by installer and uninstaller
+    source $(dirname "$0")/install-utilities.sh
+    # enable trapping for error (function is in install-utilities.sh)
+    set_error_handling
+    ### get constants (function is in install-utilities.sh)
+    initialize_constants
+    ### read config file (function is in install-utilities.sh) 
+    read_ncsdk_config
+    # (function is in install-utilities.sh)    
+    ask_sudo_permissions
+
+    
+    ### install opencv
+    install_opencv
+
+    echo "OpenCV Installation Finished"    
+}
+main
diff --git a/install-utilities.sh b/install-utilities.sh
new file mode 100644 (file)
index 0000000..e07acd7
--- /dev/null
@@ -0,0 +1,493 @@
+#!/bin/bash
+#
+# Movidius Neural Compute Toolkit install utilities
+# This file contains functions only sourced by install.sh and uninstall.sh.
+# This script cannot be executed directly.
+# 
+# Please provide feedback in our support forum if you encountered difficulties.
+################################################################################
+# require this script to be sourced and not executed directly - requires executing script name, $0,
+# isn't the script name which it would if executed (i.e. run), not sourced
+RC=0
+echo $0  | grep install-utilities.sh > /dev/null || RC=$?
+if [ ${RC} -eq 0 ] ; then
+    echo "USAGE:"
+    echo "This script shouldn't be executed/called directly, as it only contains functions to be called from install.sh and uninstall.sh"
+    echo "If you want to install, run 'make install' and if you want to uninstall, run 'make uninstall'"
+    echo "This script must be sourced.  Will exit 1"
+    exit 1
+fi
+
+
+# error_report - function that gets called if an error is detected
+function error_report()
+{
+    echo -e "${RED}Installation failed. Error on line $1${NC}"
+    exit 1
+}
+
+
+# set_error_handling - enable catching errors 
+function set_error_handling()
+{
+    ### set error handling
+    # -e Exit immediately if a command exits with a non-zero status.
+    # -u  Treat unset variables as an error when substituting.
+    set -e
+    set -u
+    # Enable ERR trap handling
+    trap 'error_report $LINENO' ERR
+    # If bash version >=3, use enhanced error trapping with pipefail and errtrace
+    [ "${BASH_VERSINFO:-0}" -ge 3 ] && set -o pipefail && set -o errtrace
+}
+
+
+# initialize_constants - initialize constants
+function initialize_constants()
+{
+    # avoid conflicts with PYTHONPATH during install
+    export PYTHONPATH=""
+    
+    # File used to find install location in case install dir doesn't match INSTALL_DIR
+    INSTALL_INFO_FILENAME=.ncsdk_install.info
+    # set colours 
+    RED='\e[31m'
+    GREEN='\e[32m'
+    YELLOW='\e[33m'
+    NC='\e[m'
+
+    # Directory NCSDK 1.x release will be moved to
+    NCSDK1_ARCHIVE_DIR=/opt/movidius/ncsdk1
+}
+
+
+# ask_sudo_permissions - 
+# Sets global variables: SUDO_PREFIX, PIP_PREFIX
+function ask_sudo_permissions()
+{
+    ### If the executing user is not root, ask for sudo priviledges
+    SUDO_PREFIX=""
+    PIP_PREFIX=""
+    if [ $EUID != 0 ]; then
+        SUDO_PREFIX="sudo"
+        sudo -v
+        if [ "${PIP_SYSTEM_INSTALL}" = "yes" ]; then
+            PIP_PREFIX="$SUDO_PREFIX -H -E"
+        fi
+        # Keep-alive: update existing sudo time stamp if set, otherwise do nothing.
+        while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
+    fi    
+}
+
+
+# read_ncsdk_config - reads user configuration file, ncsdk.conf
+# Sets global variables: INSTALL_DIR, INSTALL_CAFFE, CAFFE_FLAVOR, CAFFE_USE_CUDA, 
+#                        INSTALL_TENSORFLOW, INSTALL_TOOLKIT, PIP_SYSTEM_INSTALL, VERBOSE
+function read_ncsdk_config()
+{
+    # check if file exist
+    CONF_FILE=./ncsdk.conf
+    if [ ! -f ${CONF_FILE} ] ; then
+        echo -e "${RED}Couldn't find file CONF_FILE=${CONF_FILE}.  Will exit${NC}"
+        exit 1
+    fi
+
+    ### Set default values in case not they are not set in ncsdk.conf 
+    #  Any or all of these can be overridden by adding to ncsdk.conf
+    INSTALL_DIR=/opt/movidius
+    INSTALL_CAFFE=yes
+    CAFFE_FLAVOR=bvlc
+    CAFFE_USE_CUDA=no
+    INSTALL_TENSORFLOW=yes
+    INSTALL_TOOLKIT=yes
+    PIP_SYSTEM_INSTALL=yes
+    USE_VIRTUALENV=no
+    VERBOSE=no
+    # check if nproc is available on the system via 'command'
+    RC=0
+    command -v nproc > /dev/null || RC=$?
+    if [ $RC -eq 0 ] ; then
+        #  default to using all processors to invoke make with (make -j $MAKE_NJOBS)
+        MAKE_NJOBS=$(nproc)
+    else
+        # Can't find nproc, default to 1 make process. Can change in ncsdk.conf
+        MAKE_NJOBS=1
+    fi
+    
+    ### check configuration file, and discard any malformed lines
+    count=0
+    mal_count=0
+    while IFS='' read -r line || [[ -n "$line" ]]; do
+        count=$((count+1))
+        if ! [[ $line =~ ^[^=]*+=[^=]*+$ ]]; then
+            mal_count=$((mal_count+1))
+            echo "Malformed line at line no. $count.  Problem line=$line"
+        fi
+    done < ${CONF_FILE}
+
+    if [ "$mal_count" -gt "0" ]; then
+        echo -e "${RED}Found $mal_count errors in ${CONF_FILE}. Please fix before running install.${NC}"
+        exit 1
+    fi
+
+    ### Config file error check done, source it
+    echo "Reading installer configuration variables from $CONF_FILE"
+    source $CONF_FILE
+}
+
+
+# find_previous_install - Attempt to find previous installation, looks first in
+#                               ${INSTALL_DIR}, then searches all of /opt.
+# sets globals PREV_INSTALL_INFO, PREV_INSTALL_OWNER, PREV_INSTALL_DIR, PREV_NCSDK_VER
+#              PREV_NCSDK_PATH, PREV_NCS_BIN_PATH, PREV_NCS_LIB_PATH, PREV_NCS_INC_PATH
+function find_previous_install()
+{
+    echo ""
+    PREV_NCSDK_PATH="unknown"
+    PREV_NCS_BIN_PATH="unknown"
+    PREV_NCS_LIB_PATH="unknown"
+    PREV_NCS_INC_PATH="unknown"
+    # first look for prev install in INSTALL_DIR
+    PREV_INSTALL_INFO=${INSTALL_DIR}/${INSTALL_INFO_FILENAME}
+    if [ ! -f "${PREV_INSTALL_INFO}" ] ; then
+        # file INSTALL_INFO_FILENAME not found in ${INSTALL_DIR}, so search for it in /opt via find
+        PREV_INSTALL_INFO="unknown"
+        if [ -d /opt ] ; then
+            PREV_INSTALL_INFO=`$SUDO_PREFIX find /opt -name $INSTALL_INFO_FILENAME -print 2> /dev/null`
+            if [ ! -f "${PREV_INSTALL_INFO}" ] ; then
+                PREV_INSTALL_INFO="unknown"
+            fi
+        fi
+    fi
+    if [ -f "${PREV_INSTALL_INFO}" ] ; then
+        PREV_INSTALL_OWNER=$(ls -l $PREV_INSTALL_INFO | awk '{print $3}')
+        CURRENT_USER=$(id -u -n)
+        if [ "$PREV_INSTALL_OWNER" != "${CURRENT_USER}" ]; then
+            echo "Warning: Previous installation not owned by current user"
+        fi
+        PREV_INSTALL_DIR=${PREV_INSTALL_INFO%/*}
+        if [ -f $PREV_INSTALL_DIR/version.txt ] ; then
+            PREV_NCSDK_VER=`cat $PREV_INSTALL_DIR/version.txt`
+            echo "Found NCSDK version $PREV_NCSDK_VER previously installed at $PREV_INSTALL_DIR"
+        else
+            echo "Warning: Couldn't find previous NCSDK version number"
+        fi
+
+        # verify ncsdk_path is in $PREV_INSTALL_INFO & it's a valid directory, else set unknown
+        RC=0
+        grep 'ncsdk_path' $PREV_INSTALL_INFO 2>/dev/null || RC=$?
+        if [ $RC -eq 0 ] ; then
+            PREV_NCSDK_PATH=$(grep 'ncsdk_path' $PREV_INSTALL_INFO | cut -d '=' -f 2)
+            [ ! -d "${PREV_NCSDK_PATH}" ] && PREV_NCSDK_PATH="unknown"
+        else
+            PREV_NCSDK_PATH="unknown"
+        fi      
+        # verify ncs_bin_path is in $PREV_INSTALL_INFO & it's a valid directory, else set unknown
+        RC=0
+        grep 'ncs_bin_path' $PREV_INSTALL_INFO 2>/dev/null || RC=$?
+        if [ $RC -eq 0 ] ; then
+            PREV_NCS_BIN_PATH=$(grep 'ncs_bin_path' $PREV_INSTALL_INFO | cut -d '=' -f 2)
+            [ ! -d "${PREV_NCS_BIN_PATH}" ] && PREV_NCS_BIN_PATH="unknown"
+        else
+            PREV_NCS_BIN_PATH="unknown"
+        fi
+        # verify ncs_lib_path is in $PREV_INSTALL_INFO & it's a valid directory, else set unknown
+        RC=0
+        grep 'ncs_lib_path' $PREV_INSTALL_INFO 2>/dev/null || RC=$?
+        if [ $RC -eq 0 ] ; then
+            PREV_NCS_LIB_PATH=$(grep 'ncs_lib_path' $PREV_INSTALL_INFO | cut -d '=' -f 2)
+            [ ! -d "${PREV_NCS_LIB_PATH}" ] && PREV_NCS_LIB_PATH="unknown"
+        else
+            PREV_NCS_LIB_PATH="unknown"
+        fi
+        # verify ncs_inc_path is in $PREV_INSTALL_INFO & it's a valid directory, else set unknown
+        RC=0
+        grep 'ncs_inc_path' $PREV_INSTALL_INFO 2>/dev/null || RC=$?
+        if [ $RC -eq 0 ] ; then
+            PREV_NCS_INC_PATH=$(grep 'ncs_inc_path' $PREV_INSTALL_INFO | cut -d '=' -f 2)
+            [ ! -d "${PREV_NCS_INC_PATH}" ] && PREV_NCS_INC_PATH="unknown"
+        else
+            PREV_NCS_INC_PATH="unknown"
+        fi
+        
+        if [ "${VERBOSE}" = "yes" ] ; then
+            echo "Previously installed NCSDK files are at: $PREV_NCSDK_PATH"
+            echo "Previously installed NCSDK binaries are at: $PREV_NCS_BIN_PATH"
+            echo "Previously installed NCSDK libraries are at: $PREV_NCS_LIB_PATH"
+            echo "Previously installed NCSDK include files are at: $PREV_NCS_INC_PATH"
+        fi
+    else
+        [ "${VERBOSE}" = "yes" ] && echo "Didn't find a valid NCSDK installation"
+        return 0  # required to prevent function returning 1 if $VERBOSE != yes, which would cause error trap & install to exit
+    fi
+}
+
+
+# check_and_remove_tk_file - remove Toolkit (TK) files
+function check_and_remove_tk_file()
+{
+    if [ -e "$PREV_NCS_BIN_PATH/$1" ]; then
+        RECURSIVE=""
+        if [ -d "$PREV_NCS_BIN_PATH/$1" ]; then
+            RECURSIVE="-r"
+        fi
+        if [ "${VERBOSE}" = "yes" ] ; then
+            printf "Removing NCSDK toolkit file..."
+            echo "$PREV_NCS_BIN_PATH/$1"
+        fi
+        $SUDO_PREFIX rm $RECURSIVE "$PREV_NCS_BIN_PATH/$1"
+    fi
+}
+
+
+# check_and_remove_file - checks if a file exists, then rm it
+function check_and_remove_file()
+{
+    if [ -e "$1" ]; then
+        $SUDO_PREFIX rm "$1"
+    else
+        # remove symbolic links
+        RC=0
+        [ -L "$1" ] || RC=$?
+        if [ ${RC} -eq 0 ] ; then
+            $SUDO_PREFIX rm "$1"
+        fi
+    fi
+}
+
+# check_and_remove_files - checks if a file or director exists, then rm -r it
+function check_and_remove_files()
+{
+    if [ -e "$1" ]; then
+        $SUDO_PREFIX rm -r "$1"
+    fi
+}
+
+
+# check_and_remove_pip_pip3_pkg - removes pip2/pip3 package if installed
+#   argument 1 = pip package to check and remove
+#  
+function check_and_remove_pip_pkg()
+{
+    pip_pkg=$1
+    for PIP in pip3 pip2; do
+        # check if ${PIP} is available on the system via 'command'
+        RC=0
+        command -v ${PIP} > /dev/null || RC=$?
+        if [ $RC -ne 0 ] ; then
+            echo -e "${RED} Command PIP=${PIP} not found.  Will exit${NC}"
+            exit 1
+        fi    
+        RC=0
+        $PIP_PREFIX ${PIP} show ${pip_pkg} 1> /dev/null || RC=$?
+        if [ $RC -eq 0 ]; then
+            $PIP_PREFIX ${PIP} uninstall -y ${pip_pkg}
+        fi
+    done
+}
+
+
+# exec_and_search_errors - execute 1st argument and 1) check for error message
+#      related to network connectivity issues, then 2) check all other errors
+function exec_and_search_errors()
+{
+    # Execute the incoming command in $1
+    RC_INITIAL=0
+    TMP_FILE=/tmp/tmp_cmd_ouput.txt
+    $1 |& tee ${TMP_FILE} || RC_INITIAL=$?
+    fileout=$(<${TMP_FILE})
+    RC=0
+    echo "$fileout" | grep -q -e "Temporary failure" || RC=$?
+    # First check if command failed due to network issues
+    if [ $RC -eq 0 ]; then
+        echo -e "${RED}Installation failed: Unable to reach remote servers, check your network and/or proxy settings and try again. Error on line $LINENO. ${NC}"
+        exit 128
+    fi
+    # Next check if command failed for all other reasons
+    if [ $RC_INITIAL -ne 0 ]; then
+        echo -e "${RED}Installation failed: Command '$1' return code=${RC_INITIAL}. Error on line $LINENO in ${BASH_SOURCE[0]}.  Will exit ${NC}"
+        exit 131
+    fi
+    if [ -f ${TMP_FILE} ] ; then
+        rm ${TMP_FILE}
+    fi
+}
+
+
+# Find if previous install was a NCSDK 1.x release and move it to ${NCSDK1_ARCHIVE_DIR}
+function detect_and_move_ncsdk1()
+{
+    MOVED_NCAPI1="no"
+    # check if existing install in NCSDK 1.x release or not
+    [ -f ${INSTALL_DIR}/version.txt ] && egrep ^1 ${INSTALL_DIR}/version.txt >& /dev/null && FOUND_NCSDK1="Yes" || FOUND_NCSDK1="No"
+    if [ "${FOUND_NCSDK1}" = "Yes" ] ; then
+        echo -e "${YELLOW}"
+        echo "Warning: NCSDK 1.x was detected on this system."
+        echo "If you continue with this installation of NCSDK 2.x your existing "
+        echo "projects using NCAPI v1 will no longer work unless you do one of the following:"
+        echo "  - Manually update projects to use NCAPI v2."
+        echo "  - Manually configure your projects to use the old NCAPI v1 files which will be"
+        echo "    moved to ${NCSDK1_ARCHIVE_DIR}:" 
+        echo ""
+        read -p "Do you wish to continue installing Movidius Neural Compute Toolkit Installation (y/n) ? " CONTINUE
+        echo -e "${NC}"
+        if [[ "$CONTINUE" != "y" && "$CONTINUE" != "Y" ]]; then
+            echo -e "${RED}Based on user input, not continuing with installation${NC}"
+            exit 1            
+        fi
+
+        # Prompt user if they want to remove old NCSDK API 1 directory 
+        if [ -d ${NCSDK1_ARCHIVE_DIR} ] ; then
+            echo -e "${YELLOW}Warning: Detected an existing NCSDK 1.x directory at ${NCSDK1_ARCHIVE_DIR}"
+            echo -e "You can exit and see if you want to delete this directory and re-run make install"
+            read -p "Delete this directory and continue installing (y/n) ? " CONTINUE
+            echo -e "${NC}"
+            if [[ "$CONTINUE" != "y" && "$CONTINUE" != "Y" ]]; then
+                echo -e "${RED}Based on user input, not continuing with installation${NC}"
+                exit 1
+            else
+                echo "Removing ${NCSDK1_ARCHIVE_DIR}"
+                ${SUDO_PREFIX} rm -rf ${NCSDK1_ARCHIVE_DIR}
+            fi
+        fi
+        # Create NCSDK API 1 system directories
+        ${SUDO_PREFIX} mkdir -p ${NCSDK1_ARCHIVE_DIR}/bin
+        ${SUDO_PREFIX} mkdir -p ${NCSDK1_ARCHIVE_DIR}/include
+        ${SUDO_PREFIX} mkdir -p ${NCSDK1_ARCHIVE_DIR}/lib/mvnc
+        ${SUDO_PREFIX} mkdir -p ${NCSDK1_ARCHIVE_DIR}/api
+
+        ## Move NCSDK 1.x Toolkit binaries
+        [ -d ${SYS_INSTALL_DIR}/bin/ncsdk ] && ${SUDO_PREFIX} mv ${SYS_INSTALL_DIR}/bin/ncsdk ${NCSDK1_ARCHIVE_DIR}/bin
+        # remove toolkit binaries old soft links
+        check_and_remove_file ${SYS_INSTALL_DIR}/bin/mvNCCheck
+        check_and_remove_file ${SYS_INSTALL_DIR}/bin/mvNCCompile 
+        check_and_remove_file ${SYS_INSTALL_DIR}/bin/mvNCProfile
+        # Create new toolkit binaries soft links
+        check_and_remove_file ${NCSDK1_ARCHIVE_DIR}/bin/mvNCCheck
+        check_and_remove_file ${NCSDK1_ARCHIVE_DIR}/bin/mvNCCompile
+        check_and_remove_file ${NCSDK1_ARCHIVE_DIR}/bin/mvNCProfile
+        [ -f ${NCSDK1_ARCHIVE_DIR}/bin/ncsdk/mvNCCheck.py ]   && $SUDO_PREFIX ln -s ${NCSDK1_ARCHIVE_DIR}/bin/ncsdk/mvNCCheck.py   ${NCSDK1_ARCHIVE_DIR}/bin/mvNCCheck
+        [ -f ${NCSDK1_ARCHIVE_DIR}/bin/ncsdk/mvNCCompile.py ] && $SUDO_PREFIX ln -s ${NCSDK1_ARCHIVE_DIR}/bin/ncsdk/mvNCCompile.py ${NCSDK1_ARCHIVE_DIR}/bin/mvNCCompile
+        [ -f ${NCSDK1_ARCHIVE_DIR}/bin/ncsdk/mvNCProfile.py ] && $SUDO_PREFIX ln -s ${NCSDK1_ARCHIVE_DIR}/bin/ncsdk/mvNCProfile.py ${NCSDK1_ARCHIVE_DIR}/bin/mvNCProfile
+
+        ## Move NCSDK 1.x C/C++ API header file 
+        [ -f ${SYS_INSTALL_DIR}/include/mvnc.h ] && $SUDO_PREFIX mv ${SYS_INSTALL_DIR}/include/mvnc.h ${NCSDK1_ARCHIVE_DIR}/include
+
+        ## Move NCSDK 1.x C/C++ API lib - remove old soft links, move lib, create new soft link
+        check_and_remove_file $SYS_INSTALL_DIR/lib/libmvnc.so
+        check_and_remove_file $SYS_INSTALL_DIR/lib/libmvnc.so.0
+        [ -f ${SYS_INSTALL_DIR}/lib/mvnc/libmvnc.so.0 ] && $SUDO_PREFIX mv ${SYS_INSTALL_DIR}/lib/mvnc/libmvnc.so.0 ${NCSDK1_ARCHIVE_DIR}/lib
+        check_and_remove_file ${NCSDK1_ARCHIVE_DIR}/lib/libmvnc.so
+        [ -f ${NCSDK1_ARCHIVE_DIR}/lib/libmvnc.so.0 ] && $SUDO_PREFIX ln -s ${NCSDK1_ARCHIVE_DIR}/lib/libmvnc.so.0 ${NCSDK1_ARCHIVE_DIR}/lib/libmvnc.so
+
+        ## Move NCSDK 1.x firmware
+        [ -f ${SYS_INSTALL_DIR}/lib/mvnc/MvNCAPI.mvcmd ] && $SUDO_PREFIX mv ${SYS_INSTALL_DIR}/lib/mvnc/MvNCAPI.mvcmd ${NCSDK1_ARCHIVE_DIR}/lib/mvnc
+
+        ## Move NCSDK 1.x Python API
+        NCSDK_DIR=${INSTALL_DIR}/NCSDK
+        SDK_DIR=${NCSDK_DIR}/ncsdk-$(eval uname -m)
+        [ -d ${SDK_DIR}/api ] && $SUDO_PREFIX mv ${SDK_DIR}/api ${NCSDK1_ARCHIVE_DIR}/
+
+        MOVED_NCAPI1="yes"
+        echo -e "${YELLOW}Moved existing NCSDK 1.x files to ${NCSDK1_ARCHIVE_DIR} ${NC}"
+        echo ""
+    fi
+}
+
+
+# remove_previous_install - remove previous installed files if they exist
+function remove_previous_install()
+{
+    echo "Searching and removing previous NCSDK installation from the system"
+    if [ "${PREV_NCS_BIN_PATH}" != "unknown" ] ; then
+        # If installed, remove toolkit binaries
+        check_and_remove_tk_file mvNCCheck
+        check_and_remove_tk_file mvNCProfile
+        check_and_remove_tk_file mvNCCompile
+        check_and_remove_tk_file ncsdk
+    fi
+    
+    # Remove libraries
+    if [ "${PREV_NCS_LIB_PATH}" != "unknown" ] ; then
+        [ "${VERBOSE}" = "yes" ] && printf "Searching and removing NCSDK libraries..."
+        check_and_remove_file  $PREV_NCS_LIB_PATH/libmvnc.so.0
+        check_and_remove_file  $PREV_NCS_LIB_PATH/libmvnc.so
+        check_and_remove_file  $PREV_NCS_LIB_PATH/libmvnc_highclass.so
+        check_and_remove_files $PREV_NCS_LIB_PATH/mvnc
+        [ "${VERBOSE}" = "yes" ] && printf "done\n"
+    fi
+    
+    # Remove include files
+    if [ "${PREV_NCS_INC_PATH}" != "unknown" ] ; then
+        [ "${VERBOSE}" = "yes" ] && printf "Searching and removing NCSDK include files..."
+        check_and_remove_file $PREV_NCS_INC_PATH/mvnc.h
+        check_and_remove_file $PREV_NCS_INC_PATH/mvnc_deprecated.h
+        check_and_remove_files $PREV_NCS_INC_PATH/mvnc2
+        [ "${VERBOSE}" = "yes" ] && printf "done\n"
+    fi
+    
+    # Remove API, don't prompt user for a response
+    [ "${VERBOSE}" = "yes" ] && printf "Searching and removing NCS python API..."
+    # if pip2/3 are installed, attempt to remove mvnc.  If pip not installed then mvnc couldn't have been installed.
+    RC_PIP2=0
+    RC_PIP3=0
+    command -v pip2 > /dev/null || RC_PIP2=$?
+    command -v pip3 > /dev/null || RC_PIP3=$?
+    [ ${RC_PIP2} -eq 0 ] && [ ${RC_PIP3} -eq 0 ] && check_and_remove_pip_pkg mvnc
+    [ "${VERBOSE}" = "yes" ] && printf "done\n"
+    
+    # Remove udev rules files
+    [ "${VERBOSE}" = "yes" ] && printf "Searching and removing udev rules..."
+    check_and_remove_file /etc/udev/rules.d/97-usbboot.rules
+    [ "${VERBOSE}" = "yes" ] && printf "done\n"
+
+    # Remove NCSDK files
+    if [ "${PREV_NCSDK_PATH}" != "unknown" ] ; then
+        [ "${VERBOSE}" = "yes" ] && printf "Searching and removing NCSDK files..."
+        check_and_remove_files ${PREV_NCSDK_PATH}/NCSDK
+        [ "${VERBOSE}" = "yes" ] && printf "done\n"
+    fi
+
+    # Remove script files
+    if [ "${PREV_NCSDK_PATH}" != "unknown" ] ; then
+        [ "${VERBOSE}" = "yes" ] && printf "Searching and removing ncsdk.conf & uninstall script files..."
+        check_and_remove_file ${PREV_NCSDK_PATH}/ncsdk.conf
+        check_and_remove_file ${PREV_NCSDK_PATH}/install-utilities.sh
+        check_and_remove_file ${PREV_NCSDK_PATH}/uninstall.sh
+        check_and_remove_file ${PREV_NCSDK_PATH}/uninstall-ncsdk.sh
+        [ "${VERBOSE}" = "yes" ] && printf "done\n"
+    fi
+
+    if [ "${USE_VIRTUALENV}" == 'yes' ]; then
+        check_and_remove_files ${INSTALL_DIR}/virtualenv-python
+    fi
+    
+    [ "${VERBOSE}" = "yes" ] && printf "Running ldconfig..."
+    $SUDO_PREFIX ldconfig
+    [ "${VERBOSE}" = "yes" ] && printf "done\n"
+
+    [ "${VERBOSE}" = "yes" ] && printf "Updating udev rules..."
+    RC=0
+    $SUDO_PREFIX udevadm control --reload-rules || RC=$?
+    if [ $RC -ne 0 ] ; then
+        echo "Warning udevadm control --reload-rules return code = ${RC}"
+    fi
+    RC=0 
+    $SUDO_PREFIX udevadm trigger || RC=$?
+    if [ $RC -ne 0 ] ; then
+        echo "Warning udevadm trigger reported an error return code = ${RC}"
+    fi
+    [ "${VERBOSE}" = "yes" ] && printf "done\n"
+
+    # remove NCSDK dir
+    check_and_remove_files ${INSTALL_DIR}/NCSDK
+
+    # remove install info file
+    check_and_remove_files ${PREV_INSTALL_INFO}
+    
+    ## remove version.txt and LICENSE
+    check_and_remove_files ${INSTALL_DIR}/version.txt
+    check_and_remove_files ${INSTALL_DIR}/LICENSE
+    
+    echo "Successfully uninstalled NCSDK from the system"
+}
index 4b164ee83a054eba1c222fc8f1d5cb7b64003267..8385e28cb3888219763710f4fd48aa879a59f565 100755 (executable)
-#! /bin/bash
+#!/bin/bash
+#
+# Movidius Neural Compute Toolkit installation script.
+# 
+# The file ncsdk.conf contains the user configuration options and these
+# override the defaults set in this script.  The function print_ncsdk_config()
+# is called if ${VERBOSE} = "yes" to print user config variables and documents what they do.
+#
+# Function main at the bottom calls all of the other functions required to install.
+#
+# Function check_prerequisites lists the prerequisites required to install
+#  
+# Please provide feedback in our support forum if you encountered difficulties.
+################################################################################
+# read in functions shared by installer and uninstaller
+source $(dirname "$0")/install-utilities.sh
 
-# download the file
-cp ncsdk.conf /tmp
 
-download_filename=NCSDK-1.12.tar.gz
+# check_supported_os - require install to be running on a supported OS
+function check_supported_os()
+{
+    ### Checking OS and version...
+    # install package lsb-release if application lsb_release isn't installed 
+    RC=0
+    command -v lsb_release > /dev/null || RC=$?
+    [ $RC -ne 0 ] && exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y lsb-release"
+    
+    DISTRO="$(lsb_release -i 2>/dev/null | cut -f 2)"
+    VERSION="$(lsb_release -r 2>/dev/null | awk '{ print $2 }' | sed 's/[.]//')"
+    OS_DISTRO="${DISTRO:-INVALID}"
+    OS_VERSION="${VERSION:-255}"
+    if [ "${OS_DISTRO,,}" = "ubuntu" ] && [ ${OS_VERSION} = 1604 ]; then
+        [ "${VERBOSE}" = "yes" ] && echo "Installing on Ubuntu 16.04"
+    elif [ "${OS_DISTRO,,}" = "raspbian" ] && [ ${OS_VERSION} -ge 91 ]; then
+        [ "${VERBOSE}" = "yes" ] && echo "Installing on Raspbian Stretch"
+    elif [ "${OS_DISTRO,,}" = "raspbian" ] && [ ${OS_VERSION} -ge 80 ] && [ ${OS_VERSION} -lt 90 ]; then
+        echo -e "${RED} You are running Raspbian Jessie, which is not supported by NCSDK."
+        echo -e "Please upgrade to Raspbian Stretch and then install NCSDK."
+        echo -e "Error on line $LINENO${NC}"
+        exit 1
+    else
+        echo "Your current combination of Linux distribution and distribution version is not officially supported! Error on line $LINENO.  Will exit"
+        exit 1
+    fi
+    return 0
+}
 
-# ncsdk_link is the url
-ncsdk_link=https://software.intel.com/sites/default/files/managed/33/1b/NCSDK-1.12.00.01.tar.gz
 
-# download the payload from the redirector link
-# and save it the download_filename no matter what the original filename was
-wget --no-cache -O ${download_filename} $ncsdk_link
+# check_prerequisites - tests the prerequisites required to install
+function check_prerequisites()
+{
+    prerequisites="sudo sed udevadm tar"
+    for i in $prerequisites; do
+        RC=0
+        # command is a bash builtin to run a command ($i in this case)
+        command -v $i > /dev/null || RC=$?
+        if [ $RC -ne 0 ] ; then
+            echo -e "${RED}Installation prerequisite $i not available on this system.  Error on line $LINENO.  Will exit${NC}"
+            exit 1
+        fi
+    done
+    
+    check_supported_os
+}
 
-# Get the filenames, ncsdk_archive is just the download filename
-# and ncsdk_pkg is the filename without the .tar.gz
-#ncsdk_archive=$(echo "$ncsdk_link" | grep -o '[^/]*$')
-ncsdk_archive=${download_filename}
-ncsdk_pkg=${ncsdk_archive%%.tar.gz}
 
-# now install-ncsdk.sh is doing the uninstallation if necessary.
-# Remove older installation dirs
-#if [ -f /opt/movidius/uninstall-ncsdk.sh ] 
-#then
-#      echo "Removing previous install..."
-#      /opt/movidius/uninstall-ncsdk.sh
-#fi
+# create_install_logfile - Save a log file of the install in $DIR/setup-logs
+function create_install_logfile()
+{
+    # Print stdout and stderr to screen and in logfile
+    d=$(date +%y-%m-%d-%H-%M)
+    LOGFILE="setup_"$d".log"
+    ${SUDO_PREFIX} mkdir -p $DIR/setup-logs
+    ${SUDO_PREFIX} chown $(id -un):$(id -gn) $DIR/setup-logs
+    echo "Saving installation log file in $DIR/setup-logs/$LOGFILE"
+    exec &> >(tee -a "$DIR/setup-logs/$LOGFILE")    
+}
 
-# Create Required installation dirs
-sudo mkdir -p /opt/movidius
-sudo cp $ncsdk_archive /opt/movidius/ncsdk.tar.gz
-cd /opt/movidius/
 
-# untar the new install and run the install script
-sudo tar zxvf ./ncsdk.tar.gz
-sudo rm -rf NCSDK
-sudo mv $ncsdk_pkg* NCSDK
-cd /opt/movidius/NCSDK
-cp /tmp/ncsdk.conf .
-./install-ncsdk.sh
+# print_ncsdk_config - prints out the definition and values of user configurable options
+function print_ncsdk_config()
+{
+    echo ""
+    echo "print_ncsdk_config()"
+    echo "INSTALL_DIR - Main installation directory"
+    echo "INSTALL_CAFFE - Flag to install TensorFlow"
+    echo "CAFFE_FLAVOR - Specific 'flavor' of caffe to install"
+    echo "CAFFE_USE_CUDA - Use CUDA enabled version of caffe"
+    echo "INSTALL_TENSORFLOW - Flag to install TensorFlow"
+    echo "INSTALL_TOOLKIT - Flag to install Neural Compute Toolkit"
+    echo "PIP_SYSTEM_INSTALL - Globally install pip packages via sudo -H"
+    echo "VERBOSE - Flag to enable more verbose installation"
+    echo "USE_VIRTUALENV - Flag to enable python virtualenv"
+    echo "MAKE_NJOBS - Number of processes to use for parallel build (i.e. make -j MAKE_NJOBS)"
+    echo ""
+    echo "INSTALL_DIR=${INSTALL_DIR}"
+    echo "INSTALL_CAFFE=${INSTALL_CAFFE}"
+    echo "CAFFE_FLAVOR=${CAFFE_FLAVOR}"
+    echo "CAFFE_USE_CUDA=${CAFFE_USE_CUDA}"
+    echo "INSTALL_TENSORFLOW=${INSTALL_TENSORFLOW}"
+    echo "INSTALL_TOOLKIT=${INSTALL_TOOLKIT}"    
+    echo "PIP_SYSTEM_INSTALL=${PIP_SYSTEM_INSTALL}"
+    echo "VERBOSE=${VERBOSE}"
+    echo "USE_VIRTUALENV=${USE_VIRTUALENV}"
+    echo "MAKE_NJOBS=${MAKE_NJOBS}"
+    echo ""
+}
 
-# leave the uninstall script on the target
-#sudo cp ./uninstall-ncsdk.sh ../ncsdk/
 
-# cleanup
-cd ..
-sudo rm ncsdk.tar.gz
-#sudo rm -r NCSDK
-sudo rm -f /tmp/${ncsdk_archive}
+# init_installer - 
+#   sets up installer including error handling, verbosity level, sudo privileges,
+#   reads ncsdk.conf via read_ncsdk_config function, creates dirs for installation,
+#   sets global variables CONF_FILE, DIR and NCSDK_VERSION.
+function init_installer()
+{
+    # trap errors (function is in install-utilities.sh) 
+    set_error_handling
 
+    ### get constants (function is in install-utilities.sh) 
+    initialize_constants
+    
+    ### check if file exist 
+    VERSION_FILE=version.txt
+    if [ ! -f ${VERSION_FILE} ] ; then
+        echo -e "${RED}Couldn't find file ${VERSION_FILE}. Error on line $LINENO  Will exit${NC}"
+        exit 1
+    fi
+    NCSDK_VERSION=`cat ${VERSION_FILE}`
+    echo "Installer NCSDK version: $NCSDK_VERSION"
+    echo ""
+    
+    ### read config file (function is in install-utilities.sh) 
+    read_ncsdk_config
 
+    ### Ask for sudo priviledges (function is in install-utilities.sh)
+    ask_sudo_permissions
 
+    ### Set installer verbosity level
+    APT_QUIET=-qq
+    PIP_QUIET=--quiet
+    GIT_QUIET=-q
+    STDOUT_QUIET='>/dev/null'
+    if [ "${VERBOSE}" = "yes" ]; then
+        APT_QUIET=
+        PIP_QUIET=
+        GIT_QUIET=
+        STDOUT_QUIET=
+    fi
 
+    # Install location for sdk and API 
+    DIR=${INSTALL_DIR}/NCSDK
+    SDK_DIR=$DIR/ncsdk-$(eval uname -m)
+    if [ -d /usr/local/lib ]; then
+        SYS_INSTALL_DIR=/usr/local
+    else
+        SYS_INSTALL_DIR=/usr
+    fi
+
+    ### make sure system has required prerequisites
+    check_prerequisites
+
+    if [ "${VERBOSE}" = "yes" ] ; then
+        print_ncsdk_config
+    fi
+}
+
+
+# make_installer_dirs - creates directories that the install uses
+function make_installer_dirs()
+{
+    ### Create Required installation dirs.  
+    ${SUDO_PREFIX} mkdir -p ${INSTALL_DIR}
+    ${SUDO_PREFIX} chown $(id -un):$(id -gn) "$INSTALL_DIR"
+    # Get absolute dir
+    INSTALL_DIR="$( cd ${INSTALL_DIR} && pwd )"
+
+    
+    # Create directories if needed
+    $SUDO_PREFIX mkdir -p $SYS_INSTALL_DIR/include/mvnc2
+    $SUDO_PREFIX mkdir -p $SYS_INSTALL_DIR/lib/mvnc
+}
+
+
+# download_and_copy_files - download tarball and copy to install dir
+function download_and_copy_files()
+{
+    download_filename="NCSDK-${NCSDK_VERSION}.tar.gz"
+    if [ ! -f ${download_filename} ] ; then
+        echo "Downloading ${download_filename}"
+        ncsdk_link="https://downloadmirror.intel.com/27738/eng/NCSDK-2.04.00.06.tar.gz"
+        exec_and_search_errors "wget --no-cache -O ${download_filename} $ncsdk_link"
+    fi
+    # ncsdk_pkg is the filename without the .tar.gz extension
+    ncsdk_pkg=${download_filename%%.tar.gz}
+
+    # copy files
+    ${SUDO_PREFIX} cp ./$download_filename ${INSTALL_DIR}/ncsdk.tar.gz
+    ${SUDO_PREFIX} cp ./uninstall.sh ${INSTALL_DIR}/
+    ${SUDO_PREFIX} cp ./install-utilities.sh ${INSTALL_DIR}/
+    ${SUDO_PREFIX} cp ./ncsdk.conf ${INSTALL_DIR}/
+
+    # save current dir
+    FROM_DIR=$PWD
+
+    # untar in INSTALL_DIR 
+    cd ${INSTALL_DIR}
+    if [ "${VERBOSE}" = "yes" ] ; then  
+        TAR_OPTIONS="--no-same-owner -vzxf"
+    else
+        TAR_OPTIONS="--no-same-owner -zxf"
+    fi
+    ${SUDO_PREFIX} tar ${TAR_OPTIONS} ./ncsdk.tar.gz
+    ${SUDO_PREFIX} rm -rf NCSDK
+    ${SUDO_PREFIX} mv $ncsdk_pkg* NCSDK
+    cd ${INSTALL_DIR}/NCSDK
+
+    ${SUDO_PREFIX} cp ${FROM_DIR}/version.txt ${INSTALL_DIR}
+    ${SUDO_PREFIX} cp ${FROM_DIR}/ncsdk.conf ${INSTALL_DIR}/NCSDK 
+    ${SUDO_PREFIX} cp ${FROM_DIR}/uninstall.sh ${INSTALL_DIR}/NCSDK 
+    ${SUDO_PREFIX} cp ${FROM_DIR}/requirements.txt ${INSTALL_DIR}/NCSDK 
+    ${SUDO_PREFIX} cp ${FROM_DIR}/requirements_apt.txt ${INSTALL_DIR}/NCSDK 
+    ${SUDO_PREFIX} cp ${FROM_DIR}/requirements_apt_raspbian.txt ${INSTALL_DIR}/NCSDK 
+}
+
+
+# compare_versions - sets global VERCOMP_RETVAL 
+function compare_versions()
+{
+    VERCOMP_RETVAL=-1
+    if [ $1 = $2 ]; then
+        VERCOMP_RETVAL=0
+    else
+        if [[ $1 = `echo -e "$1\n$2" | sort -V | head -n1` ]]; then
+            VERCOMP_RETVAL=1
+        else
+            VERCOMP_RETVAL=2
+        fi
+    fi
+}
+
+
+# print_previous_ncsdk_install_info - if previous valid install found, print version number
+function print_previous_ncsdk_install_info()
+{
+    if [ "${PREV_INSTALL_INFO}" != "unknown" ]; then
+
+        # compare_versions sets VERCOMP_RETVAL to 0, 1 or 2
+        compare_versions ${PREV_NCSDK_VER} ${NCSDK_VERSION}
+        
+        if [ ${VERCOMP_RETVAL} -eq 0 ]; then
+            echo "Previously installed version is the same as installer version, overwriting..."
+        elif [ ${VERCOMP_RETVAL} -eq 1 ]; then
+            echo "Previously installed version is older than installer version, upgrading..."
+        else
+            echo "Previously installed version is more recent than installer version, downgrading..."
+        fi
+    fi
+}
+
+
+# install_apt_dependencies - installs dependencies using apt 
+function install_apt_dependencies()
+{
+    exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET update"
+    exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y $(cat "$DIR/requirements_apt.txt")"
+    exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y --no-install-recommends libboost-all-dev"
+
+    # Make sure pip2 and pip3 installed correctly
+    RC=0
+    command -v pip2 > /dev/null || RC=$?
+    if [ $RC -ne 0 ] ; then
+        echo -e "${RED} pip2 command not found.  Will exit${NC}"
+        exit 1
+    fi    
+    RC=0
+    command -v pip3 > /dev/null || RC=$?
+    if [ $RC -ne 0 ] ; then
+        echo -e "${RED} pip3 command not found.  Will exit${NC}"
+        exit 1
+    fi
+
+    $SUDO_PREFIX ldconfig
+}
+
+
+# setup_virtualenv - Use python virtualenv 
+function setup_virtualenv()
+{
+    echo ""
+    echo "USE_VIRTUALENV=${USE_VIRTUALENV} - will use python virtualenv"
+    [ "${VERBOSE}" = "yes" ] && echo "Installing prerequisites for virtualenv"
+    ${SUDO_PREFIX} apt-get $APT_QUIET install python-virtualenv -y
+    echo ""
+    
+    VIRTUALENV_DIR=${INSTALL_DIR}/virtualenv-python
+    # if virtualenv dir exists, try to activate it
+    if [ -d ${VIRTUALENV_DIR} ] ; then
+        RC=0
+        # disable trapping for unset variables due to activate script 
+        set +u
+        source ${VIRTUALENV_DIR}/bin/activate || RC=$?
+        set -u
+        if [ ${RC} -ne 0 ] ; then
+            echo "source ${VIRTUALENV_DIR}/bin/activate gave an error=${RC}"
+            echo "You need to investigate: 1) Either figure out why virtualenv is not activating correctly or"
+            echo "                         2) edit ncsdk.conf to set USE_VIRTUALENV=no to disable virtualenv.  Will exit"
+            exit 1
+            echo ""
+        else
+            echo "virtualenv ${INSTALL_DIR}/virtualenv-python exists, and successfully activated it"
+        fi
+    else
+        # Create new virtualenv and activate it
+        echo "Creating new virtualenv in ${VIRTUALENV_DIR}"
+        ${SUDO_PREFIX} mkdir -p ${VIRTUALENV_DIR}
+        ${SUDO_PREFIX} virtualenv --system-site-packages -p python3 ${VIRTUALENV_DIR}
+        # disable trapping for unset variables due to activate script
+        set +u
+        RC=0        
+        source ${VIRTUALENV_DIR}/bin/activate || RC=$?
+        set -u        
+        if [ ${RC} -ne 0 ] ; then
+            echo "source ${VIRTUALENV_DIR}/bin/activate gave an error=${RC}"
+            echo "This is unexpected and needs to be investigated."
+            echo "virtualenv can be disabled via edit ncsdk.conf to set USE_VIRTUALENV=no.  Will exit"
+            exit 1
+        else
+            echo "Created virtualenv in ${VIRTUALENV_DIR}, and successfully activated it"
+        fi
+    fi
+    echo ""
+    echo "   To activate this virtualenv in the future enter"
+    echo "   source ${VIRTUALENV_DIR}/bin/activate "
+    echo ""
+
+
+}
+
+
+# install_python_dependencies - install dependencies using pip2/pip3 
+function install_python_dependencies()
+{
+    # Note: If sudo is used and PIP_SYSTEM_INSTALL=yes (set in ncsdk.conf), pip packages
+    #       will be installed in the systems directory, otherwise installed per user
+    echo "Installing python dependencies"
+
+    if [ "${OS_DISTRO,,}" = "ubuntu" ] ; then
+        exec_and_search_errors "$PIP_PREFIX pip3 install $PIP_QUIET --trusted-host files.pythonhosted.org -r $DIR/requirements.txt"
+        # Install packages for python 2.x, required for NCSDK python API
+        exec_and_search_errors "$PIP_PREFIX pip2 install $PIP_QUIET --trusted-host files.pythonhosted.org Enum34>=1.1.6"
+        exec_and_search_errors "$PIP_PREFIX pip2 install $PIP_QUIET --trusted-host files.pythonhosted.org --upgrade numpy>=1.13.0,<=1.13.3"
+
+    elif [ "${OS_DISTRO,,}" = "raspbian" ] ; then
+        # for Raspian, use apt with python3-* if available
+        exec_and_search_errors "$SUDO_PREFIX apt-get $APT_QUIET install -y $(cat "$DIR/requirements_apt_raspbian.txt")"
+        exec_and_search_errors "$PIP_PREFIX pip3 install $PIP_QUIET --trusted-host files.pythonhosted.org Cython graphviz scikit-image"
+        exec_and_search_errors "$PIP_PREFIX pip3 install $PIP_QUIET --trusted-host files.pythonhosted.org --upgrade numpy==1.13.1"
+        exec_and_search_errors "$PIP_PREFIX pip3 install $PIP_QUIET --trusted-host files.pythonhosted.org pygraphviz Enum34>=1.1.6"
+        # Install packages for python 2.x, required for NCSDK python API
+        exec_and_search_errors "$PIP_PREFIX pip2 install $PIP_QUIET --trusted-host files.pythonhosted.org Enum34>=1.1.6"
+        exec_and_search_errors "$PIP_PREFIX pip2 install $PIP_QUIET --trusted-host files.pythonhosted.org --upgrade numpy==1.13.1"
+    fi
+}
+
+
+# find_tensorflow - Test if tensorflow is installed and if it's the supported version
+#                   function arg1 - package name - tensorflow or tensorflow-gpu
+#                   sets FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION=0 when supported version of TensorFlow is installed
+#                   sets FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION=1 when an unsupported version of TensorFlow is installed
+#                   sets FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION=2 when TensorFlow isn't installed
+function find_tensorflow()
+{
+    SUPPORTED_TENSORFLOW_VERSION=1.6.0
+    RC=0
+    $PIP_PREFIX pip3 show $1 1> /dev/null || RC=$?
+    if [ $RC -eq 0 ]; then
+        tf_ver_string=$($PIP_PREFIX pip3 show $1 | grep "^Version:")
+        tf_ver=${tf_ver_string##* }
+        if echo "$1" | grep -q "gpu"; then
+            hw="GPU"
+        else
+            hw="CPU"
+        fi
+        echo "Found tensorflow $hw version $tf_ver"
+        if [ $tf_ver = "$SUPPORTED_TENSORFLOW_VERSION" ]; then
+            FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION=0
+        else
+            FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION=1
+        fi
+    else
+        FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION=2
+    fi
+}
+
+
+# install_tensorflow - install supported version of tensorflow on system
+function install_tensorflow()
+{
+    if [ "${OS_DISTRO,,}" = "raspbian" ] && [ "${INSTALL_TENSORFLOW}" = "yes" ]; then
+        echo -e "${YELLOW}NOTE: TensorFlow is not officially supported on Raspbian Stretch."
+        echo -e "      We are installing a specific nightly TensorFlow build from http://ci.tensorflow.org/view/Nightly/job/nightly-pi-python3/"
+        echo -e "      for code development and testing. ${NC}"
+
+        echo "Checking if tensorflow is installed..."
+        # find_tensorflow sets FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION to 0, 1 or 2 depending if correct version installed, incorrect version installed or not installed, respectively
+        find_tensorflow "tensorflow" 
+        tf=${FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION}
+        INSTALL_TF="no"
+        [ $tf -eq 0 ] && echo "Installed TensorFlow is the correct version, not re-installing"
+        if [ $tf -eq 1 ] ; then
+            exec_and_search_errors "$PIP_PREFIX pip3 uninstall --quiet -y tensorflow"
+            INSTALL_TF="yes"
+        fi
+        [ $tf -eq 2 ] && INSTALL_TF="yes"
+
+        # install TensorFlow if needed
+        if [ "${INSTALL_TF}" = "yes" ] ; then
+            echo "Couldn't find a supported tensorflow version, downloading TensorFlow $SUPPORTED_TENSORFLOW_VERSION"
+            WHEEL=tensorflow-1.6.0-cp35-none-any.whl
+            $SUDO_PREFIX wget https://storage.googleapis.com/download.tensorflow.org/deps/pi/2018_03_22/${WHEEL}
+            echo "Installing TensorFlow"
+            exec_and_search_errors "$PIP_PREFIX pip3 install --quiet ${WHEEL}"
+            echo "Finished installing TensorFlow"
+        fi              
+        
+    elif [ "${OS_DISTRO,,}" = "ubuntu" ] ; then
+        echo "Checking whether tensorflow CPU version is installed..."
+        # find_tensorflow sets FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION to 0, 1 or 2 depending if correct version installed, incorrect version installed or not installed, respectively
+        find_tensorflow "tensorflow" 
+        tf=${FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION}
+        if [ $tf -ne 0 ]; then
+            echo "Checking whether tensorflow GPU version is installed..."
+            find_tensorflow tensorflow-gpu 
+            tf_gpu=${FIND_TENSORFLOW__FOUND_SUPPORTED_VERSION}
+        fi      
+        if [[ $tf -ne 0 && $tf_gpu -ne 0 ]]; then
+            echo "Couldn't find a supported tensorflow version, installing tensorflow $SUPPORTED_TENSORFLOW_VERSION"
+            exec_and_search_errors "$PIP_PREFIX pip3 install $PIP_QUIET --trusted-host files.pythonhosted.org tensorflow==$SUPPORTED_TENSORFLOW_VERSION"
+        else
+            echo "tensorflow already at latest supported version...skipping."
+        fi
+    fi
+}
+
+
+# download_caffe - download caffe sources via git
+function download_caffe()
+{
+    if [ -h "caffe" ]; then
+        $SUDO_PREFIX rm caffe
+    fi
+    if [ ! -d $CAFFE_DIR ]; then
+        echo "Downloading Caffe..."
+        eval git clone $GIT_QUIET $CAFFE_SRC $STDOUT_QUIET $CAFFE_DIR
+    fi
+    ln -sf $CAFFE_DIR caffe
+}
+
+
+# configure_caffe_options - customize caffe options
+function configure_caffe_options()
+{
+    # TODO: Make this configurable. Supports only python3 for now.
+    sed -i 's/python_version "2"/python_version "3"/' CMakeLists.txt
+    # Use/don't use CUDA
+    if [ "$CAFFE_USE_CUDA" = "no" ]; then
+        sed -i 's/CPU_ONLY  "Build Caffe without CUDA support" OFF/CPU_ONLY  "Build Caffe without CUDA support" ON/' CMakeLists.txt
+    fi
+}
+
+
+# find_and_try_adjusting_caffe_symlinks - Create caffe soft link to point to specific caffe flavor that was installed
+function find_and_try_adjusting_caffe_symlinks()
+{
+    cd ${INSTALL_DIR}
+    if [[ -h "caffe" && -d "$CAFFE_DIR" ]]; then
+        readlink -f caffe | grep -q "$CAFFE_DIR"
+        if [ $? -eq 0 ]; then
+            echo "$CAFFE_DIR present and we're currently pointing to it"
+            FIND_AND_TRY_ADJUSTING_CAFFE_SYMLINKS_FOUND=0
+        else
+            if [ -d "${CAFFE_DIR}" ]; then
+                echo "$CAFFE_DIR present, but we're not currently using it. Use it."
+            fi
+            $SUDO_PREFIX rm -f caffe
+            $SUDO_PREFIX ln -sf $CAFFE_DIR caffe
+            FIND_AND_TRY_ADJUSTING_CAFFE_SYMLINKS_FOUND=0
+        fi
+    else
+        echo "Possibly stale caffe install, starting afresh"
+        FIND_AND_TRY_ADJUSTING_CAFFE_SYMLINKS_FOUND=1
+    fi
+}
+
+# check_opencv_caffe_conflict - Avoid known problem with OpenCV library linking with libprotobuf-lite when using ssd-caffe
+function check_opencv_caffe_conflict()
+{
+    # Problem seen with ssd-caffe if built with OpenCV that links with GTK libraries which uses libprotobuf-lite.so.9
+    # Building OpenCV from source on Ubuntu by default has this problem.  OpenCV defaults to linking with GTK libs which use libprotobuf-lite.so
+    # and this causes a conflict as caffe links against libprotobuf.so, and using libprotobuf-lite.so and libprotobuf.so in the same app can cause problems.
+    # Building OpenCV with QT vs. GTK avoids this problems.
+    # Running make install runs ./uninstall-opencv.sh which attempts to remove OpenCV built from source for this reason.
+    # Note: The OpenCV version apt-get installs in /usr/lib doesn't link against libprotobuf-lite.so, so doesn't have this problem.
+    if [ "${CAFFE_FLAVOR}" = "ssd" ]; then
+       LIBOPENCV_HIGHGUI=/usr/local/lib/libopencv_highgui.so.?.?.?
+       RC=0
+       [ -f  ${LIBOPENCV_HIGHGUI} ] && ldd ${LIBOPENCV_HIGHGUI} | grep libprotobuf-lite >& /dev/null || RC=$?
+       if [ $RC -eq 0 ]; then
+            echo ""
+            echo ""
+           echo "**********************************************************************"
+            echo "          ERROR - Compatibility Issue Detected with OpenCV"
+            echo ""
+            echo "The OpenCV library" ${LIBOPENCV_HIGHGUI} "links against libprotobuf-lite"
+            echo "This causes an error with ssd-caffe as it links against libprotobuf (non-lite version)"
+            echo "and these libraries cannot be used together and can cause a crash when deallocating memory."
+            echo "Note building OpenCV with QT vs. the default GTK avoids this issue"
+            echo ""
+            echo "To avoid this, uninstall OpenCV libraries built from sources."
+            echo "The script, uninstall-opencv.sh, attempts to do this and is called by make install"
+            echo "If you have run make install or uninstall-opencv.sh and see this, try uninstalling OpenCV installed in /usr/local/ manually"
+            echo "Will exit"
+            exit 1
+       fi
+    fi
+}
+
+
+# install_caffe - test if caffe installed, if not download, configure and build
+function install_caffe()
+{
+    # look for potential conflict with OpenCV library
+    check_opencv_caffe_conflict
+
+    CAFFE_SRC="https://github.com/BVLC/caffe.git"
+    CAFFE_VER="1.0"
+    CAFFE_DIR=bvlc-caffe
+    CAFFE_BRANCH=master
+    if [ "${CAFFE_FLAVOR}" = "intel" ] && [ "${OS_DISTRO,,}" = "ubuntu" ]; then
+        CAFFE_SRC="https://github.com/intel/caffe.git"
+        CAFFE_VER="1.0.3"
+        CAFFE_DIR=intel-caffe
+    elif [ "${CAFFE_FLAVOR}" = "ssd" ]; then
+        CAFFE_SRC="https://github.com/weiliu89/caffe.git"
+        CAFFE_VER=""
+        CAFFE_DIR=ssd-caffe
+        CAFFE_BRANCH=ssd
+    fi
+
+    # check if caffe is already installed
+    RC=0
+    python3 -c "import caffe" 2> /dev/null || RC=$?
+    if [ $RC -eq 1 ]; then
+        echo "Caffe not found, installing caffe..."
+    else
+        if [ "${CAFFE_FLAVOR}" = "intel" ] && [ "${OS_DISTRO,,}" = "ubuntu" ]; then
+            # find_and_try_adjusting_caffe_symlinks sets FIND_AND_TRY_ADJUSTING_CAFFE_SYMLINKS_FOUND to 0 or 1
+            find_and_try_adjusting_caffe_symlinks
+            RC=$FIND_AND_TRY_ADJUSTING_CAFFE_SYMLINKS_FOUND
+            # Look for intel caffe specific operation to determine the version of caffe currently running
+            if [[ $RC -eq 0 && -d "caffe" ]]; then
+                cd caffe
+                ./build/tools/caffe time -model models/bvlc_googlenet/deploy.prototxt -engine "MKLDNN" -iterations 1 &> /dev/null
+                if [ $? -eq 1 ]; then
+                    echo "Intel caffe requested but not found, installing Intel caffe..."
+                else
+                    echo "Intel caffe already installed, skipping..."
+                    return
+                fi
+            fi
+        else
+            # find_and_try_adjusting_caffe_symlinks sets FIND_AND_TRY_ADJUSTING_CAFFE_SYMLINKS_FOUND to 0 or 1
+            find_and_try_adjusting_caffe_symlinks
+            RC=$FIND_AND_TRY_ADJUSTING_CAFFE_SYMLINKS_FOUND
+            if [ $RC -eq 0 ]; then
+                echo "Caffe already installed, skipping..."
+                return
+            fi
+        fi
+    fi
+
+    ### Install caffe
+    cd ${INSTALL_DIR}
+    if [[ -h "caffe" && -d `readlink -f caffe` ]]; then
+        echo `readlink -f caffe`
+        cd `readlink -f caffe`
+        # grep returns 1 if no lines are matched, causing the script to
+        # think that installation failed, so append "true"
+        is_caffe_dir=`git remote show origin 2>&1 | grep -c -i $CAFFE_SRC` || true
+        if [ "$is_caffe_dir" -eq 0 ]; then
+            cd ..
+            echo -e "${YELLOW}The repo $INSTALL_DIR/caffe does not match the caffe project specified"
+            echo -e "in this installation. Installing caffe from $CAFFE_SRC.\n${NC}"
+            download_caffe
+            cd caffe
+        fi
+
+        eval git reset --hard HEAD $STDOUT_QUIET
+        eval git checkout $GIT_QUIET $CAFFE_BRANCH $STDOUT_QUIET
+        eval git branch -D fathom_branch &>/dev/null || true
+        eval git pull $STDOUT_QUIET
+    elif [ -d "caffe" ]; then
+        echo -e "${YELLOW}Found an old version of caffe, removing it to install the version"
+        echo -e "specified in this installer from $CAFFE_SRC.\n${NC}"
+        $SUDO_PREFIX rm -r caffe
+        download_caffe
+    else
+        download_caffe
+    fi
+
+    cd ${INSTALL_DIR}
+    # disable trapping for unset variables in case PYTHONPATH not set
+    set +u
+    if [ -z "${PYTHONPATH}" ] ; then
+        export PYTHONPATH="$INSTALL_DIR/caffe/python"
+    else
+        export PYTHONPATH="$INSTALL_DIR/caffe/python":$PYTHONPATH
+    fi
+    set -u
+
+    # At this point, caffe *must* be a symlink
+    cd `readlink -f caffe`
+
+    if [ "$CAFFE_BRANCH" != "master" ]; then
+        eval git checkout $GIT_QUIET $CAFFE_BRANCH $STDOUT_QUIET
+    fi
+
+    if [ "$CAFFE_VER" != "" ]; then
+        eval git checkout $GIT_QUIET $CAFFE_VER -b fathom_branch $STDOUT_QUIET
+    fi
+
+    configure_caffe_options
+
+    # If you get an error compiling caffe, one possible potential issue is if you
+    # previously compiled an older version of opencv from sources and it is installed into /usr/local.
+    # In that case the compiler will pick up the older version from /usr/local, not the version
+    # this installer installed.  Please provide feedback in our support forum if you encountered difficulties. 
+    echo "Compiling Caffe..."
+    mkdir -p build
+    cd build
+    eval cmake .. $STDOUT_QUIET
+    eval make -j $MAKE_NJOBS all $STDOUT_QUIET
+
+    echo "Installing caffe..."
+    eval make install $STDOUT_QUIET
+    # You can use 'make runtest' to test this stage manually :)
+    
+    # Add PYTHONPATH if not already there
+    printf "Removing previous references to previous caffe installation..."
+    # Remove older references
+    sed -i "\#export PYTHONPATH=\""${INSTALL_DIR}"/caffe/python\":\$PYTHONPATH#d" $HOME/.bashrc
+    printf "done\n"
+    echo "Adding caffe to PYTHONPATH"
+    grep "^export PYTHONPATH=\"\${PYTHONPATH}:$INSTALL_DIR\/caffe\/python\"" $HOME/.bashrc || echo "export PYTHONPATH=\"\${PYTHONPATH}:$INSTALL_DIR/caffe/python\"" >> $HOME/.bashrc
+}
+
+
+# install_sdk - installs SDK to $SYS_INSTALL_DIR/bin
+function install_sdk()
+{
+    # copy toolkit 
+    $SUDO_PREFIX cp -r $SDK_DIR/tk $SYS_INSTALL_DIR/bin/ncsdk
+
+    check_and_remove_file $SYS_INSTALL_DIR/bin/mvNCCompile
+    check_and_remove_file $SYS_INSTALL_DIR/bin/mvNCCheck
+    check_and_remove_file $SYS_INSTALL_DIR/bin/mvNCProfile
+    $SUDO_PREFIX ln -s $SYS_INSTALL_DIR/bin/ncsdk/mvNCCompile.py $SYS_INSTALL_DIR/bin/mvNCCompile
+    $SUDO_PREFIX ln -s $SYS_INSTALL_DIR/bin/ncsdk/mvNCCheck.py $SYS_INSTALL_DIR/bin/mvNCCheck
+    $SUDO_PREFIX ln -s $SYS_INSTALL_DIR/bin/ncsdk/mvNCProfile.py $SYS_INSTALL_DIR/bin/mvNCProfile
+    echo "NCS Toolkit binaries have been installed in $SYS_INSTALL_DIR/bin"
+}
+
+
+# install_api - installs firmware & API 
+function install_api()
+{
+    # Copy firmware(FW) to destination
+    $SUDO_PREFIX cp $SDK_DIR/fw/MvNCAPI-*.mvcmd $SYS_INSTALL_DIR/lib/mvnc/
+
+    # Copy C API to destination
+    $SUDO_PREFIX cp $SDK_DIR/api/c/mvnc.h $SYS_INSTALL_DIR/include/mvnc2
+    $SUDO_PREFIX cp $SDK_DIR/api/c/libmvnc.so.0 $SYS_INSTALL_DIR/lib/mvnc/
+    $SUDO_PREFIX cp $SDK_DIR/api/c/libmvnc_highclass.so.0 $SYS_INSTALL_DIR/lib/mvnc/
+    echo "NCS Include files have been installed in $SYS_INSTALL_DIR/include"
+
+    check_and_remove_file $SYS_INSTALL_DIR/include/mvnc.h
+    $SUDO_PREFIX ln -s $SYS_INSTALL_DIR/include/mvnc2/mvnc.h $SYS_INSTALL_DIR/include/mvnc.h
+    
+    check_and_remove_file $SYS_INSTALL_DIR/lib/libmvnc.so.0
+    check_and_remove_file $SYS_INSTALL_DIR/lib/libmvnc.so
+    check_and_remove_file $SYS_INSTALL_DIR/lib/libmvnc_highclass.so 
+    $SUDO_PREFIX ln -s $SYS_INSTALL_DIR/lib/mvnc/libmvnc.so.0 $SYS_INSTALL_DIR/lib/libmvnc.so.0
+    $SUDO_PREFIX ln -s $SYS_INSTALL_DIR/lib/mvnc/libmvnc.so.0 $SYS_INSTALL_DIR/lib/libmvnc.so
+    $SUDO_PREFIX ln -s $SYS_INSTALL_DIR/lib/mvnc/libmvnc_highclass.so.0 $SYS_INSTALL_DIR/lib/libmvnc_highclass.so
+
+    $SUDO_PREFIX ldconfig
+
+    # Copy other collaterals to destination
+    $SUDO_PREFIX cp -r $DIR/version.txt $INSTALL_DIR/
+    $SUDO_PREFIX cp -r $SDK_DIR/LICENSE $INSTALL_DIR/
+
+    # Install python API
+    exec_and_search_errors "$PIP_PREFIX pip3 install $PIP_QUIET --upgrade --force-reinstall $SDK_DIR/api"
+    exec_and_search_errors "$PIP_PREFIX pip2 install $PIP_QUIET --upgrade --force-reinstall $SDK_DIR/api"
+    echo "NCS Python API has been installed in $INSTALL_DIR, and PYTHONPATH environment variable updated"
+}
+
+
+# finalize_installer - complete install
+#    create $INSTALL_INFO_FILE file with info on installed files locations
+#    Update udev rules, add user to 'users' group and remove tarball
+function finalize_installer()
+{
+    echo "NCS Libraries have been installed in $SYS_INSTALL_DIR/lib"
+
+    INSTALL_INFO_FILE=$INSTALL_DIR/$INSTALL_INFO_FILENAME
+    touch $INSTALL_INFO_FILE
+    echo "ncsdk_path=$INSTALL_DIR" > $INSTALL_INFO_FILE
+    echo "ncs_lib_path=$SYS_INSTALL_DIR/lib" >> $INSTALL_INFO_FILE
+    echo "ncs_inc_path=$SYS_INSTALL_DIR/include" >> $INSTALL_INFO_FILE
+    if [ "${INSTALL_TOOLKIT}" = 'yes' ]; then
+        echo "ncs_bin_path=$SYS_INSTALL_DIR/bin" >> $INSTALL_INFO_FILE
+    fi
+
+    # Update udev rules
+    echo "Updating udev rules..."
+    $SUDO_PREFIX cp $SDK_DIR/udev/97-usbboot.rules /etc/udev/rules.d/
+    RC=0 
+    $SUDO_PREFIX udevadm control --reload-rules || RC=$?
+    if [ $RC -ne 0 ] ; then
+        echo "Warning udevadm control --reload-rules reported an return code = ${RC}"
+    fi
+    RC=0 
+    $SUDO_PREFIX udevadm trigger || RC=$?
+    if [ $RC -ne 0 ] ; then
+        echo "Warning udevadm trigger return code = ${RC}"
+    fi
+    
+    # Final touch up
+    CURRENT_USER=$(id -u -n)    
+    echo "Adding user '$CURRENT_USER' to 'users' group"
+    $SUDO_PREFIX usermod -a -G users ${CURRENT_USER}
+
+    # cleanup
+    if [ -f ${INSTALL_DIR}/ncsdk.tar.gz ] ; then
+        $SUDO_PREFIX rm ${INSTALL_DIR}/ncsdk.tar.gz
+    fi
+
+    if [ "${INSTALL_CAFFE}" = "yes" ] ; then
+        RC=0
+        grep "export PYTHONPATH=" $HOME/.bashrc > /dev/null  2>&1 || RC=$?
+        if [ $RC -eq 0 ] ; then
+            UPDATED_PYTHONPATH_MSG=$(grep "export PYTHONPATH=" $HOME/.bashrc || RC=$?)
+        else
+            echo -e "${RED}Error, cannot find PYTHONPATH= in $HOME/.bashrc.  Error on line $LINENO.  Will exit${NC}"
+            exit 1
+        fi
+    fi
+    
+    echo ""
+    echo -e "${GREEN}Installation is complete.${NC}"
+    echo "Please provide feedback in our support forum if you encountered difficulties."
+
+    if [ "${MOVED_NCAPI1}" == 'yes' ]; then
+        echo ""
+        echo -e "${YELLOW}Installed NCSDK version: $NCSDK_VERSION"
+        echo -e "Moved existing NCSDK 1.x files to ${NCSDK1_ARCHIVE_DIR}${NC}"
+        echo " You need to either"
+        echo "  - Manually update projects to use NCAPI v2."
+        echo "  - Manually configure your projects to use the old NCAPI v1 files which were "
+        echo "    moved to ${NCSDK1_ARCHIVE_DIR}" 
+        echo ""        
+    fi
+
+    if [ "${INSTALL_CAFFE}" = "yes" ] ; then
+        echo ""
+        echo "The PYTHONPATH environment variable was added to your .bashrc as described in the Caffe documentation."
+        echo -e "${YELLOW} New bash processes including new terminals will use the updated value of PYTHONPATH."
+        echo ""
+        echo "To use the NCSDK in this shell, set PYTHONPATH now:"
+        echo ${UPDATED_PYTHONPATH_MSG}
+        echo -e ${NC}
+    fi
+
+    if [ "${USE_VIRTUALENV}" == 'yes' ]; then
+        echo ""
+        echo "USE_VIRTUALENV=${USE_VIRTUALENV} - used virtualenv in ${VIRTUALENV_DIR}"
+        echo "You must activate this virtualenv to use the NCSDK with python"
+        echo -e "${YELLOW} Activate this virtualenv by entering this command now:"
+        echo "   source ${VIRTUALENV_DIR}/bin/activate "
+        echo -e ${NC}
+    fi
+}
+
+
+# main - this is the main function that runs the install
+function main()
+{
+    echo "Movidius Neural Compute Toolkit Installation"
+    ### initialization phase
+    init_installer
+
+    # If previous install was from NCSDK 1.x release, move them
+    detect_and_move_ncsdk1
+    
+    # Find old installs, if found, print old version and remove it
+    # find_previous_install and remove_previous_install are in install-utilities.sh
+    find_previous_install
+    print_previous_ncsdk_install_info
+    remove_previous_install
+    
+    ### installation phase
+    make_installer_dirs
+    download_and_copy_files
+    install_apt_dependencies
+    create_install_logfile
+    # Optionally use python virtualenv, USE_VIRTUALENV set in ncsdk.conf
+    [ "${USE_VIRTUALENV}" == 'yes' ] && setup_virtualenv
+    install_python_dependencies
+
+    ### Install tensorflow and caffe based on settings in ncsdk.conf
+    [ "${INSTALL_TENSORFLOW}" = "yes" ] && install_tensorflow
+    [ "${INSTALL_CAFFE}" = "yes" ] && install_caffe
+
+    # install SDK based on settings in ncsdk.conf and C/C++ and Python API
+    [ "${INSTALL_TOOLKIT}" = "yes" ] && install_sdk
+    install_api
+
+    finalize_installer
+}
+main
+exit 0
index 71beaaa4d7785352a297b270c9284067c053e592..c5b7aed9313f16deb690b1f7106d0d736d286597 100644 (file)
@@ -1,8 +1,10 @@
-MAKE_PROCS=1
-SETUPDIR=/opt/movidius
-VERBOSE=yes
-SYSTEM_INSTALL=yes
+INSTALL_DIR=/opt/movidius
+INSTALL_CAFFE=yes
 CAFFE_FLAVOR=ssd
 CAFFE_USE_CUDA=no
 INSTALL_TENSORFLOW=yes
 INSTALL_TOOLKIT=yes
+PIP_SYSTEM_INSTALL=yes
+VERBOSE=yes
+USE_VIRTUALENV=no
+#MAKE_NJOBS=1
diff --git a/requirements.txt b/requirements.txt
new file mode 100644 (file)
index 0000000..3d1436f
--- /dev/null
@@ -0,0 +1,17 @@
+Cython>=0.23.4,<=0.26
+Markdown>=2.6.2,<=2.6.8
+Pillow>=3.1.0,<=4.2.1
+PyYAML>=3.11,<=3.12
+graphviz>=0.4.10,<=0.8
+h5py>=2.5.0,<=2.7.0
+lxml>=3.4.4,<=3.8.0
+matplotlib>=1.5.0,<=2.0.2
+numpy>=1.13.0,<=1.13.3
+protobuf>=3.0.0b2,<=3.4.0
+python-dateutil>=2.4.2,<=2.6.1
+scikit-image>=0.11.3,<=0.13.0
+scipy>=0.14.1,<=0.19.1
+six>=1.10.0
+networkx>=1.10,<=1.11
+pygraphviz>=1.3.1
+Enum34>=1.1.6
diff --git a/requirements_apt.txt b/requirements_apt.txt
new file mode 100644 (file)
index 0000000..f68a825
--- /dev/null
@@ -0,0 +1 @@
+unzip coreutils curl git python3 libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev git python3-dev python3-numpy automake cmake make byacc lsb-release python3-scipy libgflags-dev libgoogle-glog-dev liblmdb-dev swig3.0 graphviz libxslt-dev libxml2-dev gfortran python3-yaml python3-nose python-numpy python3-tk python3-pip python-pip tar wget libgraphviz-dev
diff --git a/requirements_apt_raspbian.txt b/requirements_apt_raspbian.txt
new file mode 100644 (file)
index 0000000..fa541da
--- /dev/null
@@ -0,0 +1,2 @@
+python3-markdown python3-h5py python3-lxml python3-matplotlib python3-protobuf python3-dateutil python3-scipy python3-six python3-networkx make wget python3-dev python3-pip python-pip
+
index d8ab8a4be5f2e943f175718411324c26970a6615..0b1a5d024ff0b0ce6df94a1ee69ecef78848b8cd 100755 (executable)
-#! /bin/bash
-
-#test for python already installed for opencv
-python3 -c "import cv2" > /dev/null 2>&1
-if [ $? -eq 0 ] ;
-then
-       echo ""
-       echo "************************ Please confirm *******************************"
-       echo " NCSDK 1.11 requires that previous installations of openCV"
-       echo " be uninstalled before proceeding with NCSDK installation."
-       echo " Note that if you installed opencv via pip3 or from source into the"
-       echo " home directory, it will be uninstalled."
-       read -p " Continue uninstalling OpenCV (y/n) ? " CONTINUE
-       if [[ "$CONTINUE" == "y" || "$CONTINUE" == "Y" ]]; then
-               echo "";
-               echo "OpenCV already setup for python";
-               echo "";
-               echo "Uninstalling opencv pip installation";
-               sudo pip3 uninstall opencv-contrib-python
-               sudo pip3 uninstall opencv-python
-
-               echo "Looking for opencv source installation";
-               if [ -d "$HOME/opencv-3.3.0" ]; then
-                       echo "opencv-3.3.0 directory exists"
-                       if [ -e "$HOME/opencv-3.3.0/build/Makefile" ]; then
-                               echo "opencv-3.3.0 Makefile exists, attempting to uninstall opencv-3.3.0"
-                               cd "$HOME/opencv-3.3.0/build"
-                               sudo make uninstall &> /dev/null
-                               echo "done."
-                       fi
-               fi
-       else
-               echo " Not removing opencv, quitting."
-               exit 1
-       fi
-fi
+#!/bin/bash
+#
+# Movidius Neural Compute Toolkit uninstall-opencv.sh script.
+#
+# Function main at the bottom calls all of the other functions required to uninstall.
+# 
+# Please provide feedback in our support forum if you encountered difficulties.
+################################################################################
+# read in functions shared by installer and uninstaller
+source $(dirname "$0")/install-utilities.sh
+
+
+# initialization() - sets up variables, error handling, reads config file and asks for sudo if needed
+function initialization()
+{
+    # set OpenCV version
+    OPENCV_VER="3.3.0"
+    # enable trapping for error (function is in install-utilities.sh)
+    set_error_handling
+    ### get constants (function is in install-utilities.sh)
+    initialize_constants
+    ### read config file (function is in install-utilities.sh) 
+    read_ncsdk_config
+    # Ask for sudo priviledges (function is in install-utilities.sh)
+    ask_sudo_permissions
+}
+
+
+# check_opencv_python - check if OpenCV python packages installed via pip
+function check_opencv_python()
+{
+    ## uninstall pip OpenCV packages if installed
+    # if pip3 is installed, attempt to remove OpenCV python packages.  If pip3 not installed then OpenCV packages couldn't have been installed.
+    RC=0
+    command -v pip3 > /dev/null || RC=$?
+
+    if [ ${RC} -eq 0 ] ; then
+        # Is pip pkg opencv-python installed?  
+        RC=0
+        $PIP_PREFIX pip3 show opencv-python 1> /dev/null || RC=$?
+        if [ $RC -eq 0 ] ; then
+            PROMPT_UNINSTALL_OPENCV="Yes"
+        fi
+    fi
+    return 0
+}
+
+
+# check_opencv_from_sources - check if OpenCV was installed from sources
+function check_opencv_from_sources()
+{
+    # check if OpenCV Makefile exists
+    [ -e "$HOME/opencv-${OPENCV_VER}/build/Makefile" ]  && PROMPT_UNINSTALL_OPENCV="Yes"
+    return 0
+}
+
+
+# uninstall_opencv - uninstalls OpenCV python packages via pip and if installed from sources
+function uninstall_opencv()
+{
+    if [ "${PROMPT_UNINSTALL_OPENCV}" = "Yes" ] ; then
+        echo ""
+        echo "************************ Please confirm *******************************"
+        echo " As of NCSDK 1.11, installation requires that previous installations of"
+        echo " openCV be uninstalled before proceeding with NCSDK installation."
+        echo " Note that if you installed opencv via pip3 or from source into the"
+        echo " home directory, it will be uninstalled."
+        read -p " Continue uninstalling OpenCV (y/n) ? " CONTINUE
+        if [[ "$CONTINUE" == "y" || "$CONTINUE" == "Y" ]]; then
+
+            # remove OpenCV for python
+            check_and_remove_pip_pkg opencv-contrib-python
+            check_and_remove_pip_pkg opencv-python
+
+            # remove OpenCV if installed from source in $HOME/opencv-${OPENCV_VER}
+            echo "Looking for opencv source installation";
+            if [ -d "$HOME/opencv-${OPENCV_VER}" ]; then
+                echo "opencv-${OPENCV_VER} directory exists"
+                if [ -e "$HOME/opencv-${OPENCV_VER}/build/Makefile" ]; then
+                    echo "opencv-${OPENCV_VER} Makefile exists, attempting to uninstall opencv-${OPENCV_VER}"
+                    cd "$HOME/opencv-${OPENCV_VER}/build"
+                    $SUDO_PREFIX  make uninstall &> /dev/null
+                    echo "done."
+                fi
+            fi
+        else
+            echo "Based on user input, not removing OpenCV"
+            exit 1
+        fi
+    fi    
+}
+
+
+# main - this is the main function that runs the uninstall
+function main()
+{
+    echo "OpenCV uninstall starting"
+    initialization
+
+    # default to OpenCV not installed
+    PROMPT_UNINSTALL_OPENCV="No"
+
+    # check if OpenCV installed via pip or from sources
+    check_opencv_python
+    check_opencv_from_sources
+
+    # uninstall OpenCV
+    uninstall_opencv
+    
+    echo "OpenCV uninstall finished"
+}
+main
old mode 100644 (file)
new mode 100755 (executable)
index 995320d..d4981b3
@@ -1,11 +1,92 @@
-#! /bin/bash
+#!/bin/bash
+#
+# Movidius Neural Compute Toolkit uninstall script.
+#
+# Function main at the bottom calls all of the other functions required to uninstall.
+# 
+# Please provide feedback in our support forum if you encountered difficulties.
+################################################################################
+# read in functions shared by installer and uninstaller
+source $(dirname "$0")/install-utilities.sh
 
-if [ -f /opt/movidius/uninstall-ncsdk.sh ]; then
-    echo "running uninstall-ncsdk.sh"
-    /opt/movidius/uninstall-ncsdk.sh
-else
-   echo "could not find uninstall-ncsdk.sh - nothing to uninstall"
-fi
+# remove_NCSDK_from_PYTHONPATH - removes PYTHONPATH from $HOME/.bashrc
+function remove_NCSDK_from_PYTHONPATH()
+{
+    [ "${VERBOSE}" = "yes" ] && printf "Remove NCSDK references from PYTHONPATH..."
+    #sed -i "\#export PYTHONPATH=\"\${PYTHONPATH}:"${PREV_NCSDK_PATH}"/mvnc/python\"#d" $HOME/.bashrc
+    sed -i "\#export PYTHONPATH=\"\${PYTHONPATH}:"${PREV_NCSDK_PATH}"/caffe/python\"#d" $HOME/.bashrc
+    # Remove some of the older versions of this as well
+    sed -i "\#export PYTHONPATH=\$env:\""${PREV_NCSDK_PATH}"/mvnc/python\":\$PYTHONPATH#d" $HOME/.bashrc
+    sed -i "\#export PYTHONPATH=\$env:\""${PREV_NCSDK_PATH}"/caffe/python\":\$PYTHONPATH#d" $HOME/.bashrc
+    [ "${VERBOSE}" = "yes" ] && printf "done\n"    
+}
 
-sudo rm -rf /opt/movidius/ncsdk
 
+# remove_caffe - remove version of caffe built during the install
+function remove_caffe()
+{
+    [ "${VERBOSE}" = "yes" ] && printf "Removing ${INSTALL_DIR}/${CAFFE_FLAVOR}-caffe..."
+    # remove caffe directory
+    check_and_remove_files ${INSTALL_DIR}/${CAFFE_FLAVOR}-caffe
+    # remove caffe soft link
+    check_and_remove_file ${INSTALL_DIR}/caffe
+    [ "${VERBOSE}" = "yes" ] && printf "done\n"         
+}
+
+
+# remove_install_dir - remove ${INSTALL_DIR} if ${NCSDK1_ARCHIVE_DIR} doesn't exist, the dir NCSDK 1.x files were moved to
+function remove_install_dir()
+{
+    if [ -d ${NCSDK1_ARCHIVE_DIR} ] ; then
+        echo ""
+        echo -e "${YELLOW}Warning: Detected an NCSDK 1.x backup directory at ${NCSDK1_ARCHIVE_DIR}"        
+        read -p "Delete this directory (y/n) ? " CONTINUE
+        echo -e "${NC}"        
+        if [[ "$CONTINUE" = "y" || "$CONTINUE" = "Y" ]]; then
+            echo "Based on user input, will remove ${NCSDK1_ARCHIVE_DIR}"
+            ${SUDO_PREFIX} rm -rf ${NCSDK1_ARCHIVE_DIR}
+        else
+            # if user wants to keep ${NCSDK1_ARCHIVE_DIR}, don't rm ${INSTALL_DIR}
+            echo "Not removing ${INSTALL_DIR} because ${NCSDK1_ARCHIVE_DIR} exists, the directory where NCSDK 1.x files were moved to"
+            return
+        fi
+    fi
+    [ "${VERBOSE}" = "yes" ] && printf "Removing ${INSTALL_DIR}/..."
+    check_and_remove_files ${INSTALL_DIR}
+    [ "${VERBOSE}" = "yes" ] && printf "done\n"
+}
+
+
+# main - this is the main function that runs the uninstall
+function main()
+{
+    echo "Movidius Neural Compute Toolkit uninstall"
+
+    ### get constants, function is in install-utilities.sh
+    initialize_constants
+
+    ### function is in install-utilities.sh
+    read_ncsdk_config
+
+    ### ask for sudo priviledges, function is in install-utilities.sh
+    ask_sudo_permissions
+
+    # override value in ncsdk.config for uninstall
+    VERBOSE=yes
+    
+    ### function is in install-utilities.sh
+    find_previous_install
+    
+    ### remove prev installation. Function is in install-utilities.sh
+    remove_previous_install
+
+    ### edit $HOME/.bashrc
+    remove_NCSDK_from_PYTHONPATH
+
+    ### remove version of caffe that installer installed
+    remove_caffe
+
+    remove_install_dir
+    echo "Movidius Neural Compute Toolkit uninstall finished"
+}
+main
diff --git a/version.txt b/version.txt
new file mode 100644 (file)
index 0000000..ce4879c
--- /dev/null
@@ -0,0 +1 @@
+2.04.00.06