Commit 1df7602e authored by L.S. Cook's avatar L.S. Cook Committed by Robert Kimball

update version and add glossary defs (#1215)

* update version and add glossary defs

* clean up graph rewrite code blocks

* PR feedback

* add better details to LSTM def

* RNN def generalized

* adding fancy formulas to RNN def glossary entry

* Address API breaking change in PR 1164

* all of the documentation re default install path needed updated with pr 1164

* Assert manual compilation process to build ngraph_dist locally as a sensible default
parent 8908c9df
...@@ -35,6 +35,8 @@ repeated use of the trademark / branding symbols. ...@@ -35,6 +35,8 @@ repeated use of the trademark / branding symbols.
* Intel® Xeon® (CPU processor) * Intel® Xeon® (CPU processor)
* Intel® Architecture
* Intel® nGraph™ * Intel® nGraph™
* Intel® nGraph™ library * Intel® nGraph™ library
......
...@@ -68,9 +68,9 @@ author = 'Intel Corporation' ...@@ -68,9 +68,9 @@ author = 'Intel Corporation'
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '0.2.0' version = '0.5'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = 'v0.2.0' release = '0.5.0'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
......
...@@ -17,11 +17,11 @@ MXNet\* ...@@ -17,11 +17,11 @@ MXNet\*
Compile MXNet with nGraph Compile MXNet with nGraph
-------------------------- --------------------------
.. important:: These instructions pick up from where the :doc:`install` .. important:: As of version |version|, these instructions presume that your
installation instructions left off, so they presume that your system already system already has the Library installed to the default location, as outlined
has the library installed at ``$HOME/ngraph_dist`` as the default location. in our :doc:`install` documentation. If the |nGl| code has not yet been
If the |nGl| code has not yet been installed to your system, please go back installed to your system, please go back and return here to finish compiling
and return here to finish compiling MXNet with ``libngraph``. MXNet with ``libngraph``.
#. Set the ``LD_LIBRARY_PATH`` path to the location where we built the nGraph #. Set the ``LD_LIBRARY_PATH`` path to the location where we built the nGraph
...@@ -49,14 +49,14 @@ Compile MXNet with nGraph ...@@ -49,14 +49,14 @@ Compile MXNet with nGraph
$ git clone --recursive git@github.com:NervanaSystems/ngraph-mxnet.git $ git clone --recursive git@github.com:NervanaSystems/ngraph-mxnet.git
#. Edit the ``make/config.mk`` file from the repo we just checked out to set #. Edit the ``make/config.mk`` file from the repo we just checked out to set
the ``USE_NGRAPH`` option (line ``100``) to true with `1` and set the :envvar:`NGRAPH_DIR` the ``USE_NGRAPH`` option (line ``100``) to true with `1` and set the
(line ``101``) to point to the installation location target where the |nGl| :envvar:`NGRAPH_DIR` (line ``101``) to point to the installation location
was installed: of ``ngraph_dist``:
.. code-block:: bash .. code-block:: bash
USE_NGRAPH = 1 USE_NGRAPH = 1
NGRAPH_DIR = $(HOME)/ngraph_dist NGRAPH_DIR = $(HOME)/ngraph_dist
#. Ensure that settings on the config file are disabled for ``USE_MKL2017`` #. Ensure that settings on the config file are disabled for ``USE_MKL2017``
(line ``113``) and ``USE_NNPACK`` (line ``120``). (line ``113``) and ``USE_NNPACK`` (line ``120``).
...@@ -100,7 +100,7 @@ Compile MXNet with nGraph ...@@ -100,7 +100,7 @@ Compile MXNet with nGraph
TensorFlow\* TensorFlow\*
============= =============
See the `ngraph tensorflow bridge README`_ for how to install the See the `ngraph tensorflow bridge README`_ for how to install the `DSO`_ for the
nGraph-TensorFlow bridge. nGraph-TensorFlow bridge.
...@@ -119,23 +119,19 @@ Detailed info about neon's features and functionality can be found in the ...@@ -119,23 +119,19 @@ Detailed info about neon's features and functionality can be found in the
`neon docs`_. This section covers installing neon on an existing `neon docs`_. This section covers installing neon on an existing
system that already has an ``ngraph_dist`` installed. system that already has an ``ngraph_dist`` installed.
.. important:: The numbered instructions below pick up from where .. important:: As of version |version|, these instructions presume that your
the :doc:`install` instructions left off, and they presume that your system system already has the library installed to the default location, as outlined
already has the ngraph library installed installed at ``$HOME/ngraph_dist`` in our :doc:`install` documentation.
as the default location. If the |nGl| code has not yet been installed to
your system, you can follow the instructions on the `ngraph-neon python README`_
to install everything at once.
#. Set the ``NGRAPH_CPP_BUILD_PATH`` and the ``LD_LIBRARY_PATH`` path to the #. Set the ``NGRAPH_CPP_BUILD_PATH`` and the ``LD_LIBRARY_PATH``. You can use
location where you built the nGraph libraries. (This example shows the default the ``env`` command to see if these paths have been set already and if they
location): have not, they can be set with something like:
.. code-block:: bash .. code-block:: bash
export NGRAPH_CPP_BUILD_PATH=$HOME/ngraph_dist/ export NGRAPH_CPP_BUILD_PATH=$HOME/ngraph_dist/
export LD_LIBRARY_PATH=$HOME/ngraph_dist/lib/ export LD_LIBRARY_PATH=$HOME/ngraph_dist/lib/
#. The neon framework uses the :command:`pip` package manager during installation; #. The neon framework uses the :command:`pip` package manager during installation;
install it with Python version 3.5 or higher: install it with Python version 3.5 or higher:
...@@ -143,34 +139,34 @@ system that already has an ``ngraph_dist`` installed. ...@@ -143,34 +139,34 @@ system that already has an ``ngraph_dist`` installed.
.. code-block:: console .. code-block:: console
$ sudo apt-get install python3-pip python3-venv $ sudo apt-get install python3-pip python3-venv
$ python3 -m venv frameworks $ python3 -m venv neon_venv
$ cd frameworks $ cd neon_venv
$ . bin/activate $ . bin/activate
(frameworks) ~/frameworks$ (neon_venv) ~/frameworks$
#. Go to the "python" subdirectory of the ``ngraph`` repo we cloned during the #. Go to the "python" subdirectory of the ``ngraph`` repo we cloned during the
previous :doc:`install`, and complete these actions: previous :doc:`install`, and complete these actions:
.. code-block:: console .. code-block:: console
(frameworks)$ cd /opt/libraries/ngraph/python (neon_venv)$ cd /opt/libraries/ngraph/python
(frameworks)$ git clone --recursive -b allow-nonconstructible-holders https://github.com/jagerman/pybind11.git (neon_venv)$ git clone --recursive -b allow-nonconstructible-holders https://github.com/jagerman/pybind11.git
(frameworks)$ export PYBIND_HEADERS_PATH=/opt/libraries/ngraph/python/pybind11 (neon_venv)$ export PYBIND_HEADERS_PATH=/opt/libraries/ngraph/python/pybind11
(frameworks)$ pip install -U . (neon_venv)$ pip install -U .
#. Finally we're ready to install the `neon` integration: #. Finally we're ready to install the `neon` integration:
.. code-block:: console .. code-block:: console
(frameworks)$ git clone git@github.com:NervanaSystems/ngraph-neon (neon_venv)$ git clone git@github.com:NervanaSystems/ngraph-neon
(frameworks)$ cd ngraph-neon (neon_venv)$ cd ngraph-neon
(frameworks)$ make install (neon_venv)$ make install
#. To test a training example, you can run the following from ``ngraph-neon/examples/cifar10`` #. To test a training example, you can run the following from ``ngraph-neon/examples/cifar10``
.. code-block:: console .. code-block:: console
(frameworks)$ python cifar10_conv.py (neon_venv)$ python cifar10_conv.py
......
...@@ -27,8 +27,8 @@ systems, that command tends to looks something like: ...@@ -27,8 +27,8 @@ systems, that command tends to looks something like:
.. code-block:: console .. code-block:: console
export NGRAPH_CPP_BUILD_PATH=$HOME/ngraph_dist/ export NGRAPH_CPP_BUILD_PATH=path/to/ngraph_dist/
export LD_LIBRARY_PATH=$HOME/ngraph_dist/lib/ export LD_LIBRARY_PATH=path/to/ngraph_dist/lib/
Training Deep Neural Networks Training Deep Neural Networks
...@@ -132,10 +132,12 @@ Intra-op and inter-op parallelism ...@@ -132,10 +132,12 @@ Intra-op and inter-op parallelism
* ``inter_op_parallelism_threads`` * ``inter_op_parallelism_threads``
Some frameworks, like TensorFlow\*, use these settings to improve performance; Some frameworks, like TensorFlow\*, use these settings to improve performance;
however, they are often not sufficient for optimal performance. Framework-based adjustments cannot access the underlying NUMA configuration in multi-socket however, they are often not sufficient for optimal performance. Framework-based
Intel Xeon processor-based platforms, which is a key requirement for many kinds adjustments cannot access the underlying NUMA configuration in multi-socket
of inference-engine computations. See the next section on NUMA performance to Intel® Xeon® processor-based platforms, which is a key requirement for
learn more about this performance feature available to systems utilizing nGraph. many kinds of inference-engine computations. See the next section on NUMA
performance to learn more about this performance feature available to systems
utilizing nGraph.
NUMA performance NUMA performance
......
.. fusion/graph-rewrite.rst: .. fusion/graph-rewrite.rst:
Using ``GraphRewrite`` to fuse ops Using ``GraphRewrite`` to fuse ops
----------------------------------- ==================================
* :ref:`exact`
* :ref:`labels`
.. _exact:
Exact pattern matching Exact pattern matching
~~~~~~~~~~~~~~~~~~~~~~ ----------------------
For the example of ``$-(-A) = A$``, various graphs of varying complexity can be For the example of ``-(-A) = A``, various graphs of varying complexity can be
created and overwritten with recipes for pattern-matching + graph-rewrite. To created and overwritten with recipes for pattern-matching + graph-rewrite. To
get started, a simple example for a trivial graph, followed by more complex get started, a simple example for a trivial graph, followed by more complex
examples: examples:
...@@ -37,7 +41,7 @@ examples: ...@@ -37,7 +41,7 @@ examples:
Label AKA ``.`` in regexes Label AKA ``.`` in regexes
^^^^^^^^^^^^^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|image5| |image5|
...@@ -52,11 +56,15 @@ Graph2 ...@@ -52,11 +56,15 @@ Graph2
auto neg1 = make_shared<op::Negative>(lbl); auto neg1 = make_shared<op::Negative>(lbl);
auto neg2 = make_shared<op::Negative>(neg1); auto neg2 = make_shared<op::Negative>(neg1);
.. _labels:
Constructing labels from existing nodes Constructing labels from existing nodes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ---------------------------------------
Double Negative w/ Add Double Negative w/ Addition
^^^^^^^^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|image6| |image6|
...@@ -69,8 +77,8 @@ Double Negative w/ Add ...@@ -69,8 +77,8 @@ Double Negative w/ Add
auto neg1 = make_shared<op::Negative>(a); auto neg1 = make_shared<op::Negative>(a);
auto neg2 = make_shared<op::Negative>(neg1); auto neg2 = make_shared<op::Negative>(neg1);
Double Negative w/ Sub Double Negative w/ Subtraction
^^^^^^^^^^^^^^^^^^^^^^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|image7| |image7|
...@@ -96,133 +104,8 @@ Predicates are of type ``std::function<bool(std::shared_ptr<Node>)>`` ...@@ -96,133 +104,8 @@ Predicates are of type ``std::function<bool(std::shared_ptr<Node>)>``
Passes that use Matcher
=======================
* CPUFusion (GraphRewrite)
* CoreFusion (GraphRewrite)
* ReshapeElimination (GraphRewrite)
* AlgebraicSimplification
* CPUPostLayoutOptimizations (GraphRewrite)
* CPURnnMatFusion
* and many more...
Register `simplify_neg` handler
--------------------------------
::
static std::unordered_map<std::type_index, std::function<bool(std::shared_ptr<Node>)>>
initialize_const_values_to_ops()
{
return std::unordered_map<std::type_index, std::function<bool(std::shared_ptr<Node>)>>({
{TI(op::Add), simplify_add},
{TI(op::Multiply), simplify_multiply},
{TI(op::Sum), simplify_sum},
{TI(op::Negative), simplify_neg}
});
}
Add a fusion
~~~~~~~~~~~~
$max(0, A) = Relu(A)$
Pattern for capturing
~~~~~~~~~~~~~~~~~~~~~
|image11|
$max(0, A) = Relu(A)$
::
namespace ngraph
{
namespace pass
{
class CoreFusion;
}
}
class ngraph::pass::CoreFusion : public ngraph::pass::GraphRewrite
{
public:
CoreFusion()
: GraphRewrite()
{
construct_relu_pattern();
}
//this should go in a cpp file.
void construct_relu_pattern()
{
auto iconst0 = ngraph::make_zero(element::i32, Shape{});
auto val = make_shared(iconst0);
auto zero = make_shared(iconst0, nullptr, NodeVector{iconst0});
auto broadcast_pred = [](std::shared_ptr n) {
return static_cast(std::dynamic_pointer_cast(n));
};
auto skip_broadcast = std::make_shared(zero, broadcast_pred);
auto max = make_shared(skip_broadcast, val);
pattern::graph_rewrite_callback callback = [val, zero](pattern::Matcher& m) {
NGRAPH_DEBUG << "In a callback for construct_relu_pattern against "
<< m.get_match_root()->get_name();
auto pattern_map = m.get_pattern_map();
auto mzero = m.get_pattern_map()[zero];
if (!ngraph::is_zero(mzero))
{
NGRAPH_DEBUG << "zero constant = " << mzero->get_name() << " not equal to 0n";
return false;
}
auto mpattern = m.get_match_root();
auto cg = shared_ptr(new op::Relu(pattern_map[val]));
ngraph::replace_node(m.get_match_root(), cg);
return true;
};
auto m = make_shared(max, callback);
this->add_matcher(m);
}
};
Recurrent patterns
------------------
::
$ (((A + 0) + 0) + 0) = A$
Equivalent to ``"A(BC)+A"`` in regexes
::
$ (((A + 0) + 0) + 0) = A$
|image12|
|image13|
::
Shape shape{};
auto a = make_shared<op::Parameter>(element::i32, shape);
auto b = make_shared<op::Parameter>(element::i32, shape);
auto rpattern = std::make_shared<pattern::op::Label>(b);
auto iconst0 = ngraph::make_zero(element::i32, shape);
auto abs = make_shared<op::Abs>(a);
auto add1 = iconst0 + b;
auto add2 = iconst0 + add1;
auto add3 = iconst0 + add2;
auto padd = iconst0 + rpattern;
std::set<std::shared_ptr<pattern::op::Label>> empty_correlated_matches;
RecurrentMatcher rm(padd, rpattern, empty_correlated_matches, nullptr);
ASSERT_TRUE(rm.match(add3));
.. |image3| image:: mg/pr1_graph2.png .. |image3| image:: mg/pr1_graph2.png
.. |image4| image:: mg/pr1_graph3.png .. |image4| image:: mg/pr1_graph3.png
...@@ -232,6 +115,4 @@ Equivalent to ``"A(BC)+A"`` in regexes ...@@ -232,6 +115,4 @@ Equivalent to ``"A(BC)+A"`` in regexes
.. |image8| image:: mg/pr2_graph1.png .. |image8| image:: mg/pr2_graph1.png
.. |image9| image:: mg/pr2_graph2.png .. |image9| image:: mg/pr2_graph2.png
.. |image10| image:: mg/pr2_pattern2.png .. |image10| image:: mg/pr2_pattern2.png
.. |image11| image:: mg/fusion_pattern.png
.. |image12| image:: mg/rp_graph1.png \ No newline at end of file
.. |image13| image:: mg/rp_pattern.png
\ No newline at end of file
...@@ -66,6 +66,7 @@ work of the optimization pass writer. ...@@ -66,6 +66,7 @@ work of the optimization pass writer.
:maxdepth: 1 :maxdepth: 1
graph-rewrite.rst graph-rewrite.rst
passes-that-use-matcher.rst
......
.. fusion/passes-that-use-matcher.rst:
Passes that use Matcher
=======================
* CPUFusion (GraphRewrite)
* CoreFusion (GraphRewrite)
* ReshapeElimination (GraphRewrite)
* AlgebraicSimplification
* CPUPostLayoutOptimizations (GraphRewrite)
* CPURnnMatFusion
* and many more...
Register ``simplify_neg`` handler
----------------------------------
.. code-block:: cpp
static std::unordered_map<std::type_index, std::function<bool(std::shared_ptr<Node>)>>
initialize_const_values_to_ops()
{
return std::unordered_map<std::type_index, std::function<bool(std::shared_ptr<Node>)>>({
{TI(op::Add), simplify_add},
{TI(op::Multiply), simplify_multiply},
{TI(op::Sum), simplify_sum},
{TI(op::Negative), simplify_neg}
});
}
Add a fusion
~~~~~~~~~~~~
``max(0, A) = Relu(A)``
Pattern for capturing
~~~~~~~~~~~~~~~~~~~~~
|image11|
``max(0, A) = Relu(A)``
.. code-block:: cpp
namespace ngraph
{
namespace pass
{
class CoreFusion;
}
}
class ngraph::pass::CoreFusion : public ngraph::pass::GraphRewrite
{
public:
CoreFusion()
: GraphRewrite()
{
construct_relu_pattern();
}
//this should go in a cpp file.
void construct_relu_pattern()
{
auto iconst0 = ngraph::make_zero(element::i32, Shape{});
auto val = make_shared(iconst0);
auto zero = make_shared(iconst0, nullptr, NodeVector{iconst0});
auto broadcast_pred = [](std::shared_ptr n) {
return static_cast(std::dynamic_pointer_cast(n));
};
auto skip_broadcast = std::make_shared(zero, broadcast_pred);
auto max = make_shared(skip_broadcast, val);
pattern::graph_rewrite_callback callback = [val, zero](pattern::Matcher& m) {
NGRAPH_DEBUG << "In a callback for construct_relu_pattern against "
<< m.get_match_root()->get_name();
auto pattern_map = m.get_pattern_map();
auto mzero = m.get_pattern_map()[zero];
if (!ngraph::is_zero(mzero))
{
NGRAPH_DEBUG << "zero constant = " << mzero->get_name() << " not equal to 0n";
return false;
}
auto mpattern = m.get_match_root();
auto cg = shared_ptr(new op::Relu(pattern_map[val]));
ngraph::replace_node(m.get_match_root(), cg);
return true;
};
auto m = make_shared(max, callback);
this->add_matcher(m);
}
};
Recurrent patterns
------------------
Equivalent to ``"A(BC)+A"`` in regexes
``(((A + 0) + 0) + 0) = A``
|image12|
|image13|
.. code-block:: cpp
Shape shape{};
auto a = make_shared<op::Parameter>(element::i32, shape);
auto b = make_shared<op::Parameter>(element::i32, shape);
auto rpattern = std::make_shared<pattern::op::Label>(b);
auto iconst0 = ngraph::make_zero(element::i32, shape);
auto abs = make_shared<op::Abs>(a);
auto add1 = iconst0 + b;
auto add2 = iconst0 + add1;
auto add3 = iconst0 + add2;
auto padd = iconst0 + rpattern;
std::set<std::shared_ptr<pattern::op::Label>> empty_correlated_matches;
RecurrentMatcher rm(padd, rpattern, empty_correlated_matches, nullptr);
ASSERT_TRUE(rm.match(add3));
.. |image11| image:: mg/fusion_pattern.png
.. |image12| image:: mg/rp_graph1.png
.. |image13| image:: mg/rp_pattern.png
\ No newline at end of file
...@@ -30,7 +30,7 @@ Glossary ...@@ -30,7 +30,7 @@ Glossary
function graph function graph
The Intel nGraph library uses a function graph to represent an The Intel nGraph Library uses a function graph to represent an
``op``'s parameters and results. ``op``'s parameters and results.
fusion fusion
...@@ -120,5 +120,48 @@ Glossary ...@@ -120,5 +120,48 @@ Glossary
export export
The serialized version of a trained model that can be passed to The serialized version of a trained model that can be passed to
one of the nGraph backends for computation. one of the nGraph backends for computation.
NN
:abbr:`NN (Neural Network)` is an acronym for "Neural Network". NN models
are used to simulate possible combinations of binary logic processing
and multi-layer (multi-dimensional) paths through which a :term:`data-flow graph`
may be mapped or computed. A NN does not have centralized storage; rather,
a NN manifests as information stored as patterns throughout the network
structure. NNs may be **Recurrent** (feedback loop) or **Nonrecurrent**
(feed-forward) with regard to the network vector.
ANN
:abbr:`Artificial Neural Network (ANN)`, often abbreviated as :term:`NN`.
RANN
:abbr:`Recurrent Artificial Neural Network (RANN)`, often abbreviated as
:term:`RNN`.
RNN
A :abbr:`Recurrent Neural Network (RNN)` is a variety of :term:`NN` where
output nodes from a layer on a data-flow graph have loopback to nodes that
comprise an earlier layer. Since the RNN has no "centralized" storage, this
loopback is the means by which the ANN can "learn" or be trained. There are
several sub-categories of RNNs. The traditional RNN looks like:
:math:`s_t = tanh(dot(W,x_{t-1}) + dot(U, s_{t-1})`
where :math:`x` is the input data, :math:`s` is the memory, and output is
:math:`o_t = softmax(dot(V, s_t))`. :doc:`ops/tanh`, :doc:`ops/dot`, and
:doc:`ops/softmax` are all nGraph :doc:`core Ops <ops/index>`.
LSTM
:abbr:`LSTM (Long Short-Term Memory)` is an acronym for "Long Short-Term
Memory". LSTMs extend on the traditional RNN by providing a number of ways
to "forget" the memory of the previous time step via a set of learnable
gates. These gates help avoid the problem of exploding or vanishing
gradients that occur in the traditional RNN.
...@@ -54,17 +54,19 @@ skip ahead to the next section, :ref:`install_ngonnx`. ...@@ -54,17 +54,19 @@ skip ahead to the next section, :ref:`install_ngonnx`.
$ apt install build-essential cmake curl clang-3.9 git zlib1g zlib1g-dev libtinfo-dev $ apt install build-essential cmake curl clang-3.9 git zlib1g zlib1g-dev libtinfo-dev
$ git clone https://github.com/NervanaSystems/ngraph.git $ git clone https://github.com/NervanaSystems/ngraph.git
$ cd ngraph && mkdir build $ cd ngraph && mkdir build
$ cd build && cmake ../ -DNGRAPH_USE_PREBUILT_LLVM=TRUE $ cd build && cmake ../ -DCMAKE_INSTALL_PREFIX=~/ngraph_dist -DNGRAPH_USE_PREBUILT_LLVM=TRUE
$ make install $ make install
#. Build the Python package (binary wheel) for ngraph and set up an env for ONNX: #. Build the Python package (binary wheel) for ngraph and set up an env for ONNX;
be sure to export the ``NGRAPH_CPP_BUILD_PATH`` where the ``ngraph_dist`` was
installed.
.. code-block:: console .. code-block:: console
$ cd ngraph/python $ cd ngraph/python
$ git clone --recursive -b allow-nonconstructible-holders https://github.com/jagerman/pybind11.git $ git clone --recursive -b allow-nonconstructible-holders https://github.com/jagerman/pybind11.git
$ export PYBIND_HEADERS_PATH=$PWD/pybind11 $ export PYBIND_HEADERS_PATH=$PWD/pybind11
$ export NGRAPH_CPP_BUILD_PATH=$HOME/ngraph_dist $ export NGRAPH_CPP_BUILD_PATH=~/ngraph_dist
$ python3 setup.py bdist_wheel $ python3 setup.py bdist_wheel
$ cd .. python3 -m venv onnx $ cd .. python3 -m venv onnx
$ cd onnx/ $ cd onnx/
...@@ -75,7 +77,7 @@ skip ahead to the next section, :ref:`install_ngonnx`. ...@@ -75,7 +77,7 @@ skip ahead to the next section, :ref:`install_ngonnx`.
.. code-block:: console .. code-block:: console
(onnx)$ pip install -U python/dist/ngraph-0.2.0-cp35-cp35m-linux_x86_64.whl (onnx)$ pip install -U python/dist/ngraph-0.5.0-cp35-cp35m-linux_x86_64.whl
#. Confirm ngraph is properly installed through a Python interpreter: #. Confirm ngraph is properly installed through a Python interpreter:
......
...@@ -11,7 +11,7 @@ Install ...@@ -11,7 +11,7 @@ Install
Build Environments Build Environments
================== ==================
The |release| version of |project| supports Linux\*-based systems Release |release| of |project| supports Linux\*-based systems
with the following packages and prerequisites: with the following packages and prerequisites:
.. csv-table:: .. csv-table::
...@@ -20,7 +20,7 @@ with the following packages and prerequisites: ...@@ -20,7 +20,7 @@ with the following packages and prerequisites:
:escape: ~ :escape: ~
CentOS 7.4 64-bit, GCC 4.8, CMake 3.4.3, supported, ``wget zlib-devel ncurses-libs ncurses-devel patch diffutils gcc-c++ make git perl-Data-Dumper`` CentOS 7.4 64-bit, GCC 4.8, CMake 3.4.3, supported, ``wget zlib-devel ncurses-libs ncurses-devel patch diffutils gcc-c++ make git perl-Data-Dumper``
Ubuntu 16.04 (LTS) 64-bit, Clang 3.9, CMake 3.5.1 + GNU Make, supported, ``build-essential cmake clang-3.9 clang-format-3.9 git curl zlib1g zlib1g-dev libtinfo-dev`` Ubuntu 16.04 or 18.04 (LTS) 64-bit, Clang 3.9, CMake 3.5.1 + GNU Make, supported, ``build-essential cmake clang-3.9 clang-format-3.9 git curl zlib1g zlib1g-dev libtinfo-dev``
Clear Linux\* OS for Intel Architecture, Clang 5.0.1, CMake 3.10.2, experimental, bundles ``machine-learning-basic dev-utils python3-basic python-basic-dev`` Clear Linux\* OS for Intel Architecture, Clang 5.0.1, CMake 3.10.2, experimental, bundles ``machine-learning-basic dev-utils python3-basic python-basic-dev``
Other configurations may work, but should be considered experimental with Other configurations may work, but should be considered experimental with
...@@ -40,16 +40,22 @@ compatible with a gcc 4.8-based build.) ...@@ -40,16 +40,22 @@ compatible with a gcc 4.8-based build.)
Installation Steps Installation Steps
================== ==================
The CMake procedure installs ``ngraph_dist`` to the installing user's ``$HOME`` .. important:: The default :program:`cmake` procedure (no build flags) will
directory as the default location. See the :file:`CMakeLists.txt` file for install ``ngraph_dist`` to an OS-level location like ``/usr/bin/ngraph_dist``
details about how to change or customize the install location. or ``/usr/lib/ngraph_dist``. Here we specify how to build locally to the
location of ``~/ngraph_dist`` with the cmake target ``-DCMAKE_INSTALL_PREFIX=~/ngraph_dist``.
All of the nGraph Library documentation presumes that ``ngraph_dist``
gets installed locally. The system location can be used just as easily by
customizing paths on that system. See the :file:`ngraph/CMakeLists.txt`
file to change or customize the default CMake procedure.
.. _ubuntu: .. _ubuntu:
Ubuntu 16.04 Ubuntu 16.04
------------- -------------
The process documented here will work on Ubuntu\* 16.04 (LTS) The process documented here will work on Ubuntu\* 16.04 (LTS) or on Ubuntu
18.04 (LTS).
#. (Optional) Create something like ``/opt/libraries`` and (with sudo), #. (Optional) Create something like ``/opt/libraries`` and (with sudo),
give ownership of that directory to your user. Creating such a placeholder give ownership of that directory to your user. Creating such a placeholder
...@@ -79,19 +85,26 @@ The process documented here will work on Ubuntu\* 16.04 (LTS) ...@@ -79,19 +85,26 @@ The process documented here will work on Ubuntu\* 16.04 (LTS)
$ mkdir build && cd build $ mkdir build && cd build
#. Generate the GNU Makefiles in the customary manner (from within the #. Generate the GNU Makefiles in the customary manner (from within the
``build`` directory). If running ``gcc-5.4.0`` or ``clang-3.9``, remember ``build`` directory). This command sets the target build location to
that you can also append ``cmake`` with the prebuilt LLVM option to be ``~/ngraph_dist``, where it can be easily located.
speed-up the build. Another option if your deployment system has Intel®
.. code-block:: console
$ cmake ../ -DCMAKE_INSTALL_PREFIX=~/ngraph_dist
**Other optional build flags** -- If running ``gcc-5.4.0`` or ``clang-3.9``,
remember that you can also append ``cmake`` with the prebuilt LLVM option
to speed-up the build. Another option if your deployment system has Intel®
Advanced Vector Extensions (Intel® AVX) is to target the accelerations Advanced Vector Extensions (Intel® AVX) is to target the accelerations
available directly by compiling the build as follows during the cmake available directly by compiling the build as follows during the cmake
step: ``-DNGRAPH_TARGET_ARCH=skylake-avx512``. step: ``-DNGRAPH_TARGET_ARCH=skylake-avx512``.
.. code-block:: console .. code-block:: console
$ cmake ../ [-DNGRAPH_USE_PREBUILT_LLVM=TRUE] [-DNGRAPH_TARGET_ARCH=skylake-avx512] $ cmake .. [-DNGRAPH_USE_PREBUILT_LLVM=TRUE] [-DNGRAPH_TARGET_ARCH=skylake-avx512]
#. Run ``$ make`` and ``make install`` to install ``libngraph.so`` and the #. Run ``$ make`` and ``make install`` to install ``libngraph.so`` and the
header files to ``$HOME/ngraph_dist``: header files to ``~/ngraph_dist``:
.. code-block:: console .. code-block:: console
...@@ -144,13 +157,14 @@ The process documented here will work on CentOS 7.4. ...@@ -144,13 +157,14 @@ The process documented here will work on CentOS 7.4.
$ make && sudo make install $ make && sudo make install
#. Clone the `NervanaSystems` ``ngraph`` repo via HTTPS and use Cmake 3.4.3 to #. Clone the `NervanaSystems` ``ngraph`` repo via HTTPS and use Cmake 3.4.3 to
install the nGraph libraries to ``$HOME/ngraph_dist``. build nGraph Libraries to ``~/ngraph_dist``.
.. code-block:: console .. code-block:: console
$ cd /opt/libraries $ cd /opt/libraries
$ git clone https://github.com/NervanaSystems/ngraph.git $ git clone https://github.com/NervanaSystems/ngraph.git
$ cd ngraph && mkdir build && cd build $ cd ngraph && mkdir build && cd build
$ cmake ../ $ cmake ../ -DCMAKE_INSTALL_PREFIX=~/ngraph_dist
$ make && sudo make install $ make && sudo make install
......
...@@ -95,6 +95,8 @@ Not currently a comprehensive list. ...@@ -95,6 +95,8 @@ Not currently a comprehensive list.
power.rst power.rst
product.rst product.rst
relu.rst relu.rst
sigmoid.rst
softmax.rst softmax.rst
tanh.rst
.. tanh.rst:
#####
Tanh
#####
.. code-block:: cpp
Tanh // Elementwise hyperbolic tangent operation.
.. /// \brief Elementwise hyperbolic tangent operation.
///
/// ## Inputs
///
/// | | Type | Description |
/// | ----- | --------------------------------- | ----------------------------------------------- |
/// | `arg` | \f$N[d_1,\dots,d_n]~(n \geq 0)\f$ | A tensor of any shape and numeric element type. |
///
/// ## Output
///
/// | Type | Description |
/// | ---------------------- | ------------------------------------------------------------------------------------- |
/// | \f$N[d_1,\dots,d_n]\f$ | The tensor \f$T\f$, where \f$T[i_1,\dots,i_n] = \tanh(\texttt{arg}[i_1,\dots,i_n])\f$ |
.. /// \brief Constructs a hyperbolic tangent operation.
///
/// \param arg Node that produces the input tensor.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment