Skip to main content

nGraph - Intel's graph compiler and runtime for Neural Networks

Project description

nGraph Neural Network compiler

nGraph is Intel's open-source graph compiler and runtime for Neural Network models. Frameworks using nGraph to execute workloads have shown up to 45X performance boost compared to native implementations.

nGraph can be used directly thought it's Python API or C++ API. Alternatively it can be used through one of its frontends, e.g. TensorFlow, MXNet and ONNX.

Installation

nGraph is available as binary wheels you can install from PyPI. nGraph binary wheels are currently tested on Ubuntu 16.04 and require a CPU with AVX-512 instructions, if you're using a different system, you may want to build nGraph from sources.

Installing nGraph Python API from PyPI is easy:

pip install ngraph-core

Usage example

Using nGraph's Python API to construct a computation graph and execute a computation is simple. The following example shows how to create a simple (A + B) * C computation graph and calculate a result using 3 numpy arrays as input.

import numpy as np
import ngraph as ng

A = ng.parameter(shape=[2, 2], name='A', dtype=np.float32)
B = ng.parameter(shape=[2, 2], name='B', dtype=np.float32)
C = ng.parameter(shape=[2, 2], name='C', dtype=np.float32)
# >>> print(A)
# <Parameter: 'A' ([2, 2], float)>

model = (A + B) * C
# >>> print(model)
# <Multiply: 'Multiply_14' ([2, 2])>

runtime = ng.runtime(backend_name='CPU')
# >>> print(runtime)
# <Runtime: Backend='CPU'>

computation = runtime.computation(model, A, B, C)
# >>> print(computation)
# <Computation: Multiply_14(A, B, C)>

value_a = np.array([[1, 2], [3, 4]], dtype=np.float32)
value_b = np.array([[5, 6], [7, 8]], dtype=np.float32)
value_c = np.array([[9, 10], [11, 12]], dtype=np.float32)

result = computation(value_a, value_b, value_c)
# >>> print(result)
# [[ 54.  80.]
#  [110. 144.]]

print('Result = ', result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

ngraph_core-0.15.0-cp37-cp37m-manylinux1_x86_64.whl (80.1 MB view hashes)

Uploaded CPython 3.7m

ngraph_core-0.15.0-cp36-cp36m-manylinux1_x86_64.whl (80.0 MB view hashes)

Uploaded CPython 3.6m

ngraph_core-0.15.0-cp35-cp35m-manylinux1_x86_64.whl (80.0 MB view hashes)

Uploaded CPython 3.5m

ngraph_core-0.15.0-cp27-cp27mu-manylinux1_x86_64.whl (80.0 MB view hashes)

Uploaded CPython 2.7mu

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page