From 2ee0a0fa0d4fb2ddbee5127ad926639a350630d8 Mon Sep 17 00:00:00 2001 From: Yifan Zhao <yifanz16@illinois.edu> Date: Fri, 26 Mar 2021 14:30:16 -0500 Subject: [PATCH] Added keras/doc/Support.md and fixed a few links --- hpvm/docs/components/index.rst | 3 +- hpvm/docs/components/keras-frontend.rst | 4 +- hpvm/docs/components/keras-support.rst | 1 + hpvm/docs/references/compilation-process.rst | 2 + hpvm/projects/keras/docs/Support.md | 54 -------------------- hpvm/projects/keras/docs/Support.rst | 54 ++++++++++++++++++++ 6 files changed, 61 insertions(+), 57 deletions(-) create mode 120000 hpvm/docs/components/keras-support.rst delete mode 100644 hpvm/projects/keras/docs/Support.md create mode 100644 hpvm/projects/keras/docs/Support.rst diff --git a/hpvm/docs/components/index.rst b/hpvm/docs/components/index.rst index e71b13a8bb..8f9ab42a8d 100644 --- a/hpvm/docs/components/index.rst +++ b/hpvm/docs/components/index.rst @@ -7,7 +7,7 @@ HPVM consists of a few relatively independent key components. * HPVM code generator: a few ``opt`` passes that lowers HPVM IR to LLVM IR, which is then compiled into object code and binary. -`Compilation process of HPVM <../references/hpvm-specification.html>`_ +:doc:`Compilation process of HPVM </references/hpvm-specification>` shows how these 2 components work together. In addition, there are: @@ -26,6 +26,7 @@ which explains their role, usage, and other details. :maxdepth: 1 keras-frontend + keras-support keras-benchmarks torch2hpvm predtuner diff --git a/hpvm/docs/components/keras-frontend.rst b/hpvm/docs/components/keras-frontend.rst index 51dc06ae62..d67adff4f2 100644 --- a/hpvm/docs/components/keras-frontend.rst +++ b/hpvm/docs/components/keras-frontend.rst @@ -39,5 +39,5 @@ At the root of this project (``/projects/keras/``) install the Keras frontend pi Suppported Operations --------------------- -List of supported operations and limitations are documented `here <../projects/keras/docs/Support.md>`_. -TODO: move that Support.md in here as well, otherwise the link will fail when we publish to a website. +List of supported operations and limitations are documented +:doc:`here <keras-support>`. diff --git a/hpvm/docs/components/keras-support.rst b/hpvm/docs/components/keras-support.rst new file mode 120000 index 0000000000..0b77e04dc1 --- /dev/null +++ b/hpvm/docs/components/keras-support.rst @@ -0,0 +1 @@ +../../projects/keras/docs/Support.rst \ No newline at end of file diff --git a/hpvm/docs/references/compilation-process.rst b/hpvm/docs/references/compilation-process.rst index ab3f392f4f..1115de935f 100644 --- a/hpvm/docs/references/compilation-process.rst +++ b/hpvm/docs/references/compilation-process.rst @@ -1,3 +1,5 @@ +.. _hpvm-comp-process: + HPVM Compilation Process ======================== diff --git a/hpvm/projects/keras/docs/Support.md b/hpvm/projects/keras/docs/Support.md deleted file mode 100644 index b568d3d640..0000000000 --- a/hpvm/projects/keras/docs/Support.md +++ /dev/null @@ -1,54 +0,0 @@ -## Supported Keras Operators - -The Keras frontend supports `Sequential()` Keras models. -The list of supported operations is as follows: - -* `Conv2D` -* `DepthwiseConv2D` -* `Dense` -* `BatchNormalization` -* `MaxPooling2D` -* `AveragePooling2D` -* `Flatten` -* `Add` -* `ZeroPadding2D` -* `Activation` - * `relu` - * `tanh` - * `softmax` - - - -## Limitations - -* Currently, we support Convolutional Neural Networks (CNNs) that include the supported operators (above) - RNNs/LSTMs not supported -* We currently only support models in NCHW format (NHWC is not supported) -* Softmax operator should be the last operation in the CNN pipeline -* Softmax operation must be a separate operator (not specified as activation to another type of Keras operator). Example of what works: - -```python -Activation ("softmax") -``` - -Example of what is NOT supported: - -```python -Dense(num_classes, activation="softmax") -``` - -* For convolutions with stride > 1 `same` convolution is NOT supported. Explicitly add `ZeroPadding2D` layer before `Conv2D` or `DepthwiseConv2D` operators. Example of what does NOT work: - -```python -Conv2D(num_filters, kernel_size = (3,3), strides = (2,2), padding = `same`) -``` - -Example of what works instead: - -```python -# NOTE: Amount of padding varies with kernel sizes and strides -ZeroPadding2D(padding=(1,1), data_format = `channels_first`) # only support NCHW -Conv2D(num_filters, kernel_size = (3,3), strides = (2,2), padding = `valid`) -``` - - - diff --git a/hpvm/projects/keras/docs/Support.rst b/hpvm/projects/keras/docs/Support.rst new file mode 100644 index 0000000000..8d9d11c4cb --- /dev/null +++ b/hpvm/projects/keras/docs/Support.rst @@ -0,0 +1,54 @@ +Supported Keras Operators +========================= + +The Keras frontend supports ``Sequential()`` Keras models. +The list of supported operations is as follows: + + +* ``Conv2D`` +* ``DepthwiseConv2D`` +* ``Dense`` +* ``BatchNormalization`` +* ``MaxPooling2D`` +* ``AveragePooling2D`` +* ``Flatten`` +* ``Add`` +* ``ZeroPadding2D`` +* ``Activation`` + + * ``relu`` + * ``tanh`` + * ``softmax`` + +Limitations +----------- + +* Currently, we support Convolutional Neural Networks (CNNs) that include the supported operators (above) - RNNs/LSTMs not supported +* We currently only support models in NCHW format (NHWC is not supported) +* Softmax operator should be the last operation in the CNN pipeline +* Softmax operation must be a separate operator (not specified as activation to another type of Keras operator). Example of what works: + +.. code-block:: python + + Activation ("softmax") + +Example of what is NOT supported: + +.. code-block:: python + + Dense(num_classes, activation="softmax") + + +* For convolutions with stride > 1 ``same`` convolution is NOT supported. Explicitly add ``ZeroPadding2D`` layer before ``Conv2D`` or ``DepthwiseConv2D`` operators. Example of what does NOT work: + +.. code-block:: python + + Conv2D(num_filters, kernel_size = (3,3), strides = (2,2), padding = `same`) + +Example of what works instead: + +.. code-block:: python + + # NOTE: Amount of padding varies with kernel sizes and strides + ZeroPadding2D(padding=(1,1), data_format = `channels_first`) # only support NCHW + Conv2D(num_filters, kernel_size = (3,3), strides = (2,2), padding = `valid`) -- GitLab