{ "info": { "author": "Intel Nervana", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "\n

\n \n

\n\n# Intel(R) nGraph(TM) Compiler and Runtime for TensorFlow*\n\nThis repository contains the code needed to enable Intel(R) nGraph(TM) Compiler and \nruntime engine for TensorFlow. Use it to speed up your TensorFlow training and \ninference workloads. The nGraph Library and runtime suite can also be used to \ncustomize and deploy Deep Learning inference models that will \"just work\" with \na variety of nGraph-enabled backends: CPU, GPU, and custom silicon like the \n[Intel(R) Nervana(TM) NNP](https://itpeernetwork.intel.com/inteldcisummit-artificial-intelligence/).\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/tensorflow/ngraph-bridge/blob/master/LICENSE)\n[![Build Status](https://badge.buildkite.com/180bbf814f1a884219849b4838cbda5fa1e03715e494185be3.svg?branch=master)](https://buildkite.com/ngraph/ngtf-cpu-ubuntu)\n[![Build Status](https://badge.buildkite.com/ae8d39ef4a18eb238b58ab0637fb97e85b86e85822a08b96d1.svg?branch=master)](https://buildkite.com/ngraph/ngtf-cpu-centos)\n[![Build Status](https://badge.buildkite.com/0aeaff43e378d387a160d30083f203f7147f010e3fb15b01d1.svg?branch=master)](https://buildkite.com/ngraph/ngtf-cpu-ubuntu-binary-tf)\n\n## Installation\n\n### Software requirements\n\n|Using pre-built packages| Building from source|\n| -----------------------|-------------------|\n|Python 3| Python 3|\n|TensorFlow v1.14|GCC 4.8 (Ubuntu), Clang/LLVM (macOS)|\n| |`cmake` 3.4 or higher|\n| |Bazel 0.25.2|\n| |`virtualenv` 16.0.0|\n| ||\n\n\n### Use pre-built packages\n\n nGraph bridge enables you to use the nGraph Library with TensorFlow.\n Complete the following steps to install a pre-built nGraph bridge for\n TensorFlow.\n\n1. Install TensorFlow:\n\n pip install -U tensorflow==1.14.0\n\n2. Install `ngraph-tensorflow-bridge`:\n\n pip install -U ngraph-tensorflow-bridge\n\n### Build nGraph from source\n\nTo use the latest version of nGraph Library, complete the following steps to\nbuild nGraph bridge from source. \n\n#### Note to macOS users\n\nThe build and installation instructions are identical for Ubuntu 16.04 and\nmacOS. However, the Python setup may vary across different versions of Mac OS.\nTensorFlow build instructions recommend using Homebrew but developers often use\nPyenv. Some users prefer Anaconda/Miniconda. Before building nGraph, ensure that\nyou can successfully build TensorFlow on macOS with a suitable Python\nenvironment.\n\nThe requirements for building nGraph bridge are identical to the requirements for building TensorFlow from source. For more information, review the [TensorFlow configuration] details. \n\n##### Prepare your build environment\n\nInstall the following requirements before building\n `nGraph-bridge`. \n\nTensorFlow uses a build system called \"bazel\". For the current\n version of `bazel`, use [bazel version].\n\nInstall `bazel`:\n\n wget https://github.com/bazelbuild/bazel/releases/download/0.25.2/bazel-0.25.2-installer-linux-x86_64.sh \n bash bazel-0.25.2-installer-linux-x86_64.sh --user\n\nAdd and source the `bin` path to your `~/.bashrc` file to call\nbazel:\n\n export PATH=$PATH:~/bin\n source ~/.bashrc \n\nInstall `cmake`, `virtualenv`, and `gcc 4.8`.\n\n##### Build an nGraph bridge\n\nOnce TensorFlow's dependencies are installed, clone the `ngraph-bridge` repo:\n\n git clone https://github.com/tensorflow/ngraph-bridge.git\n cd ngraph-bridge\n git checkout v0.18.0\n\nRun the following Python script to build TensorFlow, nGraph, and the bridge. Use Python 3.5:\n\n python3 build_ngtf.py --use_prebuilt_tensorflow\n\nWhen the build finishes, a new `virtualenv` directory is created in `build_cmake/venv-tf-py3`. Build artifacts (i.e., the `ngraph_tensorflow_bridge--py2.py3-none-manylinux1_x86_64.whl`) are created in the `build_cmake/artifacts` directory. \n\nAdd the following flags to build PlaidML and Intel GPU backends (optional):\n\n --build_plaidml_backend\n --build_intelgpu_backend\n\nFor more build options:\n\n python3 build_ngtf.py --help\n\nTest the installation:\n\n python3 test_ngtf.py\n\nThis command runs all C++ and Python unit tests from the `ngraph-bridge` source tree. It also runs various TensorFlow Python tests using nGraph.\n\nTo use the `ngraph-tensorflow-bridge`, activate the following `virtualenv` to start using nGraph with TensorFlow. \n\n source build_cmake/venv-tf-py3/bin/activate\n\nAlternatively, you can also install the TensorFlow and nGraph bridge outside of a `virtualenv`. The Python `whl` files are located in the `build_cmake/artifacts/` and `build_cmake/artifacts/tensorflow` directories, respectively.\n\nSelect the help option of `build_ngtf.py` script to learn more about various build options and how to build other backends. \n\nVerify that `ngraph-bridge` installed correctly:\n\n python -c \"import tensorflow as tf; print('TensorFlow version: ',tf.__version__);\\\n import ngraph_bridge; print(ngraph_bridge.__version__)\"\n\n This will produce something like this:\n\n TensorFlow version: <1.14.0>\n nGraph bridge version: \n nGraph version used for this build: b'0.25.0+005c118'\n TensorFlow version used for this build: \n CXX11_ABI flag used for this build: 0\n nGraph bridge built with Grappler: False\n nGraph bridge built with Variables and Optimizers Enablement: False\n\n Note: The version of the ngraph-tensorflow-bridge is not going to be exactly the same as when you build from source. This is due to delay in the source release and publishing the corresponding Python wheel. \n\n## Classify an image\n\nOnce you have installed nGraph bridge, you can use TensorFlow to train a neural network or run inference using a trained model. \n\nUse TensorFlow with nGraph to classify an image using a [frozen model]. \n\nDownload the Inception v3 trained model and labels file:\n\n wget https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz\n\nExtract the frozen model and labels file from the tarball:\n\n tar xvf inception_v3_2016_08_28_frozen.pb.tar.gz\n\nDownload the image file: \n\n wget https://github.com/tensorflow/tensorflow/raw/master/tensorflow/examples/label_image/data/grace_hopper.jpg\n\nDownload the TensorFlow script:\n\n wget https://github.com/tensorflow/tensorflow/raw/master/tensorflow/examples/label_image/label_image.py\n\nModify the downloaded TensorFlow script to run TensorFlow with nGraph optimizations:\n\n import ngraph_bridge\n ...\n config = tf.ConfigProto()\n config_ngraph_enabled = ngraph_bridge.update_config(config)\n sess = tf.Session(config=config_ngraph_enabled) \n\nRun the classification:\n\n python label_image.py --graph inception_v3_2016_08_28_frozen.pb \\\n --image grace_hopper.jpg --input_layer=input \\\n --output_layer=InceptionV3/Predictions/Reshape_1 \\\n --input_height=299 --input_width=299 \\\n --labels imagenet_slim_labels.txt \n\nThis will print the following results:\n\n military uniform 0.8343056\n mortarboard 0.021869544\n academic gown 0.010358088\n pickelhaube 0.008008157\n bulletproof vest 0.005350913\n\nThe above instructions are derived from the [TensorFlow C++ and Python Image Recognition Demo]. \n\nAll of the above commands are available in the [nGraph TensorFlow examples] directory. To classify your own images, modify the `infer_image.py` file in this directory.\n\n### Add runtime options for a CPU backend\n\nAdding runtime options for a CPU backend applies to training and inference.\n\nBy default nGraph runs with a CPU backend. To get the best performance of the CPU backend, add the following option:\n\n OMP_NUM_THREADS= KMP_AFFINITY=granularity=fine,compact,1,0 \\ \n python label_image.py --graph inception_v3_2016_08_28_frozen.pb \n --image grace_hopper.jpg --input_layer=input \\\n --output_layer=InceptionV3/Predictions/Reshape_1 \\\n --input_height=299 --input_width=299 \\\n --labels imagenet_slim_labels.txt \n\nWhere `` equals the number of cores in your processor. \n\n#### Measure the time\nnGraph is a Just In Time (JIT) compiler meaning that the TensorFlow computation graph is compiled to nGraph during the first instance of the execution. From the second time onwards, the execution speeds up significantly. \n\nAdd the following Python code to measure the computation time:\n\n```python\n# Warmup\nsess.run(output_operation.outputs[0], {\n input_operation.outputs[0]: t})\n# Run\nimport time\nstart = time.time()\nresults = sess.run(output_operation.outputs[0], {\n input_operation.outputs[0]: t\n }) \nelapsed = time.time() - start\nprint('Time elapsed: %f seconds' % elapsed)\n```\nObserve that the output time runs faster than TensorFlow native (i.e., without nGraph).\n\n#### Add additional backends\n\nYou can substitute the default CPU backend with a different backend such as `PLAIDML` or `INTELGPU`. Use the following API:\n\n ngraph_bridge.set_backend('PLAIDML')\n\nTo determine what backends are available on your system, use the following API:\n\n ngraph_bridge.list_backends()\n\nMore detailed examples on how to use ngraph_bridge are located in the [examples] directory.\n\n## Debugging \n\nDuring the build, often there are missing configuration steps for building TensorFlow. If you run into build issues, first ensure that you can build TensorFlow. For debugging run time issues, see the instructions provided in the [diagnostics] directory.\n\n## Support\n\nPlease submit your questions, feature requests and bug reports via [GitHub issues].\n\n## How to Contribute\n\nWe welcome community contributions to nGraph. If you have an idea for how to \nimprove it:\n\n* Share your proposal via [GitHub issues].\n* Ensure you can build the product and run all the examples with your patch.\n* In the case of a larger feature, create a test.\n* Submit a [pull request].\n* We will review your contribution and, if any additional fixes or\n modifications are necessary, may provide feedback to guide you. When\n accepted, your pull request will be merged to the repository.\n\n\n## About Intel(R) nGraph(TM)\n\nSee the full documentation here: \n\n[linux-based install instructions on the TensorFlow website]:https://www.tensorflow.org/install/install_linux\n[tensorflow]:https://github.com/tensorflow/tensorflow.git\n[open-source C++ library, compiler and runtime]: http://ngraph.nervanasys.com/docs/latest/\n[Github issues]: https://github.com/tensorflow/ngraph-bridge/issues\n[pull request]: https://github.com/tensorflow/ngraph-bridge/pulls\n[DSO]:http://csweb.cs.wfu.edu/~torgerse/Kokua/More_SGI/007-2360-010/sgi_html/ch03.html\n[bazel version]: https://github.com/bazelbuild/bazel/releases/tag/0.25.2\n[TensorFlow configuration]: https://www.tensorflow.org/install/source\n[diagnostics]:diagnostics/README.md\n[examples]:examples/README.md\n[ops]:http://ngraph.nervanasys.com/docs/latest/ops/index.html\n[nGraph]:https://github.com/NervanaSystems/ngraph \n[ngraph-bridge]:https://github.com/tensorflow/ngraph-bridge.git\n[frozen model]: https://www.tensorflow.org/guide/extend/model_files#freezing\n[TensorFlow C++ and Python Image Recognition Demo]: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/label_image\n[nGraph TensorFlow examples]: https://github.com/tensorflow/ngraph-bridge/tree/master/examples\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tensorflow/ngraph-bridge", "keywords": "", "license": "Apache License, Version 2.0", "maintainer": "", "maintainer_email": "", "name": "ngraph-tensorflow-bridge", "package_url": "https://pypi.org/project/ngraph-tensorflow-bridge/", "platform": "Ubuntu 16.04", "project_url": "https://pypi.org/project/ngraph-tensorflow-bridge/", "project_urls": { "Homepage": "https://github.com/tensorflow/ngraph-bridge" }, "release_url": "https://pypi.org/project/ngraph-tensorflow-bridge/0.18.0/", "requires_dist": [ "plaidml (>=0.6.3) ; extra == 'plaidml'" ], "requires_python": "", "summary": "Intel nGraph compiler and runtime for TensorFlow", "version": "0.18.0" }, "last_serial": 5685930, "releases": { "0.11.0": [ { "comment_text": "", "digests": { "md5": "d53e4645775b373cbe49aac9203376c0", "sha256": "77b366e3b27e51564bd7eb4cfe7a2d4b9bce1e625f33fe506995f419827537f4" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.11.0-py2.py3-none-macosx_10_14_x86_64.whl", "has_sig": false, "md5_digest": "d53e4645775b373cbe49aac9203376c0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 40976383, "upload_time": "2019-02-22T22:36:45", "url": "https://files.pythonhosted.org/packages/78/99/59745529ffb21495abfe09cdc0e389c685de115cc4b5c6430f755d677141/ngraph_tensorflow_bridge-0.11.0-py2.py3-none-macosx_10_14_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "4e287a59569fccc5fcae7eccb7a4be8f", "sha256": "a4cece63b696800e6d26140c0eb15d7be9dd0a3fad0184fe56813e3da2260395" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.11.0-py2.py3-none-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "4e287a59569fccc5fcae7eccb7a4be8f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 48474717, "upload_time": "2019-02-22T22:35:45", "url": "https://files.pythonhosted.org/packages/79/f5/a4e85aa5d6a9184b82abe0bf124ed50b7428eabcb874ee3d49e61aa101e1/ngraph_tensorflow_bridge-0.11.0-py2.py3-none-manylinux1_x86_64.whl" } ], "0.12.0": [ { "comment_text": "", "digests": { "md5": "2eb53353fd55946d5148ea85f2ac9f04", "sha256": "7951e53ac8c22ae2866aa1c8727786e3cbe9008b3c85325aa32528bd15ccca77" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.12.0-py2.py3-none-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "2eb53353fd55946d5148ea85f2ac9f04", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 48409839, "upload_time": "2019-04-18T22:36:53", "url": "https://files.pythonhosted.org/packages/5f/b4/0d78a08b64bdb9df206acaae6d4dd5b3ef30ec77a8f83c078e46f4e22e89/ngraph_tensorflow_bridge-0.12.0-py2.py3-none-manylinux1_x86_64.whl" } ], "0.16.0": [ { "comment_text": "", "digests": { "md5": "ba4e4d41100e39783fe4168dfad334f5", "sha256": "c540222f7298d8b2b99101b7183f6eb5221a87cf3c2ec0bf0fe2dfdd228312a7" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.16.0-py2.py3-none-macosx_10_14_x86_64.whl", "has_sig": false, "md5_digest": "ba4e4d41100e39783fe4168dfad334f5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 44816870, "upload_time": "2019-07-31T22:50:14", "url": "https://files.pythonhosted.org/packages/79/af/13f65880144113873a213dc13a3e108935a379144a26a33282a939c8a403/ngraph_tensorflow_bridge-0.16.0-py2.py3-none-macosx_10_14_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "b567215926e7c4dd66a9beb6aee58477", "sha256": "ceaffe8dd3463b789192947d71743c77076ce234b65d5ac360abe0cbee0343a6" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.16.0-py2.py3-none-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "b567215926e7c4dd66a9beb6aee58477", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 53979102, "upload_time": "2019-07-31T23:04:45", "url": "https://files.pythonhosted.org/packages/95/88/12cb31e53a64bb59e34b548eec93aac523604fd962c68eae38a42adf17ec/ngraph_tensorflow_bridge-0.16.0-py2.py3-none-manylinux1_x86_64.whl" } ], "0.18.0": [ { "comment_text": "", "digests": { "md5": "647a74eeb79d98014f9bbdd10dd76cba", "sha256": "f872f6cff6140fdbec5f8519adf4e510a7a00d45830006b07a6d515dfc676a8d" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.18.0-py2.py3-none-macosx_10_14_x86_64.whl", "has_sig": false, "md5_digest": "647a74eeb79d98014f9bbdd10dd76cba", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 47256558, "upload_time": "2019-08-16T05:40:36", "url": "https://files.pythonhosted.org/packages/fb/cf/6937d9945d025642be9fe0e3674e7c5ec390e59c5fd7a9d075034e3b9040/ngraph_tensorflow_bridge-0.18.0-py2.py3-none-macosx_10_14_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "8ba6a1973c4054b902200d566a6285f9", "sha256": "d483a0c32f3d0955fa3eda95706992d656c6acd16e10a8105e323b120c64f4a6" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.18.0-py2.py3-none-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "8ba6a1973c4054b902200d566a6285f9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 53748761, "upload_time": "2019-08-16T05:28:02", "url": "https://files.pythonhosted.org/packages/81/40/35bc2daa4eabe134f492444a6add2cd3b6491bbd3d8145ee6c6b8f965e33/ngraph_tensorflow_bridge-0.18.0-py2.py3-none-manylinux1_x86_64.whl" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "00db81a06ffb0061eaea0315cd5cdc27", "sha256": "dcd3be5237d03132fc37136535f35b9cd79641be222b31aed2533141458d217a" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.8.0-py2.py3-none-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "00db81a06ffb0061eaea0315cd5cdc27", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 48734298, "upload_time": "2018-12-01T07:32:09", "url": "https://files.pythonhosted.org/packages/1c/c1/635f82fa03f9f5a0cc0543daff65c57dde1b94f121f20768adf325f89880/ngraph_tensorflow_bridge-0.8.0-py2.py3-none-manylinux1_x86_64.whl" } ], "0.8.0rc0": [ { "comment_text": "", "digests": { "md5": "fb89e9c62f1526b2816694e72d8b16e2", "sha256": "47d2fd1a2a0ef18e2548b34e24d008c504d7379d762a4d3afed5c1e17ac2a8ee" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.8.0rc0-py2.py3-none-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "fb89e9c62f1526b2816694e72d8b16e2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 48687831, "upload_time": "2018-11-30T05:55:19", "url": "https://files.pythonhosted.org/packages/87/b9/e741d74f855b913c272a6aed009772626763597d0d811aab5d8c8ae919b8/ngraph_tensorflow_bridge-0.8.0rc0-py2.py3-none-manylinux1_x86_64.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "647a74eeb79d98014f9bbdd10dd76cba", "sha256": "f872f6cff6140fdbec5f8519adf4e510a7a00d45830006b07a6d515dfc676a8d" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.18.0-py2.py3-none-macosx_10_14_x86_64.whl", "has_sig": false, "md5_digest": "647a74eeb79d98014f9bbdd10dd76cba", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 47256558, "upload_time": "2019-08-16T05:40:36", "url": "https://files.pythonhosted.org/packages/fb/cf/6937d9945d025642be9fe0e3674e7c5ec390e59c5fd7a9d075034e3b9040/ngraph_tensorflow_bridge-0.18.0-py2.py3-none-macosx_10_14_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "8ba6a1973c4054b902200d566a6285f9", "sha256": "d483a0c32f3d0955fa3eda95706992d656c6acd16e10a8105e323b120c64f4a6" }, "downloads": -1, "filename": "ngraph_tensorflow_bridge-0.18.0-py2.py3-none-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "8ba6a1973c4054b902200d566a6285f9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 53748761, "upload_time": "2019-08-16T05:28:02", "url": "https://files.pythonhosted.org/packages/81/40/35bc2daa4eabe134f492444a6add2cd3b6491bbd3d8145ee6c6b8f965e33/ngraph_tensorflow_bridge-0.18.0-py2.py3-none-manylinux1_x86_64.whl" } ] }