You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2025/01/25 00:25:09 UTC

(tvm) branch main updated: [Refactor] Phase out legacy docs

This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new a65d3d4d57 [Refactor] Phase out legacy docs
a65d3d4d57 is described below

commit a65d3d4d57d53a9eb6ef4f9940b58cc6940957f0
Author: Siyuan Feng <hz...@sjtu.edu.cn>
AuthorDate: Fri Jan 24 20:39:26 2025 +0800

    [Refactor] Phase out legacy docs
    
    This commit removes legacy docs.
---
 docs/conf.py                                       |  85 +-
 docs/dev/how_to/debugging_tvm.rst                  |  72 --
 docs/dev/how_to/how_to.rst                         |  31 -
 docs/dev/how_to/relay_add_op.rst                   | 495 -----------
 docs/dev/how_to/relay_add_pass.rst                 | 406 ---------
 docs/dev/how_to/relay_bring_your_own_codegen.rst   | 960 ---------------------
 docs/dev/tutorial/codebase_walkthrough.rst         | 223 -----
 docs/dev/tutorial/index.rst                        |  29 -
 docs/how_to/deploy/adreno.rst                      | 676 ---------------
 docs/how_to/deploy/android.rst                     |  42 -
 docs/how_to/deploy/arm_compute_lib.rst             | 264 ------
 docs/how_to/deploy/bnns.rst                        | 184 ----
 docs/how_to/deploy/cpp_deploy.rst                  |  56 --
 docs/how_to/deploy/hls.rst                         | 182 ----
 docs/how_to/deploy/index.rst                       | 191 ----
 docs/how_to/deploy/integrate.rst                   |  70 --
 docs/how_to/deploy/mrvl.rst                        | 277 ------
 docs/how_to/deploy/tensorrt.rst                    | 315 -------
 docs/how_to/deploy/vitis_ai.rst                    | 480 -----------
 docs/how_to/legacy_index.rst                       |  36 -
 docs/how_to/profile/index.rst                      |  24 -
 docs/how_to/profile/papi.rst                       | 121 ---
 docs/index.rst                                     |  10 -
 docs/install/index.rst                             |   3 +-
 docs/reference/api/python/contrib.rst              |  12 -
 docs/reference/langref/hybrid_script.rst           | 237 -----
 docs/reference/langref/index.rst                   |  61 --
 docs/reference/langref/relay_adt.rst               | 533 ------------
 docs/reference/langref/relay_expr.rst              | 691 ---------------
 docs/reference/langref/relay_op.rst                | 247 ------
 docs/reference/langref/relay_pattern.rst           | 549 ------------
 docs/reference/langref/relay_type.rst              | 398 ---------
 gallery/how_to/compile_models/README.txt           |   7 -
 gallery/how_to/compile_models/from_coreml.py       | 114 ---
 gallery/how_to/compile_models/from_darknet.py      | 203 -----
 gallery/how_to/compile_models/from_keras.py        | 141 ---
 gallery/how_to/compile_models/from_onnx.py         | 135 ---
 gallery/how_to/compile_models/from_paddle.py       | 118 ---
 gallery/how_to/compile_models/from_pytorch.py      | 171 ----
 gallery/how_to/compile_models/from_tensorflow.py   | 257 ------
 gallery/how_to/compile_models/from_tflite.py       | 193 -----
 gallery/how_to/deploy_models/README.txt            |   6 -
 .../how_to/deploy_models/deploy_model_on_adreno.py | 473 ----------
 .../deploy_models/deploy_model_on_adreno_tvmc.py   | 212 -----
 .../deploy_models/deploy_model_on_android.py       | 360 --------
 .../how_to/deploy_models/deploy_model_on_nano.py   | 251 ------
 .../how_to/deploy_models/deploy_model_on_rasp.py   | 236 -----
 .../deploy_object_detection_pytorch.py             | 153 ----
 .../how_to/deploy_models/deploy_prequantized.py    | 242 ------
 .../deploy_models/deploy_prequantized_tflite.py    | 263 ------
 gallery/how_to/deploy_models/deploy_sparse.py      | 363 --------
 gallery/how_to/extend_tvm/README.txt               |   7 -
 gallery/how_to/extend_tvm/low_level_custom_pass.py | 172 ----
 gallery/how_to/extend_tvm/use_pass_infra.py        | 274 ------
 gallery/how_to/extend_tvm/use_pass_instrument.py   | 373 --------
 gallery/how_to/optimize_operators/README.txt       |   5 -
 gallery/how_to/optimize_operators/opt_conv_cuda.py | 252 ------
 .../optimize_operators/opt_conv_tensorcore.py      | 414 ---------
 gallery/how_to/optimize_operators/opt_gemm.py      | 394 ---------
 gallery/how_to/tune_with_autoscheduler/README.txt  |   6 -
 .../tune_with_autoscheduler/ci_logs/conv2d.json    |   2 -
 .../tune_with_autoscheduler/ci_logs/matmul.json    |   2 -
 .../ci_logs/resnet-18-NHWC-B1-cuda.json            |  24 -
 .../ci_logs/resnet-50-NHWC-B1-llvm.json            |  28 -
 .../ci_logs/sparse_dense.json                      |   2 -
 .../tune_conv2d_layer_cuda.py                      | 216 -----
 .../tune_with_autoscheduler/tune_network_arm.py    | 427 ---------
 .../tune_with_autoscheduler/tune_network_cuda.py   | 296 -------
 .../tune_with_autoscheduler/tune_network_mali.py   | 348 --------
 .../tune_with_autoscheduler/tune_network_x86.py    | 333 -------
 .../tune_with_autoscheduler/tune_sparse_x86.py     | 330 -------
 gallery/how_to/tune_with_autotvm/README.txt        |   9 -
 .../how_to/tune_with_autotvm/tune_conv2d_cuda.py   | 253 ------
 gallery/how_to/tune_with_autotvm/tune_relay_arm.py | 422 ---------
 .../how_to/tune_with_autotvm/tune_relay_cuda.py    | 398 ---------
 .../tune_with_autotvm/tune_relay_mobile_gpu.py     | 426 ---------
 gallery/how_to/tune_with_autotvm/tune_relay_x86.py | 310 -------
 gallery/how_to/work_with_msc/_resnet.py            | 350 --------
 gallery/how_to/work_with_msc/using_tools.py        | 140 ---
 gallery/how_to/work_with_msc/utils.py              | 112 ---
 gallery/how_to/work_with_pytorch/using_as_torch.py | 161 ----
 .../work_with_pytorch/using_optimized_torch.py     | 153 ----
 gallery/how_to/work_with_relay/README.txt          |   2 -
 gallery/how_to/work_with_relay/build_gcn.py        | 344 --------
 .../how_to/work_with_relay/using_external_lib.py   | 562 ------------
 .../work_with_relay/using_pipeline_executor.py     | 232 -----
 gallery/how_to/work_with_relay/using_relay_viz.py  | 169 ----
 gallery/how_to/work_with_schedules/README.txt      |   2 -
 gallery/how_to/work_with_schedules/extern_op.py    | 140 ---
 gallery/how_to/work_with_schedules/reduction.py    | 200 -----
 gallery/how_to/work_with_schedules/scan.py         | 158 ----
 .../work_with_schedules/schedule_primitives.py     | 211 -----
 gallery/how_to/work_with_schedules/tedd.py         | 161 ----
 gallery/how_to/work_with_schedules/tensorize.py    | 317 -------
 gallery/how_to/work_with_schedules/tuple_inputs.py | 123 ---
 gallery/tutorial/README.txt                        |  10 -
 gallery/tutorial/auto_scheduler_matmul_x86.py      | 215 -----
 gallery/tutorial/autotvm_matmul_x86.py             | 378 --------
 gallery/tutorial/autotvm_relay_x86.py              | 516 -----------
 gallery/tutorial/intro_topi.py                     | 153 ----
 gallery/tutorial/introduction.py                   | 133 ---
 gallery/tutorial/relay_quick_start.py              | 158 ----
 gallery/tutorial/tensor_expr_get_started.py        | 905 -------------------
 gallery/tutorial/tensor_ir_blitz_course.py         | 194 -----
 gallery/tutorial/tvmc_command_line_driver.py       | 525 -----------
 gallery/tutorial/tvmc_python.py                    | 293 -------
 gallery/tutorial/uma.py                            | 286 ------
 tests/scripts/task_python_docs.sh                  |   6 -
 108 files changed, 2 insertions(+), 24888 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 189877da8f..cffb616f3b 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -409,17 +409,6 @@ intersphinx_mapping = {
 from sphinx_gallery.sorting import ExplicitOrder
 
 examples_dirs = [
-    # legacy tutorial structure under gallery folder
-    tvm_path.joinpath("gallery", "tutorial"),
-    tvm_path.joinpath("gallery", "how_to", "compile_models"),
-    tvm_path.joinpath("gallery", "how_to", "deploy_models"),
-    tvm_path.joinpath("gallery", "how_to", "work_with_relay"),
-    tvm_path.joinpath("gallery", "how_to", "work_with_schedules"),
-    tvm_path.joinpath("gallery", "how_to", "optimize_operators"),
-    tvm_path.joinpath("gallery", "how_to", "tune_with_autotvm"),
-    tvm_path.joinpath("gallery", "how_to", "tune_with_autoscheduler"),
-    tvm_path.joinpath("gallery", "how_to", "extend_tvm"),
-    # New tutorial structure under docs folder
     tvm_path.joinpath("docs", "get_started", "tutorials"),
     tvm_path.joinpath("docs", "how_to", "tutorials"),
     tvm_path.joinpath("docs", "deep_dive", "relax", "tutorials"),
@@ -427,17 +416,6 @@ examples_dirs = [
 ]
 
 gallery_dirs = [
-    # legacy tutorial structure under gallery folder
-    "tutorial",
-    "how_to/compile_models",
-    "how_to/deploy_models",
-    "how_to/work_with_relay",
-    "how_to/work_with_schedules",
-    "how_to/optimize_operators",
-    "how_to/tune_with_autotvm",
-    "how_to/tune_with_autoscheduler",
-    "how_to/extend_tvm",
-    # New tutorial structure under docs folder
     "get_started/tutorials/",
     "how_to/tutorials/",
     "deep_dive/relax/tutorials/",
@@ -448,68 +426,7 @@ gallery_dirs = [
 # The listed files are sorted according to the list.
 # The unlisted files are sorted by filenames.
 # The unlisted files always appear after listed files.
-within_subsection_order = {
-    "tutorial": [
-        "introduction.py",
-        "install.py",
-        "tvmc_command_line_driver.py",
-        "tvmc_python.py",
-        "autotvm_relay_x86.py",
-        "tensor_expr_get_started.py",
-        "autotvm_matmul_x86.py",
-        "auto_scheduler_matmul_x86.py",
-        "tensor_ir_blitz_course.py",
-        "topi.pi",
-        "cross_compilation_and_rpc.py",
-        "relay_quick_start.py",
-        "uma.py",
-    ],
-    "compile_models": [
-        "from_pytorch.py",
-        "from_tensorflow.py",
-        "from_mxnet.py",
-        "from_onnx.py",
-        "from_keras.py",
-        "from_tflite.py",
-        "from_coreml.py",
-        "from_darknet.py",
-        "from_caffe2.py",
-        "from_paddle.py",
-    ],
-    "work_with_schedules": [
-        "schedule_primitives.py",
-        "reduction.py",
-        "scan.py",
-        "extern_op.py",
-        "tensorize.py",
-        "tuple_inputs.py",
-        "tedd.py",
-    ],
-    "optimize_operators": [
-        "opt_gemm.py",
-        "opt_conv_cuda.py",
-        "opt_conv_tensorcore.py",
-    ],
-    "tune_with_autotvm": [
-        "tune_conv2d_cuda.py",
-        "tune_relay_cuda.py",
-        "tune_relay_x86.py",
-        "tune_relay_arm.py",
-        "tune_relay_mobile_gpu.py",
-    ],
-    "tune_with_autoscheduler": [
-        "tune_matmul_x86.py",
-        "tune_conv2d_layer_cuda.py",
-        "tune_network_x86.py",
-        "tune_network_cuda.py",
-    ],
-    "extend_tvm": [
-        "low_level_custom_pass.py",
-        "use_pass_infra.py",
-        "use_pass_instrument.py",
-        "bring_your_own_datatypes.py",
-    ],
-}
+within_subsection_order = {}
 
 
 class WithinSubsectionOrder:
diff --git a/docs/dev/how_to/debugging_tvm.rst b/docs/dev/how_to/debugging_tvm.rst
deleted file mode 100644
index 1e3c9fb393..0000000000
--- a/docs/dev/how_to/debugging_tvm.rst
+++ /dev/null
@@ -1,72 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-.. _debugging-tvm:
-
-Debugging TVM
-==============
-
-**NOTE**: This page is a work in-progress. Everyone is welcomed to add suggestions and tips via
-sending a PR to modify this page. The goal with this page is to centralize the commonly-used
-techniques being used to debug TVM and to spread awareness to the community. To that end, we may
-seek to promote more broadly-used techniques to the top of this doc.
-
-VLOGging
---------
-
-TVM provides a verbose-logging facility that allows you to commit trace-level debugging messages
-without impacting the binary size or runtime of TVM in production. You can use VLOG in your code
-as follows:
-
-.. code-block:: c++
-
-    void Foo(const std::string& bar) {
-      VLOG(2) << "Running Foo(" << bar << ")";
-      // ...
-    }
-
-In this example, the integer ``2`` passed to ``VLOG()`` indicates a verbosity level. The higher the
-level, the more logs printed. In general, TVM levels range from 0 to 2, with 3 being used only for
-extremely low-level core runtime properties. The VLOG system is configured at startup time to print
-VLOG statements between ``0`` and some integer ``N``. ``N`` can be set per-file or globally.
-
-VLOGs don't print or impact binary size or runtime by default (when compiled with proper
-optimization). To enable VLOGging, do the following:
-
-1. In ``config/cmake``, ensure you ``set(USE_RELAY_DEBUG ON)``. This flag is used to enable
-   VLOGging.
-2. Launch Python passing ``TVM_LOG_DEBUG=<spec>``, where ``<spec>`` is a comma-separated list of
-   level assignments of the form ``<file_name>=<level>``. Here are some specializations:
-
-    - The special filename ``DEFAULT`` sets the VLOG level setting for all files.
-    - ``<level>`` can be set to ``-1`` to disable VLOG in that file.
-    - ``<file_name>`` is the name of the c++ source file (e.g. ``.cc``, not ``.h``) relative to the
-      ``src/`` directory in the TVM repo. You do not need to supply ``src/`` when specifying the
-      file path, but if you do, VLOG will still interpret the path correctly.
-
-Examples:
-
-.. code-block:: shell
-
-   # enable VLOG(0), VLOG(1), VLOG(2) in all files.
-   $ TVM_LOG_DEBUG=DEFAULT=2 python3 -c 'import tvm'
-
-   # enable VLOG(0), VLOG(1), VLOG(2) in all files, except not VLOG(2) in src/bar/baz.cc.
-   $ TVM_LOG_DEBUG=DEFAULT=2,bar/baz.cc=1 python3 -c 'import tvm'
-
-   # enable VLOG(0), VLOG(1), VLOG(2) in all files, except not in src/foo/bar.cc.
-   $ TVM_LOG_DEBUG=DEFAULT=2,src/foo/bar.cc=-1 python3 -c 'import tvm'
diff --git a/docs/dev/how_to/how_to.rst b/docs/dev/how_to/how_to.rst
deleted file mode 100644
index aa89324fb9..0000000000
--- a/docs/dev/how_to/how_to.rst
+++ /dev/null
@@ -1,31 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-.. _dev-how-to:
-
-Developer How-To Guide
-======================
-This section contains a collection of tips about how to work on
-various areas of the TVM stack.
-
-.. toctree::
-   :maxdepth: 1
-
-   debugging_tvm
-   relay_add_op
-   relay_add_pass
-   relay_bring_your_own_codegen
diff --git a/docs/dev/how_to/relay_add_op.rst b/docs/dev/how_to/relay_add_op.rst
deleted file mode 100644
index 39c6a2c480..0000000000
--- a/docs/dev/how_to/relay_add_op.rst
+++ /dev/null
@@ -1,495 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-.. _relay-add-op:
-
-Adding an Operator to Relay
-===========================
-
-In this document we will go over the steps needed to register a new TVM operator
-in Relay. We will be following this PR which adds a `cumulative product`_ operation as an example.
-The PR itself builds upon another PR which adds a `cumulative sum`_ operation.
-
-.. _cumulative product: https://github.com/apache/tvm/pull/7722
-.. _cumulative sum: https://github.com/apache/tvm/pull/7334
-
-Registering a new operator requires a few steps:
-
-1. Add an attribute node declaring fixed arguments which are known at compile time
-2. Write a type relation for your operation to integrate into Relay's type system.
-3. Use the ``RELAY_REGISTER_OP`` macro in C++ to register the operator's arity, type, and other hints for the compiler
-4. Write how the operator is computed
-5. Register the compute, schedule with the relay operator
-6. Define a C++ function to produce a call node for the operator and registering a Python API hook for the function
-7. Wrapping the above Python API hook in a neater interface
-8. Writing tests for the new relay operator
-
-1. Defining an Attribute Node
------------------------------
-Attributes are fixed arguments which are supposed to be known at compile time. The stride and dilation of a convolution
-operator would be an appropriate example of fields which might belong in an attribute node for a convolution operator.
-
-Attributes should be defined in a file within the folder `include/tvm/relay/attrs/`_.
-
-.. _include/tvm/relay/attrs/: https://github.com/apache/tvm/tree/main/include/tvm/relay/attrs
-
-Ultimately we want to create an operator whose interface can be seen clearly in the final python interface:
-
-.. code:: python
-
-    def cumprod(data, axis=None, dtype=None, exclusive=None):
-        """Numpy style cumprod op. Return the cumulative inclusive product of the elements along
-        a given axis.
-        Parameters
-        ----------
-        data : relay.Expr
-            The input data to the operator.
-        axis : int, optional
-            Axis along which the cumulative product is computed. The default (None) is to compute
-            the cumprod over the flattened array.
-        dtype : string, optional
-            Type of the returned array and of the accumulator in which the elements are multiplied.
-            If dtype is not specified, it defaults to the dtype of data.
-        exclusive : bool, optional
-            If true will return exclusive product in which the first element is not
-            included. In other terms, if true, the j-th output element would be
-            the product of the first (j-1) elements. Otherwise, it would be the product of
-            the first j elements. The product of zero elements will be 1.
-        Returns
-        -------
-        result : relay.Expr
-            The result has the same size as data, and the same shape as data if axis is not None.
-            If axis is None, the result is a 1-d array.
-        """
-
-A similiar interface exists for ``cumsum()``.
-
-Therefore, when defining our attributes in ``include/tvm/relay/attrs/transform.h`` we choose the axis,
-accumulation dtype, and exclusivity of the operation as appropriate fields for the struct.
-
-.. code:: c++
-
-  /*! \brief Attributes used in cumsum and cumprod operator */
-  struct ScanopAttrs : public tvm::AttrsNode<ScanopAttrs> {
-    Integer axis;
-    DataType dtype;
-    Bool exclusive = Bool(false);
-    TVM_DECLARE_ATTRS(ScanopAttrs, "relay.attrs.ScanopAttrs") {
-      TVM_ATTR_FIELD(axis).describe("The axis to operate over").set_default(NullValue<Integer>());
-      TVM_ATTR_FIELD(dtype).describe("Output data type").set_default(NullValue<DataType>());
-      TVM_ATTR_FIELD(exclusive)
-          .describe("The first element is not included")
-          .set_default(Bool(false));
-    }
-  };
-
-2. Writing a Type Relation
---------------------------
-To allow for flexibility in registering operators and greater
-expressivity and granularity in expressing types in Relay, operators
-are typed using relations between input and output types. These relations
-are represented as functions that take in a list of input types and
-output types (any of these types may be incomplete) and return a list
-of input and output types that satisfies the relation. This includes shape
-information which can be determined statically at compile time. Essentially, a
-relation for an operator can enforce all the necessary typing rules
-(namely by inspecting the input types) in addition to computing the
-output type.
-
-Type relation for the cumulative product and sum operators can be found in
-``src/relay/op/tensor/transform.cc``:
-
-.. code:: c++
-
-    TVM_REGISTER_NODE_TYPE(ScanopAttrs);
-    bool ScanopRel(const Array<Type>& types, int num_inputs, const Attrs& attrs, const TypeReporter& reporter) {
-        // types: [data, output]
-        ICHECK_EQ(types.size(), 2) << "Expects two types, one for the input and another for the output";
-        const auto* data = types[0].as<TensorTypeNode>();
-        if (data == nullptr) {
-            ICHECK(types[0].as<IncompleteTypeNode>())
-            << "Scanop: expect input type to be TensorType but get " << types[0];
-            return false;
-        }
-
-        const auto* param = attrs.as<ScanopAttrs>();
-
-        auto dtype = param->dtype;
-        if (dtype.is_void()) {
-            dtype = data->dtype;
-        }
-
-        if (param->axis.defined()) {
-            reporter->Assign(types[1], TensorType(data->shape, dtype));
-        } else {
-            auto prod = data->shape[0];
-            for (size_t i = 1; i < data->shape.size(); ++i) {
-                prod = prod * data->shape[i];
-            }
-            reporter->Assign(types[1], TensorType({prod}, dtype));
-        }
-
-        return true;
-    }
-
-3. Relating the Arity and Attributes to an Operation
-----------------------------------------------------
-
-We then register the name of our new ops and annotate them with the calling interface.
-The ``RELAY_REGISTER_OP`` macro in C++ allows a developer
-to specify the following information about an operator in Relay:
-
-- Arity (number of arguments)
-- Names and descriptions for positional arguments
-- Support level (1 indicates an internal intrinsic; higher numbers indicate less integral or externally supported operators)
-- A type relation for the operator
-- Other annotations useful when optimizing the operation.
-
-Once again we add this to ``src/relay/op/tensor/transform.cc``:
-
-.. code:: c++
-
-    RELAY_REGISTER_OP("cumsum")
-        .describe(
-            R"doc(Return the cumulative sum of the elements along a given axis.)doc" TVM_ADD_FILELINE)
-        .set_num_inputs(1)
-        .add_argument("data", "Tensor", "The input tensor.")
-        .set_support_level(3)
-        .add_type_rel("Cumsum", ScanopRel)
-        .set_attr<TOpPattern>("TOpPattern", kOpaque);
-
-    RELAY_REGISTER_OP("cumprod")
-        .describe(
-            R"doc(Return the cumulative product of the elements along a given axis.)doc" TVM_ADD_FILELINE)
-        .set_num_inputs(1)
-        .add_argument("data", "Tensor", "The input tensor.")
-        .set_support_level(3)
-        .add_type_rel("Cumprod", ScanopRel)
-        .set_attr<TOpPattern>("TOpPattern", kOpaque);
-
-In this case the ``TOpPattern`` is a hint to the compiler on the pattern of computation the operator does, which might be
-useful for fusing operators. ``kOpaque`` tells TVM to not bother trying to fuse this operator.
-
-4. Defining the Compute of the Operation
-----------------------------------------
-
-While we've now defined the interface for our operations we still need to define
-how to perform the actual calculations for cumulative sum and product.
-
-Writing this code is outside the scope of the tutorial. For now, we assume we
-have a well tested implementation for the operation's compute. For more details
-on how to do this, we recommend looking up the tutorials on :ref:`tensor
-expressions <tutorial-tensor-expr-get-started>`, :ref:`TVM's operator inventory
-(topi) <tutorial-topi>` and looking at the example cumulative sum and product
-implementations found in `python/tvm/topi/scan.py`_ and the gpu versions in
-`python/tvm/topi/cuda/scan.py`_.
-
-.. _python/tvm/topi/scan.py: https://github.com/apache/tvm/blob/main/python/tvm/topi/scan.py
-.. _python/tvm/topi/cuda/scan.py: https://github.com/apache/tvm/blob/main/python/tvm/topi/cuda/scan.py
-
-1. Hooking up Compute and Strategy with Relay
----------------------------------------------
-
-After you have implemented your compute function we now need to glue it to our
-relay operation. Within TVM this means not only defining the computation, but also the schedule
-for an operation. A strategy is a method which picks which computation and which schedule
-to use. For example, for 2D convolutions we might recognize we are doing a depthwise convolution
-and dispatch to a more efficient computation and schedule as a result. In our case however we have
-no such need except for dispatching between our CPU and GPU implementations. In
-``python/tvm/relay/op/strategy/generic.py`` and ``python/tvm/relay/op/strategy/cuda.py`` we
-add the following strategies:
-
-.. code:: python
-
-    def wrap_compute_scanop(topi_compute):
-        """Wrap scanop style topi compute"""
-
-        def _compute_scanop(attrs, inputs, _):
-            return [topi_compute(inputs[0], attrs.axis, attrs.dtype, attrs.exclusive)]
-
-        return _compute_scanop
-
-
-    @override_native_generic_func("cumsum_strategy")
-    def cumsum_strategy(attrs, inputs, out_type, target):
-        """cumsum generic strategy"""
-        strategy = _op.OpStrategy()
-        strategy.add_implementation(
-            wrap_compute_scanop(topi.cumsum),
-            wrap_topi_schedule(topi.generic.schedule_extern),
-            name="cumsum.generic",
-        )
-        return strategy
-
-
-    @override_native_generic_func("cumprod_strategy")
-    def cumprod_strategy(attrs, inputs, out_type, target):
-        """cumprod generic strategy"""
-        strategy = _op.OpStrategy()
-        strategy.add_implementation(
-            wrap_compute_scanop(topi.cumprod),
-            wrap_topi_schedule(topi.generic.schedule_extern),
-            name="cumprod.generic",
-        )
-        return strategy
-
-    @cumsum_strategy.register(["cuda", "gpu"])
-    def cumsum_strategy_cuda(attrs, inputs, out_type, target):
-        """cumsum cuda strategy"""
-        strategy = _op.OpStrategy()
-        strategy.add_implementation(
-            wrap_compute_scanop(topi.cuda.cumsum),
-            wrap_topi_schedule(topi.cuda.schedule_scan),
-            name="cumsum.cuda",
-        )
-        return strategy
-
-
-    @cumprod_strategy.register(["cuda", "gpu"])
-    def cumprod_strategy_cuda(attrs, inputs, out_type, target):
-        """cumprod cuda strategy"""
-        strategy = _op.OpStrategy()
-        strategy.add_implementation(
-            wrap_compute_scanop(topi.cuda.cumprod),
-            wrap_topi_schedule(topi.cuda.schedule_scan),
-            name="cumprod.cuda",
-        )
-        return strategy
-
-Where in each strategy we define the compute we wrote and the schedule to use within ``add_implementation()``.
-We finally link the strategy and compute with the defined relay operator in ``python/tvm/relay/op/_transform.py``:
-
-.. code:: python
-
-    # cumsum
-    @_reg.register_compute("cumsum")
-    def compute_cumsum(attrs, inputs, output_type):
-        """Compute definition of cumsum"""
-        return [topi.cumsum(inputs[0], attrs.axis, attrs.dtype, attrs.exclusive)]
-
-
-    _reg.register_strategy("cumsum", strategy.cumsum_strategy)
-    _reg.register_shape_func("cumsum", False, elemwise_shape_func)
-
-    # cumprod
-    @_reg.register_compute("cumprod")
-    def compute_cumprod(attrs, inputs, output_type):
-        """Compute definition of cumprod"""
-        return [topi.cumprod(inputs[0], attrs.axis, attrs.dtype, attrs.exclusive)]
-
-
-    _reg.register_strategy("cumprod", strategy.cumprod_strategy)
-    _reg.register_shape_func("cumprod", False, elemwise_shape_func)
-
-The shape functions are used for determining output shape given a dynamically shaped tensor. In this
-case we tell TVM the output shape will be the same as the input shape.
-
-6. Creating a Relay Call Node and Exposing a Python Hook
---------------------------------------------------------
-We now have a working operation and now just need to properly call it
-via a Relay Call Node. This step requires simply writing a function that takes
-the arguments to the operator (as Relay expressions) and
-returning a call node to the operator (i.e., the node that
-should be placed into the Relay AST where the call to the
-operator is intended).
-
-At present call attributes and type arguments (the last two fields)
-are not supported, so it suffices to use ``Op::Get`` to fetch
-the operator's information from the operator registry and pass in
-the arguments to the call node, as below. In ``src/relay/op/tensor/transform.cc``:
-
-.. code:: c++
-
-    Expr MakeCumsum(Expr data, Integer axis, DataType dtype, Bool exclusive) {
-        auto attrs = make_object<ScanopAttrs>();
-        attrs->dtype = dtype;
-        attrs->axis = axis;
-        attrs->exclusive = exclusive;
-        static const Op& op = Op::Get("cumsum");
-        return Call(op, {data}, Attrs(attrs), {});
-    }
-
-    TVM_REGISTER_GLOBAL("relay.op._make.cumsum").set_body_typed(MakeCumsum);
-
-    Expr MakeCumprod(Expr data, Integer axis, DataType dtype, Bool exclusive) {
-        auto attrs = make_object<ScanopAttrs>();
-        attrs->dtype = dtype;
-        attrs->axis = axis;
-        attrs->exclusive = exclusive;
-        static const Op& op = Op::Get("cumprod");
-        return Call(op, {data}, Attrs(attrs), {});
-    }
-
-    TVM_REGISTER_GLOBAL("relay.op._make.cumprod").set_body_typed(MakeCumprod);
-
-Where ``TVM_REGISTER_GLOBAL`` exposes the ``MakeCumsum`` and ``MakeCumprod`` functions
-in Python via ``relay.op._make.cumsum(...)`` and ``relay.op._make.cumprod(...)``.
-
-7. Including a Cleaner Python API Hook
---------------------------------------
-
-It is generally the convention in Relay, that functions exported
-through ``TVM_REGISTER_GLOBAL`` should be wrapped in a separate
-Python function rather than called directly in Python. For our
-operators we expose this cleaner interface in ``python/tvm/relay/op/transform.py``
-
-.. code:: python
-
-    def cumsum(data, axis=None, dtype=None, exclusive=None):
-        return _make.cumsum(data, axis, dtype, exclusive)
-
-    def cumprod(data, axis=None, dtype=None, exclusive=None):
-        return _make.cumprod(data, axis, dtype, exclusive)
-
-Note that these Python wrappers might also be good opportunities to
-provide an easier interface to the operator. For example, the
-``concat`` operator is registered as taking only one operator,
-namely a tuple with the tensors to be concatenated, but the Python
-wrapper takes the tensors as arguments and combines them into a tuple
-before producing the call node:
-
-.. code:: python
-
-    def concat(*args):
-        """Concatenate the input tensors along the zero axis.
-
-        Parameters
-        ----------
-        args: list of Tensor
-
-        Returns
-        -------
-        tensor: The concatenated tensor.
-        """
-        tup = Tuple(list(args))
-        return _make.concat(tup)
-
-8. Writing Unit Tests!
-----------------------
-This is self explanatory! Some example unit tests can be found in
-`tests/python/relay/test_op_level3.py`_ for our cumulative sum
-and product operators.
-
-.. _tests/python/relay/test_op_level3.py: https://github.com/apache/tvm/blob/main/tests/python/relay/test_op_level3.py
-
-
-Other Topics
-------------
-
-Gradient Operators
-~~~~~~~~~~~~~~~~~~
-
-Gradient operators are important for writing differentiable programs in
-Relay. While it is the case that Relay's autodiff algorithm can differentiate
-first-class language constructs, operators are opaque. Because Relay can't
-look into the implementation, an explicit differentiation rule must be
-provided.
-
-Both Python and C++ can be used to write gradient operators, but we focus our
-examples on Python, as it is more commonly used.
-
-Adding a Gradient in Python
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-A collection of Python gradient operators can be found in
-``python/tvm/relay/op/_tensor_grad.py``. We will walk through two
-representative examples: ``sigmoid`` and ``multiply``.
-
-.. code:: python
-
-    @register_gradient("sigmoid")
-    def sigmoid_grad(orig, grad):
-        """Returns [grad * sigmoid(x) * (1 - sigmoid(x))]."""
-        return [grad * orig * (ones_like(orig) - orig)]
-
-The inputs here are the original operator ``orig`` and a gradient ``grad`` to
-accumulate into. What we return is a list, where the element at the i'th
-index is the derivative of the operator with respect to the operator's i'th
-input. In general, the gradient will return a list with as many elements as
-there are inputs to the base operator.
-
-Before we further analyze this definition, first we should recall the
-derivative of the sigmoid function: :math:`\frac{\partial \sigma}{\partial x}
-= \sigma(x)(1 - \sigma(x))`. The definition above looks similar to the
-mathematical definition, but there is one important addition, which we
-describe below.
-
-The term ``orig * (ones_like(orig) - orig)`` directly matches the derivative,
-because ``orig`` here is the sigmoid function, but we're not just interested
-in how to compute the gradient of this function. We're interested in
-composing this gradient with other gradients, so we can accumulate the
-gradient across an entire program. This is where the ``grad`` term comes in.
-In the expression ``grad * orig * (ones_like(orig) - orig)``, multiplying by
-``grad`` specifies how to compose the derivative with the gradient thus far.
-
-Now, we consider ``multiply``, a slightly more interesting example:
-
-.. code:: python
-
-    @register_gradient("multiply")
-    def multiply_grad(orig, grad):
-        """Returns [grad * y, grad * x]"""
-        x, y = orig.args
-        return [collapse_sum_like(grad * y, x),
-                collapse_sum_like(grad * x, y)]
-
-In this example, there are two elements in the returned list, because
-``multiply`` is a binary operator. And to recall, if :math:`f(x, y) = xy`, the
-partial derivatives are :math:`\frac{\partial f}{\partial x} = y` and
-:math:`\frac{\partial f}{\partial y} = x`.
-
-There is one required step for ``multiply`` that is not required for
-``sigmoid``, because ``multiply`` has broadcasting semantics. Since the shape
-of ``grad`` might not match the shape of the inputs, we use
-``collapse_sum_like`` to take the contents of the ``grad * <var>`` terms and
-make the shape match the shape of the input we're differentiating with
-respect to.
-
-Adding a Gradient in C++
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-Adding a gradient in C++ is similar to adding one in Python, but the
-interface for registering is slightly different.
-
-First, make sure ``src/relay/transforms/pattern_utils.h`` is included. It provides
-helper functions for creating nodes in the Relay AST. Then, define the
-gradient in a similar fashion as in the Python example:
-
-.. code:: c
-
-    tvm::Array<Expr> MultiplyGrad(const Expr& orig_call, const Expr& output_grad) {
-        const Call& call = orig_call.Downcast<Call>();
-        return { CollapseSumLike(Multiply(output_grad, call.args[1]), call.args[0]),
-                 CollapseSumLike(Multiply(output_grad, call.args[0]), call.args[1]) };
-    }
-
-Notice that in C++ we can't use the same operator overloading that we have in
-Python, and we need to downcast, so the implementation is more verbose. Even
-so, we can easily verify that this definition mirrors the earlier example in
-Python.
-
-Now, instead of using a Python decorator, we need to tack a ``set_attr`` call
-for "FPrimalGradient" onto the end of the base operator's registration, in
-order to register the gradient.
-
-.. code:: c
-
-    RELAY_REGISTER_OP("multiply")
-        // ...
-        // Set other attributes
-        // ...
-        .set_attr<FPrimalGradient>("FPrimalGradient", MultiplyGrad);
diff --git a/docs/dev/how_to/relay_add_pass.rst b/docs/dev/how_to/relay_add_pass.rst
deleted file mode 100644
index 90211d0c98..0000000000
--- a/docs/dev/how_to/relay_add_pass.rst
+++ /dev/null
@@ -1,406 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-.. _relay-add-pass:
-
-Adding a Compiler Pass to Relay
-===============================
-
-Compiler passes are the primary interface for both extending Relay's feature
-set and for performing optimizations on Relay programs. By writing a compiler
-pass, you can modify the AST or collect information about the AST,
-depending on your goal. Indeed, some of Relay's most important built-in
-features (e.g., autodiff and type inference) are nothing more than "standard"
-compiler passes.
-
-At a high level, there are two key components to writing a pass:
-
-- Creating one or more C++ classes that traverse the program
-- Wrapping the traversal implementation and its metadata in the pass manager API so it can neatly interface with the :ref:`pass-infra`
-
-To begin, we'll give an overview of the key mechanisms for writing a compiler
-pass. Then, we'll walk through a concrete example of the constant-folding
-pass in Relay.
-
-AST Traversers
---------------
-
-The base class used to traverse Relay programs is ``ExprFunctor``. The public
-interface it provides is a ``VisitExpr`` method that takes an expression and
-zero or more arguments and returns an instance of some type. When you extend
-this class, you define the AST traversal pattern by overriding
-implementations of ``VisitExpr_`` for each type of expression.
-
-The relation between ``VisitExpr`` and ``VisitExpr_`` has to do with
-dispatch. Each ``VisitExpr_`` definition targets a specific type of
-expression, but you don't always know which node type you'll be visiting.
-To remedy this, ``ExprFunctor`` provides a ``VisitExpr`` function which
-routes from the given expression to the ``VisitExpr_`` case that handles it.
-Although C++ already provides dynamic dispatch, ``ExprFunctor`` defines its
-own vtable, which ``VisitExpr`` uses. By defining our own vtable, we have
-more control over dispatch. For example, if we wanted to define a
-``PrintVisitor`` traverser that printed "Here" before every visit, we
-could override ``VisitExpr``:
-
-.. code:: c
-
-    void PrintVisitor::VisitExpr(const Expr& expr) {
-      std::cout << "Here" << std::endl;
-      ExprFunctor::VisitExpr(expr);
-    }
-
-``ExprFunctor`` itself is a very general class, which is why more often than
-not, you will be extending ``ExprVisitor`` or ``ExprMutator``. These classes
-extend ``ExprFunctor`` and provide default implementations of ``VisitExpr_``
-that capture common traversal patterns for each expression type. Having these
-default implementations means we only need to provide overriding
-implementations for the expression types where we want different behavior. We
-describe each subclass on its own in the following sections.
-
-Expression Visitors
-~~~~~~~~~~~~~~~~~~~
-
-``ExprVisitor`` is for passes that don't modify the program and instead
-perform program analyses and collect information. With this class,
-``VisitExpr`` and the private counterparts return nothing. The ``VisitExpr_``
-implementations provided by this class simply visit all of the expression's
-fields that are expressions. The default implementation for ``IfNode`` is
-shown below.
-
-.. code:: c
-
-    void ExprVisitor::VisitExpr_(const IfNode* op) {
-      this->VisitExpr(op->cond);
-      this->VisitExpr(op->true_branch);
-      this->VisitExpr(op->false_branch);
-    }
-
-Note that we're calling ``VisitExpr`` and not ``VisitExpr_`` here, so we can
-use the vtable in ``ExprFunctor`` for routing.
-
-Now, if we wanted to write a class ``CallChecker`` that checks if any
-function calls appear in the program, we would only need to extend
-``ExprVisitor`` and define the following ``VisitExpr_`` method:
-
-.. code:: c
-
-    void VisitExpr_(const CallNode* n) final {
-      result_ = true;
-    }
-
-where ``result_`` is a field. In this case, we don't need to further recurse
-on the fields of the ``CallNode``, because ``result_`` is already true and we
-now know the original expression contains a call. To make this visitor
-usable, we would provide the following public method:
-
-.. code:: c
-
-    bool Check(const Expr& expr) final {
-      result_ = false;
-      VisitExpr(expr);
-      return result_;
-    }
-
-And that's all we need. It is very common to define a public interface that
-performs some bookkeeping before invoking the top-level recursion. We could
-of course further wrap the API by making a standalone procedure that creates
-a ``CallChecker`` instance and calls ``Check`` on it, but the takeaway is
-that we've achieved our goal with very little effort.
-
-Expression Mutators
-~~~~~~~~~~~~~~~~~~~
-
-``ExprMutator`` is for passes that transform the program in some way. With
-this class, ``VisitExpr`` and its private counterparts return ``Expr``. The
-default ``VisitExpr_`` implementations provided by this class visit all of
-the expression's fields that are expressions and set the fields to be the
-result of visiting them. The default implementation for ``TupleGetItemNode``
-is shown below.
-
-.. code:: c
-
-    Expr ExprMutator::VisitExpr_(const TupleGetItemNode* g) {
-      auto t = this->Mutate(g->tuple);
-      if (g->tuple == t) {
-        return GetRef<Expr>(g);
-      } else {
-        return TupleGetItem(t, g->index);
-      }
-    }
-
-There are a few things to notice here. First, ``Mutate`` is an alias for
-``VisitExpr`` in ``ExprMutator``. Second, we only return a new node if the
-call to ``Mutate`` modified the ``tuple`` field. This method of update is
-called a functional update and doing so avoids unnecessary allocations.
-
-One feature ``ExprMutator`` has that ``ExprVisitor`` doesn't is a built-in
-``memo_`` field for caching results. It makes sense that ``ExprMutator`` has
-a memoizer, because we know which types of results we're caching (i.e.,
-``Expr``), whereas the visit methods of ``ExprVisitor`` don't return
-anything. Usually, when we want to cache results in a subclass of
-``ExprVisitor``, we need to define the cache ourselves.
-
-Now, if we wanted to write a class ``IfCollapser`` that replaces every if
-statement with its true branch, we would override ``VisitExpr_`` for
-``IfNode``:
-
-.. code:: c
-
-    Expr ExprMutator::VisitExpr_(const IfNode* op) {
-      return this->Mutate(op->true_branch);
-    }
-
-Note that the returned expression will not necessarily be an ``IfNode``, and
-this is fine, because the return type is ``Expr``. Now, we create the public
-interface:
-
-.. code:: c
-
-    Expr CollapseIfs(const Expr& expr) final {
-      return this->Mutate(expr);
-    }
-
-With this mutator, we didn't need to do any bookkeeping, but we still want to
-follow the convention of having a descriptive method as the interface.
-
-Example: Constant Folding
--------------------------
-
-In order to better understand the process of writing a pass, we will look at
-the constant folding pass (found in `src/relay/transforms/fold_constant.cc`_)
-as a guide, because it is a relatively simple pass that incorporates
-both types of traversals.
-
-Constant folding involves evaluating expressions in the program that only
-involve constant values, then replacing those expressions with the result
-of evaluating them. The goal of this pass is to frontload all of the
-computations that we can. To achieve this, the constant folding pass makes
-use of a visitor (``ConstantChecker``) and a mutator (``ConstantFolder``).
-
-The ``ConstantChecker`` Visitor
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-This visitor is used to check if an expression is constant. In Relay, we
-define an expression to be constant if it is a ``ConstantNode`` or it is a
-``TupleNode`` with only constant fields.
-
-We use a ``memo_`` field to map from nodes to whether they are constant and
-to cache these results. Below are the ``VisitExpr_`` definitions in the
-``ConstantChecker``.
-
-.. code:: c
-
-    void VisitExpr_(const ConstantNode* n) final {
-      memo_[GetRef<Constant>(n)] = true;
-    }
-
-    void VisitExpr_(const TupleNode* n) final {
-      bool result = true;
-      for (const auto& field : n->fields) {
-        if (!Check(field)) {
-          result = false;
-          break;
-        }
-      }
-      memo_[GetRef<Tuple>(n)] = result;
-    }
-
-The bookkeeping used to coordinate these definitions is a ``Check`` method
-that returns whether the given expression is considered constant.
-
-.. code:: c
-
-    bool Check(const Expr& expr) {
-      const auto it = memo_.find(expr);
-      if (it != memo_.end())
-        return it->second;
-      VisitExpr(expr);
-      return memo_[expr];
-    }
-
-We don't modify ``memo_`` for every node we encounter; instead we only modify
-``memo_`` when the encountered node could potentially be constant. Then we
-rely on the default value being false when ``memo_`` doesn't contain
-``expr``.
-
-The ``ConstantFolder`` Mutator
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-This mutator performs the bulk of the constant folding pass and internally
-uses ``ConstantChecker``. In Relay, there are three node types that are
-involved in constant folding: ``LetNode``, ``TupleItemGetNode``, and
-``CallNode``. In the following paragraphs, we explain the roles of each in
-the pass.
-
-.. code:: c
-
-    Expr VisitExpr_(const LetNode* op) final {
-      Expr value = this->Mutate(op->value);
-      if (value.as<ConstantNode>()) {
-        memo_[op->var] = value;
-        return this->Mutate(op->body);
-      } else {
-        Var var = Downcast<Var>(this->Mutate(op->var));
-        Expr body = this->Mutate(op->body);
-        if (var.same_as(op->var) &&
-            value.same_as(op->value) &&
-            body.same_as(op->body)) {
-          return GetRef<Expr>(op);
-        } else {
-          return Let(var, value, body);
-        }
-      }
-    }
-
-In the ``LetNode`` case, we first attempt to const-fold the value being bound
-in the expression. If we can, then we populate ``memo_`` and return the
-result of visiting the body---essentially, propagating the bound value to its
-use sites in the body. If we can't const-fold the bound value, we mimic the
-default implementation.
-
-.. code:: c
-
-    Expr VisitExpr_(const TupleGetItemNode* op) final {
-      Expr res = ExprMutator::VisitExpr_(op);
-      op = res.as<TupleGetItemNode>();
-      if (const auto* tuple = op->tuple.as<TupleNode>()) {
-        return tuple->fields[op->index];
-      } else {
-        return res;
-      }
-    }
-
-In the ``TupleItemGetNode`` case, we check if ``op->tuple`` field is a
-``TupleNode``. If so, we replace the tuple get with the field of the tuple
-pointed to by ``op->index``. The reason we need to check is because
-``op->tuple`` might evaluate to a tuple, without itself being a tuple.
-
-.. code:: c
-
-    Expr VisitExpr_(const CallNode* call) final {
-      static auto op_stateful = Op::GetAttrMap<TOpIsStateful>("TOpIsStateful");
-      Expr res = ExprMutator::VisitExpr_(call);
-      call = res.as<CallNode>();
-      // We don't constant fold function with zero arguments.
-      // This is a heuristic that is useful.
-      // For example it is harmful to fold ones(shape=(4, 5)).
-      if (call->args.size() == 0) return res;
-      const OpNode* op = call->op.as<OpNode>();
-      if (op == nullptr) return res;
-      // skip stateful ops.
-      if (op_stateful.get(GetRef<Op>(op), false)) return res;
-      bool all_const_args = true;
-      for (Expr arg : call->args) {
-        if (!checker_.Check(arg)) {
-          all_const_args = false;
-        }
-      }
-      if (all_const_args) {
-        return ConstEvaluate(res);
-      } else {
-        return res;
-      }
-    }
-
-In the ``CallNode`` case, we first use the ``VisitExpr_`` of ``ExprMutator``
-to visit the call, which const-folds all of the fields of the call. We use
-``ExprMutator::VisitExpr_`` instead of ``VisitExpr``, because we want to
-bypass the vtable (to avoid an infinite loop) and use the default
-implementation provided by ``ExprMutator``. Then we evaluate the call only if
-all of the arguments are constant (using ``ConstantChecker``). Evaluating the
-call produces a **value**, so we use a helper method ``ValueToExpr`` to allow
-us to place the evaluated expression back into the AST.
-
-Now, we construct a more convenient interface ``FoldConstant`` for our constant
-folder. ``FoldConstant`` is a standalone function outside of the ``ConstantFolder``
-class that takes an expression and internally creates and uses a
-``ConstantFolder`` instance (the full definition can be found in
-`src/relay/transforms/fold_constant.cc`_).
-
-
-Registering a Pass with the Pass Manager
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-*Note: please see the documentation on the :ref:`pass-infra` for more specific detail on this subject.*
-
-With the AST traversers written, the pass can be registered to become a TVM
-API endpoint with the following code:
-
-.. code:: c
-
-    namespace transform {
-
-    Pass FoldConstant() {
-      runtime::TypedPackedFunc<Function(Function, Module, PassContext)> pass_func =
-        [=](Function f, Module m, PassContext pc) {
-          return Downcast<Function>(FoldConstant(f));
-      };
-      return CreateFunctionPass(pass_func, 2, "FoldConstant", {});
-    }
-
-    }  // namespace transform
-
-If the ``Pass`` object produced by the above code is given to the pass infrastructure,
-it will ensure that the AST traversal is applied to every function in the
-given Relay module, which is the behavior one would expect for a constant folding
-pass (it should fold all constants where possible).
-
-The function ``CreateFunctionPass``
-allows for registering the optimization level of the pass (in this case, 2), which can
-be used to group together passes based on their general utility, a name for the pass,
-and any dependencies for the pass. A pass's dependencies are given as a list of any passes
-whose results are necessary to be able to run the current pass. ``FoldConstant`` does not
-have any dependencies, but many Relay passes do depend on having type information,
-so ``InferType`` is a common dependency; others may depend on the program's being in
-A-normal form, via the ``ToANormalForm`` pass.
-
-Note that the ``PassContext`` object contains information a pass uses for
-error reporting and configuration options; ``FoldConstant`` does not need
-this information but other passes may reference their ``PassContext`` objects.
-
-The pass can now be invoked via the pass infrastructure, though it's a good idea to
-also add a Python binding for the pass, as in this code snippet:
-
-.. code:: c
-
-   TVM_REGISTER_GLOBAL("relay._transform.FoldConstant")
-   .set_body_typed(FoldConstant);
-
-Once ``Pass`` objects are defined in the above fashion, they can be invoked using the
-pass infrastructure's ``Sequential`` construct, which takes a list of passes and applies
-them in sequence to a Relay module, obtaining a transformed module as a result. For example,
-the below code applies both the ``FoldConstant`` and ``ToANormalForm`` passes
-(one after the other) to each function in ``mod`` and obtains a new module.
-
-.. code:: python
-
-    seq = transform.Sequential([
-        relay.transform.FoldConstant(),
-        relay.transform.ToANormalForm()
-    ])
-    new_mod = seq(mod)
-
-More detail about registration can be found in :ref:`tvm-runtime-system` and more
-information about the pass manager interface can be found in :ref:`pass-infra`.
-Relay's standard passes are listed in `include/tvm/relay/transform.h`_ and implemented
-in `src/relay/transforms/`_.
-
-.. _include/tvm/relay/transform.h: https://github.com/apache/tvm/blob/main/include/tvm/relay/transform.h
-
-.. _src/relay/transforms/: https://github.com/apache/tvm/tree/main/src/relay/transforms
-
-.. _src/relay/transforms/fold_constant.cc: https://github.com/apache/tvm/blob/main/src/relay/transforms/fold_constant.cc
diff --git a/docs/dev/how_to/relay_bring_your_own_codegen.rst b/docs/dev/how_to/relay_bring_your_own_codegen.rst
deleted file mode 100644
index c106bb2a63..0000000000
--- a/docs/dev/how_to/relay_bring_your_own_codegen.rst
+++ /dev/null
@@ -1,960 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-.. _relay-bring-your-own-codegen:
-
-=============================
-Bring Your Own Codegen To TVM
-=============================
-
-As the number of hardware devices targeted by deep learning workloads keeps increasing, the required knowledge for users to achieve high performance on various devices keeps increasing as well. To free data scientists from worrying about the performance when developing a new model, hardware backend providers either provide libraries such as DNNL(Intel OneDNN) or cuDNN with many commonly used deep learning operators, or provide frameworks such as TensorRT to let users describe their model [...]
-
-In this developer guide, we demonstrate how you, as a hardware backend provider, can easily implement your own codegen and register it as a Relay backend compiler to support your hardware device/library. This guide covers two types of codegen based on different graph representations you need:
-
-**1. You want to generate C code.**
-
-If your hardware already has a well-optimized C/C++ library, such as Intel CBLAS/MKL to CPU and NVIDIA CUBLAS to GPU, then this is what you are looking for. Fortunately, C source code module is fully compatible with TVM runtime module, which means the generated code could be compiled by any C/C++ compiler with proper compilation flags, so the only task you have is to implement a codegen that generates C code for subgraphs and a C source module to integrate into TVM runtime module. We wil [...]
-
-**2. You want to generate any other graph representations.**
-
-Your hardware may require other forms of graph representation, such as JSON. In this case, you need to implement not only a codegen but also a customized TVM runtime module to let TVM runtime know how this graph representation should be executed. If you already have a complete graph execution engine for your hardware, such as TensorRT for GPU, then this is a solution you can consider.
-
-After you finish the codegen and runtime, you can then let your customers annotate their models with your customized tag to make use of them. The tutorial for end-users to annotate and launch a specific codegen is **here (TBA)**.
-
-*********************
-Implement a C Codegen
-*********************
-
-In this part, we demonstrate how to implement a codegen that generates C code with pre-implemented operator functions. To simplify, our example codegen does not depend on third-party libraries. Instead, we manually implement two macros in C:
-
-.. code-block:: c++
-
-    #define CSOURCE_BINARY_OP_1D(p_ID_, p_OP_, p_DIM1_)         \
-        extern "C" void p_ID_(float* a, float* b, float* out) { \
-            for (int64_t i = 0; i < p_DIM1_; ++i) {             \
-                out[i] = a[i] p_OP_ b[i];                       \
-            }                                                   \
-        }
-
-    #define CSOURCE_BINARY_OP_2D(p_ID_, p_OP_, p_DIM1_, p_DIM2_)  \
-        extern "C" void p_ID_(float* a, float* b, float* out) {   \
-            for (int64_t i = 0; i < p_DIM1_; ++i) {               \
-                for (int64_t j = 0; j < p_DIM2_; ++j) {           \
-                    int64_t k = i * p_DIM2_ + j;                  \
-                    out[k] = a[k] p_OP_ b[k];                     \
-                }                                                 \
-            }                                                     \
-        }
-
-With the two macros, we can generate binary operators for 1-D and 2-D tensors. For example, given a subgraph as follows. Assuming all inputs are 2-D tensors with shape (10, 10).
-
-::
-
-    c_compiler_input0
-           |
-          add <-- c_compiler_input1
-           |
-        subtract <-- c_compiler_input2
-           |
-        multiply <-- c_compiler_input3
-           |
-          out
-
-Our goal is to generate the following compilable code to execute the subgraph:
-
-.. code-block:: c++
-
-    #include <tvm/runtime/c_runtime_api.h>
-    #include <tvm/runtime/packed_func.h>
-    #include <dlpack/dlpack.h>
-    #include <cstdint>
-    #include <cstring>
-    #include <iostream>
-
-    #define GCC_BINARY_OP_1D(p_ID_, p_OP_, p_DIM1_)           \
-      extern "C" void p_ID_(float* a, float* b, float* out) { \
-        for (int64_t i = 0; i < p_DIM1_; ++i) {               \
-          out[i] = a[i] p_OP_ b[i];                           \
-        }                                                     \
-      }
-
-    #define GCC_BINARY_OP_2D(p_ID_, p_OP_, p_DIM1_, p_DIM2_)  \
-      extern "C" void p_ID_(float* a, float* b, float* out) { \
-        for (int64_t i = 0; i < p_DIM1_; ++i) {               \
-          for (int64_t j = 0; j < p_DIM2_; ++j) {             \
-            int64_t k = i * p_DIM2_ + j;                      \
-            out[k] = a[k] p_OP_ b[k];                         \
-          }                                                   \
-        }                                                     \
-      }
-
-    // Note 1
-    GCC_BINARY_OP_2D(gcc_0_0, *, 10, 10);
-    GCC_BINARY_OP_2D(gcc_0_1, -, 10, 10);
-    GCC_BINARY_OP_2D(gcc_0_2, +, 10, 10);
-
-    // Note 2
-    extern "C" void gcc_0_(float* gcc_input0, float* gcc_input1,
-                           float* gcc_input2, float* gcc_input3, float* out) {
-      float* buf_0 = (float*)malloc(4 * 100);
-      float* buf_1 = (float*)malloc(4 * 100);
-      gcc_0_2(gcc_input0, gcc_input1, buf_0);
-      gcc_0_1(buf_0, gcc_input2, buf_1);
-      gcc_0_0(buf_1, gcc_input3, out);
-      free(buf_0);
-      free(buf_1);
-    }
-
-    // Note 3
-    extern "C" int gcc_0_wrapper(DLTensor* arg0, DLTensor* arg1, DLTensor* arg2,
-                                 DLTensor* arg3, DLTensor* out) {
-      gcc_0_(static_cast<float*>(arg0->data), static_cast<float*>(arg1->data),
-             static_cast<float*>(arg2->data), static_cast<float*>(arg3->data),
-             static_cast<float*>(out->data));
-      return 0;
-    }
-    TVM_DLL_EXPORT_TYPED_FUNC(gcc_0, gcc_0_wrapper);
-
-Here we highlight the notes marked in the above code:
-
-* **Note 1** is the function implementation for the three nodes in the subgraph.
-
-* **Note 2** is a function to execute the subgraph by allocating intermediate buffers and invoking corresponding functions.
-
-* **Note 3** is a TVM runtime compatible wrapper function. It accepts a list of input tensors and one output tensor (the last argument), casts them to the right data type, and invokes the subgraph function described in Note 2. In addition, ``TVM_DLL_EXPORT_TYPED_FUNC`` is a TVM macro that generates another function ``gcc_0`` with unified the function arguments by packing all tensors to ``TVMArgs``. As a result, the TVM runtime can directly invoke ``gcc_0`` to execute the subgraph without [...]
-
-In the rest of this section, we will implement a codegen step-by-step to generate the above code. Your own codegen has to be located at ``src/relay/backend/contrib/<your-codegen-name>/``. In our example, we name our codegen "codegen_c" and put it under `/src/relay/backend/contrib/codegen_c/ <https://github.com/apache/tvm/blob/main/src/relay/backend/contrib/codegen_c/codegen.cc>`_. Feel free to check this file for a complete implementation.
-
-Specifically, we are going to implement two classes in this file and here is their relationship:
-
-::
-
-                       subgraph                                subgraph
-  TVM backend -----------------------------> CSourceCodegen -------------> CodegenC
-         ^                                       |    ^                       |
-         |                                       |    |                       |
-         ----------------------------------------      ------------------------
-            generated C source runtime module              generated C code
-
-When TVM backend finds a function (subgraph) in a Relay graph is annotated with the registered compiler tag (``ccompiler`` in this example), TVM backend invokes ``CSourceCodegen`` and passes the subgraph. ``CSourceCodegen``'s member function ``CreateCSourceModule`` will 1) generate C code for the subgraph, and 2) wrap the generated C code to a C source runtime module for TVM backend to compile and deploy. In particular, the C code generation is transparent to the ``CodegenC`` class becau [...]
-
-Implement CodegenC
-==================
-
-In ``src/relay/backend/contrib/codegen_c/codegen.cc``, we first create a codegen class skeleton under the namespace of ``tvm.relay.contrib``:
-
-.. code-block:: c++
-
-    #include <tvm/relay/expr_functor.h>
-    #include <tvm/relay/transform.h>
-    #include <tvm/relay/type.h>
-    #include <tvm/runtime/module.h>
-    #include <tvm/runtime/object.h>
-
-    #include <fstream>
-    #include <sstream>
-
-    #include "codegen_c.h"
-
-    namespace tvm {
-    namespace relay {
-    namespace contrib {
-
-    class CodegenC : public ExprVisitor, public CodegenCBase {
-      public:
-        explicit CodegenC(const std::string& id) { this->ext_func_id_ = id; }
-
-        void VisitExpr_(const VarNode* node) { ; }
-        void VisitExpr_(const CallNode* call) final { ; }
-        std::string JIT() { ; }
-
-      private:
-        /*! \brief The function id that represents a C source function. */
-        std::string ext_func_id_ = "";
-        /*! \brief The index of a wrapped C function. */
-        int func_idx = 0;
-        /*! \brief The index of allocated buffers. */
-        int buf_idx_ = 0;
-        /*! \brief The arguments of a C compiler compatible function. */
-        std::vector<std::string> ext_func_args_;
-        /*! \brief The statements of a C compiler compatible function. */
-        std::vector<std::string> ext_func_body;
-        /*! \brief The declaration statements of a C compiler compatible function. */
-        std::vector<std::string> func_decl_;
-        /*! \brief The declaration statements of buffers. */
-        std::vector<std::string> buf_decl_;
-        /*! \brief The name and index pairs for output. */
-        std::vector<std::pair<std::string, int>> out_;
-    }
-
-The ``CodegenC`` class inherits two classes: ``ExprVisitor`` provides abilities to traverse subgraphs and collects the required information and generate subgraph functions such as ``gcc_0_``; ``CodegenCBase`` provides abilities and utilities to generate wrapper functions such as ``gcc_0`` in the above example. As can be seen, we only need to implement three functions in this codegen class to make it work.
-
-Code Generation for Operators
------------------------------
-
-We first implement ``VisitExpr_(const CallNode* call)``. This function visits all call nodes when traversing the subgraph. Each call node contains an operator that we want to offload to your hardware. As a result, we need to generate the corresponding C code with correct operators in topological order. We implement this function step-by-step as follows.
-
-**1. Generate the function declaration**
-
-Example Result: ``GCC_BINARY_OP_2D(gcc_0_0, *, 10, 10);``
-
-To generate the function declaration, as shown above, we need 1) a function name (e.g., ``gcc_0_0``), 2) the type of operator (e.g., ``*``), and 3) the input tensor shape (e.g., ``(10, 10)``). Fortunately, this information can be obtained easily from ``CallNode``:
-
-.. code-block:: c++
-
-    std::ostringstream macro_stream;
-    std::ostringstream decl_stream;
-    std::ostringstream buf_stream;
-
-    // Generate a unique function name you like.
-    std::string func_name = ext_func_id_ + "_" + std::to_string(func_idx++);
-
-    // Make function declaration string.
-    macro_stream << "CSOURCE_BINARY_OP_" << call->args.size() << "D(" << func_name << ", ";
-
-    // Check the operator type.
-    if (IsOp(call, "add")) {
-      macro_stream << "+";
-    } else if (IsOp(call, "subtract")) {
-      macro_stream << "-";
-    } else if (IsOp(call, "multiply")) {
-      macro_stream << "*";
-    } else {
-      LOG(FATAL) << "Unrecognized op";
-    }
-
-    // Extract the input tensor shape.
-    auto in_shape = GetShape(call->args[0]->checked_type());
-    for (size_t i = 0; i < in_shape.size(); ++i) {
-      macro_stream << ", " << in_shape[i];
-    }
-    macro_stream << ");";
-    func_decl_.push_back(macro_stream.str());
-
-As can be seen, we push the generated code to class member variables ``func_decl_``. It means after we finish traversing the entire subgraph, we have collected all required function declarations and the only thing we need to do is having them compiled by GCC. The rest implementation of ``VisitExpr_(const CallNode* call)`` also follow this concept.
-
-**2. Generate the function call**
-
-Example Result: ``gcc_0_0(buf_1, gcc_input3, out);``
-
-After generating the function declaration, we need to generate a function call with proper inputs and outputs. To know which inputs or buffers we should put when calling this function, we have to visit its arguments:
-
-.. code-block:: c++
-
-    bool first = true;
-    decl_stream << func_name << "(";
-    for (size_t i = 0; i < call->args.size(); ++i) {
-      VisitExpr(call->args[i]); // Note 1
-      for (auto out : out_) {
-        if (!first) {
-          decl_stream << ", ";
-        }
-        first = false;
-        decl_stream << out.first;
-      }
-    }
-    // Note 2
-
-Again, we want to highlight the notes in the above code:
-
-**Note 1**: ``VisitExpr(call->args[i])`` is a recursive call to visit arguments of the current function. An argument could be an output of another node or an input tensor. In our example implementation, we make sure every node updates a class variable ``out_`` before leaving the visitor. Here is an illustration:
-
-::
-
-        arg_node                 arg_node <- Visit arg (Note 1)       arg_node
-           |                        |                                    |
-       curr_node <- Process      curr_node                            curr_node <- Put "buf_0" as an input buffer
-
-      (a) out_ = {}            (b) out_ = {}                   (c) out_ = {("buf_0", 20)}
-
-
-We can see in the above figure, class variable ``out_`` is empty before visiting the argument node, and it was filled with the output buffer name and size of ``arg_node``. As a result, when we finished visiting the argument node, we know the proper input buffer we should put by looking at ``out_``. You will find out how we update ``out_`` at the end of this section as well as the next section.
-
-**Note 2**: You may notice that we did not close the function call string in this step. The current function call string looks like: ``gcc_0_0(buf_1, gcc_input3``. This is because we have not put the last argument (i.e., the output) to this call. The output of a function call could be either an allocated temporary buffer or the subgraph output tensor. For simplify, in this example, we allocate an output buffer for every call node (next step) and copy the result in the very last buffer to [...]
-
-**3. Generate the output buffer**
-
-Example Result: ``float* buf_0 = (float*)malloc(4 * 100);``
-
-As mentioned in the previous step, in addition to the subgraph input and output tensors, we may also need buffers to keep the intermediate results. To generate the buffer, we extract the shape information to determine the buffer type and size:
-
-.. code-block:: c++
-
-    // This example only supports single output.
-    auto type_node = call->checked_type().as<TensorTypeNode>();
-    ICHECK(type_node != nullptr && runtime::TypeMatch(type_node->dtype, kDLFloat, 32))
-          << "Only support single output tensor with float type";
-
-    // Generate a unique buffer name.
-    std::string out = "buf_" + std::to_string(buf_idx_++);
-
-    // Extract the shape to be the buffer size.
-    auto out_shape = GetShape(call->checked_type());
-    int out_size = 1;
-    for (size_t i = 0; i < out_shape.size(); ++i) {
-      out_size *= out_shape[i];
-    }
-
-    // Make the buffer allocation and push to the buffer declarations.
-    buf_stream << "float* " << out << " = (float*)std::malloc(4 * " << out_size << ");";
-    buf_decl_.push_back(buf_stream.str());
-
-After we have allocated the output buffer, we can now close the function call string and push the generated function call to a class variable ``ext_func_body``.
-
-.. code-block:: c++
-
-    decl_stream << ", " << out << ");";
-    ext_func_body.push_back(decl_stream.str());
-
-**4. Update output buffer**
-
-To let the next node, which accepts the output of the current call node as its input, know which buffer it should take, we need to update the class variable ``out_`` before leaving this visit function:
-
-.. code-block:: c++
-
-    out_.clear();
-    out_.push_back({out, out_size});
-
-Congratulations! we have finished the most difficult function in this class. In the next two sections, we just need to make up some minor missing parts in this function.
-
-Code Generation for Input Variables
------------------------------------
-
-Recall that we collected the input buffer information by visiting the arguments of a call node (2nd step in the previous section), and handled the case when its argument is another call node (4th step). In this section, we demonstrate how to handle other nodes by taking ``VarNode`` as an example.
-
-``VarNode`` represents input tensors in a model. The only but important information it has is a name hint (e.g., ``data``, ``weight``, etc). When visiting a ``VarNode``, we simply update class variable ``out_`` to pass the name hint so that the descendant call nodes can generate the correct function call.
-
-.. code-block:: c++
-
-  void VisitExpr_(const VarNode* node) {
-    ext_func_args_.push_back(node->name_hint());
-    out_.clear();
-    out_.push_back({node->name_hint(), 0});
-  }
-
-Note that in this example we assume the subgraph we are offloading has only call nodes and variable nodes. If your subgraphs contain other types of nodes, such as ``TupleNode``, then you also need to visit them and bypass the output buffer information.
-
-Code Emitting
--------------
-
-The final part in this codegen class is a ``JIT`` function that emits a C function for the subgraph and uses the C code we just generated as the function body. Remember, in addition to the subgraph function we generated in the previous sections, we also need a wrapper function with a unified argument for TVM runtime to invoke and pass data. Fortunately, the base class we inherited already provides an implementation, ``JitImpl``, to generate the function. For example, we can invoke ``JitI [...]
-
-.. code-block:: c++
-
-  JitImpl("gcc_0" /* Subgraph symbol (ID) */,
-          {"gcc_input0", "gcc_input1", "gcc_input2", "gcc_input3"} /* Input arguments */,
-          {"float *buf_0 = (float*)malloc(4 * 20)", ...} /* Buffer allocations */,
-          {"gcc_0_2(gcc_input0, gcc_input1, buf_0);"} /* Function body */,
-          {"out"} /* Output */);
-
-The above call will generate three functions (one from the TVM wrapper macro):
-
-1. The subgraph function ``gcc_0_`` (with one more underline at the end of the function name) with all C code we generated to execute a subgraph.
-
-2. The wrapper function ``gcc_0__wrapper_`` with a list of ``DLTensor`` arguments that casts data to the right type and invokes ``gcc_0_``.
-
-3. The TVM runtime compatible function ``gcc_0`` with TVM unified function arguments that unpacks TVM packed tensors and invokes ``gcc_0__wrapper_``.
-
-Accordingly, the only thing we need in ``JIT`` implementation is passing all subgraph function code we generated to ``JitImpl``:
-
-.. code-block:: c++
-
-  std::string JIT() {
-    // Write function macros
-    for (auto decl : func_decl_) {
-      code_stream_ << decl << "\n";
-    }
-    return JitImpl(ext_func_id_, ext_func_args_, buf_decl_, ext_func_body, out_);
-  }
-
-All variables (``ext_func_id``, etc) we passed are class variables and were filled when we traversed the subgraph.
-
-Implement CSourceCodegen
-========================
-
-Again, let's create a class skeleton and implement the required functions. Note that it inherits ``CSourceModuleCodegenBase``
-
-.. code-block:: c++
-
-  class CSourceCodegen : public CSourceModuleCodegenBase {
-   public:
-    // Pass a subgraph function, and generate the C code.
-    void GenCFunc(const Function& func) { ; }
-
-    // Use GenCFunc to generate the C code and wrap it as a C source module.
-    runtime::Module CreateCSourceModule(const NodeRef& ref) override { ; }
-
-   private:
-    std::ostringstream code_stream_;
-  };
-
-Implement GenCFunc
-------------------
-
-``GenCFunc`` simply uses the ``CodegenC`` we just implemented to traverse a Relay function (subgraph) and obtains the generated C code. The builtin function ``GetExtSymbol`` retrieves a unique symbol name (e.g., ``gcc_0``) in the Relay function and we **must** use it as the C function name, because this symbol is going to be used for DSO runtime lookup.
-
-.. code-block:: c++
-
-  void GenCFunc(const Function& func) {
-    ICHECK(func.defined()) << "Input error: expect a Relay function.";
-
-    // Record the external symbol for runtime lookup.
-    auto sid = GetExtSymbol(func);
-
-    CodeGenC builder(sid);
-    builder.VisitExpr(func->body);
-    code_stream_ << builder.JIT();
-  }
-
-Implement CreateCSourceModule
------------------------------
-
-This function creates a runtime module for the external library. In this example, we create a CSourceModule that can be directly compiled and linked together with a TVM generated DSOModule. After you have implemented ``CodegenC``, implementing this function is relatively straightforward:
-
-.. code-block:: c++
-
-  runtime::Module CreateCSourceModule(const NodeRef& ref) override {
-    // Create headers
-    code_stream_ << "#include <cstdint>\n";
-    code_stream_ << "#include <iostream>\n";
-    code_stream_ << "#include <cstdlib>\n";
-    code_stream_ << "#include <stdio.h>\n";
-    code_stream_ << "#include <cstring>\n";
-    code_stream_ << "#include <tvm/runtime/c_runtime_api.h>\n";
-    code_stream_ << "#include <dlpack/dlpack.h>\n";
-
-    // Append some common macro for operator definition.
-    const char* operator_macro = R"op_macro(
-    #define CSOURCE_BINARY_OP_1D(p_ID_, p_OP_, p_DIM1_)       \
-      extern "C" void p_ID_(float* a, float* b, float* out) { \
-        for (int64_t i = 0; i < p_DIM1_; ++i) {               \
-          out[i] = a[i] p_OP_ b[i];                           \
-        }                                                     \
-      }
-
-    #define CSOURCE_BINARY_OP_2D(p_ID_, p_OP_, p_DIM1_, p_DIM2_)  \
-      extern "C" void p_ID_(float* a, float* b, float* out) {     \
-        for (int64_t i = 0; i < p_DIM1_; ++i) {                   \
-          for (int64_t j = 0; j < p_DIM2_; ++j) {                 \
-            int64_t k = i * p_DIM2_ + j;                          \
-            out[k] = a[k] p_OP_ b[k];                             \
-          }                                                       \
-        }                                                         \
-      }
-    )op_macro";
-
-    code_stream_ << operator_macro << "\n\n";
-
-    // Generate C code for the subgraph.
-    if (ref->IsInstance<FunctionNode>()) {
-      GenCFunc(Downcast<Function>(ref));
-    } else if (ref->IsInstance<relay::ModuleNode>()) {
-      relay::Module mod = Downcast<relay::Module>(ref);
-      for (const auto& it : mod->functions) {
-        GenCFunc(Downcast<Function>(it.second));
-      }
-    } else {
-      LOG(FATAL) << "The input ref is expected to be a Relay function or module"
-                 << "\n";
-    }
-
-    // Create a CSourceModule
-    const auto* pf = runtime::Registry::Get("module.csource_module_create");
-    ICHECK(pf != nullptr) << "Cannot find csource module to create the external runtime module";
-    return (*pf)(code_stream_.str(), "cc");
-  }
-
-Register Your Codegen
-=====================
-
-The last step is registering your codegen to TVM backend. We first implement a simple function to invoke our codegen and generate a runtime module.
-
-.. code-block:: c++
-
-  runtime::Module CCompiler(const NodeRef& ref) {
-    CSourceCodegen csource;
-    return csource.CreateCSourceModule(ref);
-  }
-
-Finally, we register this function to TVM backend:
-
-.. code-block:: c++
-
-  TVM_REGISTER_GLOBAL("relay.ext.ccompiler").set_body_typed(CCompiler);
-
-where ``ccompiler`` is a customized tag to let TVM know this is the codegen it should use to generate and offload subgraphs when the subgraph is annotated with ``ccompiler``.
-
-Finally, a good practice is to set up a CMake configuration flag to include your compiler only for your customers. We first create a cmake file: ``cmake/modules/contrib/CODEGENC.cmake``:
-
-.. code-block:: cmake
-
-  if(USE_CODEGENC)
-    file(GLOB CSOURCE_RELAY_CONTRIB_SRC src/relay/backend/contrib/codegen_c/codegen.cc)
-    list(APPEND COMPILER_SRCS ${CSOURCE_RELAY_CONTRIB_SRC})
-  endif(USE_CODEGENC)
-
-So that users can configure whether to include your compiler when configuring TVM using ``config.cmake``:
-
-.. code-block:: cmake
-
-  set(USE_CODEGENC ON)
-
-*******************************************
-Implement a Codegen for Your Representation
-*******************************************
-
-Although we have demonstrated how to implement a C codegen, your hardware may require other forms of graph representation, such as JSON. In this case, you could modify ``CodegenC`` class we have implemented to generate your own graph representation and implement a customized runtime module to let TVM runtime know how this graph representation should be executed.
-
-To simplify, we define a graph representation named "ExampleJSON" in this guide. ExampleJSON does not mean the real JSON but just a simple representation for graphs without a control flow. For example, assuming we have the following subgraph named ``subgraph_0``:
-
-::
-
-         input0
-           |
-          add <-- input1
-           |
-        subtract <-- input2
-           |
-        multiply <-- input3
-           |
-          out
-
-Then the ExampleJON of this subgraph looks like:
-
-.. code-block:: none
-
-  subgraph_0
-    input 0 10 10
-    input 1 10 10
-    input 2 10 10
-    input 3 10 10
-    add 4 inputs: 0 1 shape: 10 10
-    sub 5 inputs: 4 2 shape: 10 10
-    mul 6 inputs: 5 3 shape: 10 10
-
-The ``input`` keyword declares an input tensor with its ID and shape; while the other statements describes computations in ``<op> <output ID> inputs: [input ID] shape: [shape]`` syntax.
-
-In this section, our goal is to implement the following customized TVM runtime module to execute ExampleJSON graphs.
-
-.. code-block:: c++
-
-  runtime::Module ExampleJsonCompiler(const NodeRef& ref) {
-      ExampleJsonCodeGen codegen(ref);
-      std::string code = codegen.gen(); // Note 1
-      const auto* pf = runtime::Registry::Get("module.examplejson_module_create"); // Note 2
-      ICHECK(pf != nullptr) << "Cannot find ExampleJson module to create the external runtime module";
-      return (*pf)(code);
-  }
-  TVM_REGISTER_GLOBAL("relay.ext.examplejsoncompiler").set_body_typed(ExampleJsonCompiler);
-
-**Note 1**: We will implement a customized codegen later to generate a ExampleJSON code string by taking a subgraph.
-
-**Note 2**: This line obtains a pointer to a function for creating the customized runtime module. You can see that it takes subgraph code in ExampleJSON format we just generated and initializes a runtime module.
-
-In the following sections, we are going to introduce 1) how to implement ``ExampleJsonCodeGen`` and 2) how to implement and register ``examplejson_module_create``.
-
-Implement ExampleJsonCodeGen
-============================
-
-Similar to the C codegen, we also derive ``ExampleJsonCodeGen`` from ``ExprVisitor`` to make use of visitor patterns for subgraph traversing. On the other hand, we do not have to inherit ``CodegenCBase`` because we do not need TVM C++ wrappers. The codegen class is implemented as follows:
-
-.. code-block:: c++
-
-    #include <tvm/relay/expr_functor.h>
-    #include <tvm/relay/transform.h>
-    #include <tvm/relay/type.h>
-    #include <tvm/runtime/module.h>
-    #include <tvm/runtime/object.h>
-
-    #include <fstream>
-    #include <sstream>
-
-    namespace tvm {
-    namespace relay {
-    namespace contrib {
-
-    class ExampleJsonCodeGen : public ExprVisitor {
-      public:
-        explicit ExampleJsonCodeGen();
-
-        // Note 1
-        void VisitExpr_(const VarNode* node) { /* Skip in this example. */ }
-        void VisitExpr_(const CallNode* call) final { /* Skip in this example. */ }
-
-        // Note 2
-        std::string gen(NodeRef& ref) {
-            this->code = "";
-            if (ref->IsInstance<FunctionNode>()) {
-                this->visit(Downcast<Function>(ref));
-            } else if (ref->IsInstance<relay::ModuleNode>()) {
-                relay::Module mod = Downcast<relay::Module>(ref);
-                for (const auto& it : mod->functions) {
-                    this->visit(Downcast<Function>(it.second));
-                }
-            } else {
-                LOG(FATAL) << "The input ref is expected to be a Relay function or module";
-            }
-            return this->code;
-        }
-
-      private:
-          /*! \brief The function id that represents a C source function. */
-         std::string code;
-    }
-
-**Note 1**: We again implement corresponding visitor functions to generate ExampleJSON code and store it to a class variable ``code`` (we skip the visitor function implementation in this example as their concepts are basically the same as C codegen). After finished the graph visiting, we should have an ExampleJSON graph in ``code``.
-
-**Note 2**: We define an internal API ``gen`` to take a subgraph and generate a ExampleJSON code. This API can be in an arbitrary name you prefer.
-
-The next step is to implement a customized runtime to make use of the output of ``ExampleJsonCodeGen``.
-
-Implement a Customized Runtime
-==============================
-
-In this section, we will implement a customized TVM runtime step-by-step and register it to TVM runtime modules. The customized runtime should be located at ``src/runtime/contrib/<your-runtime-name>/``. In our example, we name our runtime "example_ext_runtime".
-
-Again, we first define a customized runtime class as follows. The class has to be derived from TVM ``ModuleNode`` in order to be compatible with other TVM runtime modules.
-
-.. code-block:: c++
-
-	#include <dmlc/logging.h>
-	#include <tvm/runtime/c_runtime_api.h>
-	#include <tvm/runtime/memory.h>
-	#include <tvm/runtime/module.h>
-	#include <tvm/runtime/ndarray.h>
-	#include <tvm/runtime/object.h>
-	#include <tvm/runtime/packed_func.h>
-	#include <tvm/runtime/registry.h>
-
-	#include <fstream>
-	#include <cmath>
-	#include <map>
-	#include <sstream>
-	#include <string>
-	#include <vector>
-
-	namespace tvm {
-	namespace runtime {
-	class ExampleJsonModule : public ModuleNode {
-	 public:
-	  explicit ExampleJsonModule(std::string graph_json);
-
-	  PackedFunc GetFunction(const std::string& name,
-	                         const ObjectPtr<Object>& sptr_to_self) final;
-
-	  const char* type_key() const { return "examplejson"; }
-
-	  void SaveToBinary(dmlc::Stream* stream) final;
-
-	  static Module LoadFromBinary(void* strm);
-
-	  static Module Create(const std::string& path);
-
-          std::string GetSource(const std::string& format = "");
-
-          void Run(int id, const std::vector<int>& inputs, int output);
-
-          void ParseJson(const std::string& json);
-
-	 private:
-	  /* \brief The json string that represents a computational graph. */
-	  std::string graph_json_;
-	  /* \brief The subgraph that being processed. */
-	  std::string curr_subgraph_;
-	  /*! \brief A simple graph from subgraph id to node entries. */
-	  std::map<std::string, std::vector<NodeEntry>> graph_;
-	  /* \brief A simple pool to contain the tensor for each node in the graph. */
-	  std::vector<NDArray> data_entry_;
-	  /* \brief A mapping from node id to op name. */
-	  std::vector<std::string> op_id_;
-	};
-
-In particular, there are some functions derived from ``ModuleNode`` that we must implement in ``ExampleJsonModule``:
-
-* Constructor: The constructor of this class should accept a subgraph (in your representation), process and store it in any format you like. The saved subgraph could be used by the following two functions.
-
-* ``GetFunction``: This is the most important function in this class. When TVM runtime wants to execute a subgraph with your compiler tag, TVM runtime invokes this function from your customized runtime module. It provides the function name as well as runtime arguments, and ``GetFunction`` should return a packed function implementation for TVM runtime to execute.
-
-* ``SaveToBinary`` and ``LoadFromBinary``: ``SaveToBinary`` serialize the runtime module to a binary format for later deployment. This function will be called by TVM when users use ``export_library`` API. On the other hand, since we are now using our own graph representation, we have to make sure that ``LoadFromBinary`` is able to construct the same runtime module by taking the serialized binary generated by ``SaveToBinary``.
-
-* ``GetSource`` (optional): If you would like to see the generated ExampleJSON code, you can implement this function to dump it; otherwise you can skip the implementation.
-
-Other functions and class variables will be introduced along with the implementation of above must-have functions.
-
-Implement Constructor
----------------------
-
-.. code-block:: c++
-
-    explicit ExampleJsonModule(std::string graph_json) {
-      this->graph_json_ = graph_json;
-      ParseJson(this->graph_json_);
-    }
-
-Then, we implement ``ParseJson`` to parse a subgraph in ExampleJSON format and construct a graph in memory for later usage. Since we do not support subgraph with branches in this example, we simply use an array to store every nodes in a subgraph in order.
-
-.. code-block:: c++
-
-  void ParseJson(const std::string& json) {
-    std::string line;
-    std::string curr_subgraph;
-    std::stringstream ss(json);
-
-    while (std::getline(ss, line, '\n')) {
-      std::stringstream ss2(line);
-      std::string token;
-      int id = 0;
-
-      ss2 >> token;
-      if (token.find("subgraph_") != std::string::npos) {
-        curr_subgraph = token;
-        continue;
-      }
-
-      ss2 >> id;
-      if (op_id_.size() <= static_cast<size_t>(id)) {
-        op_id_.resize(id + 1);
-        data_entry_.resize(id + 1);
-      }
-
-      int64_t total_elements = 1;
-      std::vector<int64_t> shape;
-      if (token == "input") {
-        int64_t size = 0;
-        while (ss2 >> size) {
-          total_elements *= size;
-          shape.push_back(size);
-        }
-      } else {
-        op_id_[id] = token; // Note 1
-        bool shape_data = false;
-        NodeEntry entry;
-        while (ss2 >> token) {
-          if (token == "shape:") {
-            shape_data = true;
-          } else if (shape_data) {
-            total_elements *= std::stoll(token);
-            shape.push_back(std::stoll(token));
-          } else if (token != "inputs:") {
-            entry.inputs.push_back(std::stoi(token));
-          }
-        }
-        entry.id = id;
-        entry.output = id;
-        graph_[curr_subgraph].push_back(entry); // Note 2
-      }
-      DLDevice dev;
-      dev.device_type = static_cast<DLDeviceType>(1);
-      dev.device_id = 0;
-      data_entry_[id] = NDArray::Empty(shape, DLDataType{kDLFloat, 32, 1}, dev); // Note 3
-    }
-  }
-
-**Note 1**: We use a class variable ``op_id_`` to map from subgraph node ID to the operator name (e.g., ``add``) so that we can invoke the corresponding operator function in runtime.
-
-**Note 2**: We use a class variable ``graph_`` to map from subgraph name to an array of nodes. ``GetFunction`` will query graph nodes by a subgraph ID in runtime.
-
-**Note 3**: We use a class variable `data_entry_` to map from a subgraph node ID to a tensor data placeholder. We will put inputs and outputs to the corresponding data entry in runtime.
-
-Implement GetFunction
----------------------
-
-After the construction, we should have the above class variables ready. We then implement ``GetFunction`` to provide executable subgraph functions to TVM runtime:
-
-.. code-block:: c++
-
-  PackedFunc GetFunction(const std::string& name,
-                         const ObjectPtr<Object>& sptr_to_self) final {
-    if (this->graph_.find(name) != this->graph_.end()) {
-      this->curr_subgraph_ = name;
-      return PackedFunc([sptr_to_self, this](TVMArgs args, TVMRetValue* rv) {
-
-        // Copy input tensors to corresponding data entries.
-        for (auto i = 0; i < args.size(); ++i) {
-          ICHECK(args[i].type_code() == kNDArrayContainer || args[i].type_code() == kArrayHandle)
-              << "Expect NDArray or DLTensor as inputs\n";
-          if (args[i].type_code() == kArrayHandle) {
-            DLTensor* arg = args[i];
-            this->data_entry_[i].CopyFrom(arg);
-          } else {
-            NDArray arg = args[i];
-            this->data_entry_[i].CopyFrom(arg);
-          }
-        }
-
-        // Execute the subgraph.
-        for (const auto& it : this->graph_[this->curr_subgraph_]) {
-          this->Run(it.id, it.inputs, it.output);
-        }
-        ICHECK_GT(graph_.count(this->curr_subgraph_), 0U);
-
-        // Copy the output from a data entry back to TVM runtime argument.
-        auto out_idx = graph_[this->curr_subgraph_].back().output;
-        if (args[args.size() - 1].type_code() == kArrayHandle) {
-          DLTensor* arg = args[args.size() - 1];
-          this->data_entry_[out_idx].CopyTo(arg);
-        } else {
-          NDArray arg = args[args.size() - 1];
-          this->data_entry_[out_idx].CopyTo(arg);
-        }
-        *rv = data_entry_.back();
-      });
-    } else {
-      LOG(FATAL) << "Unknown subgraph: " << name << "\n";
-      return PackedFunc();
-    }
-  }
-
-As can be seen, ``GetFunction`` is composed of three major parts. The first part copies data from TVM runtime arguments to the corresponding data entries we assigned in the constructor. The second part executes the subgraph with ``Run`` function (will implement later) and saves the results to another data entry. The third part copies the results from the output data entry back to the corresponding TVM runtime argument for output.
-
-Implement Run
--------------
-
-Now let's implement ``Run`` function. This function accepts 1) a subgraph ID, 2) a list of input data entry indexs, and 3) an output data entry index.
-
-.. code-block:: c++
-
-  void Run(int id, const std::vector<int>& inputs, int output) {
-    // Make a list data entry indexs.
-    std::vector<int> args(inputs.begin(), inputs.end());
-    args.push_back(output);
-
-    // Initialize data holders.
-    std::vector<TVMValue> values(args.size());
-    std::vector<int> type_codes(args.size());
-
-    // Initialize a TVM arg setter with TVMValue and its type code.
-    TVMArgsSetter setter(values.data(), type_codes.data());
-
-    // Set each argument to its corresponding data entry.
-    if (op_id_[id] == "add" || op_id_[id] == "sub" || op_id_[id] == "mul") {
-      for (size_t i = 0; i < args.size(); i++) {
-        setter(i, data_entry_[args[i]]);
-      }
-    }
-
-    // Invoke the corresponding operator function.
-    if (op_id_[id] == "add") {
-      Add(values.data(), type_codes.data(), args.size());
-    } else if (op_id_[id] == "sub") {
-      Sub(values.data(), type_codes.data(), args.size());
-    } else if (op_id_[id] == "mul") {
-      Mul(values.data(), type_codes.data(), args.size());
-    } else {
-      LOG(FATAL) << "Unknown op: " << op_id_[id] << "\n";
-    }
-  }
-
-``Run`` function mainly has two parts. The first part allocates a list of ``TVMValue``, and maps corresponding data entry blocks. This will become the arguments of our operator functions. The second part than invokes our operator functions. Although we use the same C functions as the previous example, you can replace ``Add``, ``Sub``, and ``Mul`` with your own engine. You only need to make sure your engine stores the results to the last argument so that they can be transferred back to TV [...]
-
-With above functions implemented, our customized codegen and runtime can now execute subgraphs. The last step is registering an API (``examplejson_module_create``) to create this module:
-
-.. code-block:: c++
-
-  TVM_REGISTER_GLOBAL("module.examplejson_module_create")
-  .set_body_typed([](std::string code){
-      auto n = make_object<ExampleJsonModule>(code);
-      return runtime::Module(n);
-  });
-
-Implement SaveToBinary and LoadFromBinary
------------------------------------------
-
-So far we have implemented the main features of a customized runtime so that it can be used as other TVM runtimes. However, when users want to save the built runtime to a disk for deployment, TVM has no idea about how to save it. This is the reason we want to implement ``SaveToBinary`` and ``LoadFromBinary``, which tell TVM how should this customized runtime be persist and restored.
-
-We first implement ``SaveToBinary`` function to allow users to save this module in disk.
-
-.. code-block:: c++
-
-  void SaveToBinary(dmlc::Stream* stream) final {
-      stream->Write(this->graph_json_);
-  }
-
-We can find that this function is pretty simple. Recall that the only argument we took in constructor is a subgraph representation, meaning that we only need a subgraph representation to construct/recover this customized runtime module. As a result, ``SaveToBinary`` simply writes the subgraph to an output DMLC stream. That is, when users use ``export_library`` API to export the module, the customized module will be an ExampleJSON stream of a subgraph.
-
-Similarity, ``LoadFromBinary`` reads the subgraph stream and re-constructs the customized runtime module:
-
-.. code-block:: c++
-
-  static Module LoadFromBinary(void* strm) {
-    dmlc::Stream* stream = static_cast<dmlc::Stream*>(strm);
-    std::string graph_json;
-    stream->Read(&graph_json);
-    auto n = tvm::runtime::make_object<ExampleJsonModule>(graph_json);
-    return Module(n);
-  }
-
-We also need to register this function to enable the corresponding Python API:
-
-.. code-block:: c++
-
-  TVM_REGISTER_GLOBAL("module.loadbinary_examplejson")
-  .set_body_typed(ExampleJsonModule::LoadFromBinary);
-
-The above registration means when users call ``tvm.runtime.load_module(lib_path)`` API and the exported library has an ExampleJSON stream, our ``LoadFromBinary`` will be invoked to create the same customized runtime module.
-
-In addition, if you want to support module creation directly from an ExampleJSON file, you can also implement a simple function and register a Python API as follows:
-
-.. code-block:: c++
-
-  static Module Create(const std::string& path) {
-      std::ifstream filep;
-      filep.open(path, std::ios::in);
-      std::string graph_json;
-      std::string line;
-      while (std::getline(filep, line)) {
-          graph_json += line;
-          graph_json += "\n";
-      }
-      filep.close();
-      auto n = tvm::runtime::make_object<ExampleJsonModule>(graph_json);
-      return Module(n);
-  }
-
-  TVM_REGISTER_GLOBAL("module.loadfile_examplejson")
-  .set_body([](TVMArgs args, TVMRetValue* rv) {
-      *rv = ExampleJsonModule::Create(args[0]);
-  });
-
-It means users can manually write/modify an ExampleJSON file, and use Python API ``tvm.runtime.load_module("mysubgraph.examplejson", "examplejson")`` to construct a customized module.
-
-*******
-Summary
-*******
-
-In summary, here is a checklist for you to refer:
-
-* A codegen class derived from ``ExprVisitor`` and ``CodegenCBase`` (only for C codegen) with following functions.
-
-  * ``VisitExpr_(const CallNode* call)`` to collect call node information.
-  * Other visitor functions you needed to collect subgraph information.
-  * ``JIT`` to generate subgraph code.
-  * Register codegen.
-
-* A function to create ``CSourceModule`` (for C codegen).
-
-* A runtime module class derived from ``ModuleNode`` with following functions (for your graph representation).
-
-  * Constructor.
-  * ``GetFunction`` to generate a TVM runtime compatible ``PackedFunc``.
-  * ``Run`` to execute a subgraph.
-  * Register a runtime creation API.
-  * ``SaveToBinary`` and ``LoadFromBinary`` to serialize/deserialize customized runtime module.
-  * Register ``LoadFromBinary`` API to support ``tvm.runtime.load_module(your_module_lib_path)``.
-  * (optional) ``Create`` to support customized runtime module construction from subgraph file in your representation.
-
-* An annotator to annotate a user Relay program to make use of your compiler and runtime (TBA).
diff --git a/docs/dev/tutorial/codebase_walkthrough.rst b/docs/dev/tutorial/codebase_walkthrough.rst
deleted file mode 100644
index a349b69f7b..0000000000
--- a/docs/dev/tutorial/codebase_walkthrough.rst
+++ /dev/null
@@ -1,223 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-=======================================
-TVM Codebase Walkthrough by Example
-=======================================
-
-Getting to know a new codebase can be a challenge. This is especially true for a codebase like that of TVM, where different components interact in non-obvious ways. In this guide, we try to illustrate the key elements that comprise a compilation pipeline with a simple example. For each important step, we show where in the codebase it is implemented. The purpose is to let new developers and interested users dive into the codebase more quickly.
-
-*******************************************
-Codebase Structure Overview
-*******************************************
-
-At the root of the TVM repository, we have following subdirectories that together comprise a bulk of the codebase.
-
-- ``src`` - C++ code for operator compilation and deployment runtimes.
-- ``src/relay`` - Implementation of Relay, a new functional IR for deep learning framework.
-- ``python`` - Python frontend that wraps C++ functions and objects implemented in ``src``.
-- ``src/topi`` - Compute definitions and backend schedules for standard neural network operators.
-
-Using standard Deep Learning terminology, ``src/relay`` is the component that manages a computational graph, and nodes in a graph are compiled and executed using infrastructure implemented in the rest of ``src``. ``python`` provides python bindings for the C++ API and driver code that users can use to execute compilation. Operators corresponding to each node are registered in ``src/relay/op``. Implementations of operators are in ``topi``, and they are coded in either C++ or Python.
-
-When a user invokes graph compilation by ``relay.build(...)``, the following sequence of actions happens for each node in the graph:
-
-- Look up an operator implementation by querying the operator registry
-- Generate a compute expression and a schedule for the operator
-- Compile the operator into object code
-
-One of the interesting aspects of the TVM codebase is that interoperability between C++ and Python is not unidirectional. Typically, all code that performs heavy lifting is implemented in C++, and Python bindings are provided for the user interface. This is also true in TVM, but in the TVM codebase, C++ code can also call into functions defined in a Python module. For example, the convolution operator is implemented in Python, and its implementation is invoked from C++ code in Relay.
-
-*******************************************
-Vector Add Example
-*******************************************
-
-We use a simple example that uses the low level TVM API directly. The example is vector addition, which is covered in detail in :ref:`tutorial-tensor-expr-get-started`
-
-::
-
-   n = 1024
-   A = tvm.te.placeholder((n,), name='A')
-   B = tvm.te.placeholder((n,), name='B')
-   C = tvm.te.compute(A.shape, lambda i: A[i] + B[i], name="C")
-
-Here, types of ``A``, ``B``, ``C`` are ``tvm.tensor.Tensor``, defined in ``python/tvm/te/tensor.py``. The Python ``Tensor`` is backed by C++ ``Tensor``, implemented in ``include/tvm/te/tensor.h`` and ``src/te/tensor.cc``. All Python types in TVM can be thought of as a handle to the underlying C++ type with the same name. If you look at the definition of Python ``Tensor`` type below, you can see it is a subclass of ``Object``.
-
-::
-
-   @register_object
-   class Tensor(Object, _expr.ExprOp):
-       """Tensor object, to construct, see function.Tensor"""
-
-       def __call__(self, *indices):
-          ...
-
-The object protocol is the basis of exposing C++ types to frontend languages, including Python. The way TVM implements Python wrapping is not straightforward. It is briefly covered in :ref:`tvm-runtime-system`, and details are in ``python/tvm/_ffi/`` if you are interested.
-
-We use the ``TVM_REGISTER_*`` macro to expose C++ functions to frontend languages, in the form of a :ref:`tvm-runtime-system-packed-func`. A ``PackedFunc`` is another mechanism by which TVM implements interoperability between C++ and Python. In particular, this is what makes calling Python functions from the C++ codebase very easy.
-You can also checkout `FFI Navigator <https://github.com/tqchen/ffi-navigator>`_ which allows you to navigate between python and c++ FFI calls.
-
-A ``Tensor`` object has an ``Operation`` object associated with it, defined in ``python/tvm/te/tensor.py``, ``include/tvm/te/operation.h``, and ``src/tvm/te/operation`` subdirectory. A ``Tensor`` is an output of its ``Operation`` object. Each ``Operation`` object has in turn ``input_tensors()`` method, which returns a list of input ``Tensor`` to it. This way we can keep track of dependencies between ``Operation``.
-
-We pass the operation corresponding to the output tensor ``C`` to ``tvm.te.create_schedule()`` function in ``python/tvm/te/schedule.py``.
-
-::
-
-   s = tvm.te.create_schedule(C.op)
-
-This function is mapped to the C++ function in ``include/tvm/schedule.h``.
-
-::
-
-   inline Schedule create_schedule(Array<Operation> ops) {
-     return Schedule(ops);
-   }
-
-``Schedule`` consists of collections of ``Stage`` and output ``Operation``.
-
-``Stage`` corresponds to one ``Operation``. In the vector add example above, there are two placeholder ops and one compute op, so the schedule ``s`` contains three stages. Each ``Stage`` holds information about a loop nest structure, types of each loop (``Parallel``, ``Vectorized``, ``Unrolled``), and where to execute its computation in the loop nest of the next ``Stage``, if any.
-
-``Schedule`` and ``Stage`` are defined in ``tvm/python/te/schedule.py``, ``include/tvm/te/schedule.h``, and ``src/te/schedule/schedule_ops.cc``.
-
-To keep it simple, we call ``tvm.build(...)`` on the default schedule created by ``create_schedule()`` function above, and we must add necessary thread bindings to make it runnable on GPU.
-
-::
-
-   target = "cuda"
-   bx, tx = s[C].split(C.op.axis[0], factor=64)
-   s[C].bind(bx, tvm.te.thread_axis("blockIdx.x"))
-   s[C].bind(tx, tvm.te.thread_axis("threadIdx.x"))
-   fadd = tvm.build(s, [A, B, C], target)
-
-``tvm.build()``, defined in ``python/tvm/driver/build_module.py``, takes a schedule, input and output ``Tensor``, and a target, and returns a :py:class:`tvm.runtime.Module` object. A :py:class:`tvm.runtime.Module` object contains a compiled function which can be invoked with function call syntax.
-
-The process of ``tvm.build()`` can be divided into two steps:
-
-- Lowering, where a high level, initial loop nest structures are transformed into a final, low level IR
-- Code generation, where target machine code is generated from the low level IR
-
-Lowering is done by ``tvm.lower()`` function, defined in ``python/tvm/build_module.py``. First, bound inference is performed, and an initial loop nest structure is created.
-
-::
-
-   def lower(sch,
-             args,
-             name="default_function",
-             binds=None,
-             simple_mode=False):
-      ...
-      bounds = schedule.InferBound(sch)
-      stmt = schedule.ScheduleOps(sch, bounds)
-      ...
-
-Bound inference is the process where all loop bounds and sizes of intermediate buffers are inferred. If you target the CUDA backend and you use shared memory, its required minimum size is automatically determined here. Bound inference is implemented in ``src/te/schedule/bound.cc``, ``src/te/schedule/graph.cc`` and ``src/te/schedule/message_passing.cc``.
-
-
-``stmt``, which is the output of ``ScheduleOps()``, represents an initial loop nest structure. If you have applied ``reorder`` or ``split`` primitives to your schedule, then the initial loop nest already reflects those changes. ``ScheduleOps()`` is defined in ``src/te/schedule/schedule_ops.cc``.
-
-Next, we apply a number of lowering passes to ``stmt``. These passes are implemented in ``src/tir/pass`` subdirectory. For example, if you have applied ``vectorize`` or ``unroll`` primitives to your schedule, they are applied in loop vectorization and unrolling passes below.
-
-::
-
-     ...
-     stmt = ir_pass.VectorizeLoop(stmt)
-     ...
-     stmt = ir_pass.UnrollLoop(
-         stmt,
-         cfg.auto_unroll_max_step,
-         cfg.auto_unroll_max_depth,
-         cfg.auto_unroll_max_extent,
-         cfg.unroll_explicit)
-     ...
-
-After lowering is done, ``build()`` function generates target machine code from the lowered function. This code can contain SSE or AVX instructions if you target x86, or PTX instructions for CUDA target. In addition to target specific machine code, TVM also generates host side code that is responsible for memory management, kernel launch etc.
-
-Code generation is done by ``build_module()`` function, defined in ``python/tvm/target/codegen.py``. On the C++ side, code generation is implemented in ``src/target/codegen`` subdirectory. ``build_module()`` Python function will reach ``Build()`` function below in ``src/target/codegen/codegen.cc``:
-
-
-
-The ``Build()`` function looks up the code generator for the given target in the ``PackedFunc`` registry, and invokes the function found. For example, ``codegen.build_cuda`` function is registered in ``src/codegen/build_cuda_on.cc``, like this:
-
-::
-
-   TVM_REGISTER_GLOBAL("codegen.build_cuda")
-   .set_body([](TVMArgs args, TVMRetValue* rv) {
-       *rv = BuildCUDA(args[0]);
-     });
-
-The ``BuildCUDA()`` above generates CUDA kernel source from the lowered IR using ``CodeGenCUDA`` class defined in ``src/codegen/codegen_cuda.cc``, and compile the kernel using NVRTC. If you target a backend that uses LLVM, which includes x86, ARM, NVPTX and AMDGPU, code generation is done primarily by ``CodeGenLLVM`` class defined in ``src/codegen/llvm/codegen_llvm.cc``. ``CodeGenLLVM`` translates TVM IR into LLVM IR, runs a number of LLVM optimization passes, and generates target machine code.
-
-The ``Build()`` function in ``src/codegen/codegen.cc`` returns a ``runtime::Module`` object, defined in ``include/tvm/runtime/module.h`` and ``src/runtime/module.cc``. A ``Module`` object is a container for the underlying target specific ``ModuleNode`` object. Each backend implements a subclass of ``ModuleNode`` to add target specific runtime API calls. For example, the CUDA backend implements ``CUDAModuleNode`` class in ``src/runtime/cuda/cuda_module.cc``, which manages the CUDA driver  [...]
-
-The returned module, which can be thought of as a combination of a compiled function and a device API, can be invoked on TVM's NDArray objects.
-
-::
-
-   dev = tvm.device(target, 0)
-   a = tvm.nd.array(np.random.uniform(size=n).astype(A.dtype), dev)
-   b = tvm.nd.array(np.random.uniform(size=n).astype(B.dtype), dev)
-   c = tvm.nd.array(np.zeros(n, dtype=C.dtype), dev)
-   fadd(a, b, c)
-   output = c.numpy()
-
-Under the hood, TVM allocates device memory and manages memory transfers automatically. To do that, each backend needs to subclass ``DeviceAPI`` class, defined in ``include/tvm/runtime/device_api.h``, and override memory management methods to use device specific API. For example, the CUDA backend implements ``CUDADeviceAPI`` in ``src/runtime/cuda/cuda_device_api.cc`` to use ``cudaMalloc``, ``cudaMemcpy`` etc.
-
-The first time you invoke the compiled module with ``fadd(a, b, c)``, ``GetFunction()`` method of ``ModuleNode`` is called to get a ``PackedFunc`` that can be used for a kernel call. For example, in ``src/runtime/cuda/cuda_module.cc`` the CUDA backend implements ``CUDAModuleNode::GetFunction()`` like this:
-
-::
-
-   PackedFunc CUDAModuleNode::GetFunction(
-         const std::string& name,
-         const std::shared_ptr<ModuleNode>& sptr_to_self) {
-     auto it = fmap_.find(name);
-     const FunctionInfo& info = it->second;
-     CUDAWrappedFunc f;
-     f.Init(this, sptr_to_self, name, info.arg_types.size(), info.launch_param_tags);
-     return PackFuncVoidAddr(f, info.arg_types);
-   }
-
-The ``PackedFunc``'s overloaded ``operator()`` will be called, which in turn calls ``operator()`` of ``CUDAWrappedFunc`` in ``src/runtime/cuda/cuda_module.cc``, where finally we see the ``cuLaunchKernel`` driver call:
-
-::
-
-   class CUDAWrappedFunc {
-    public:
-     void Init(...)
-     ...
-     void operator()(TVMArgs args,
-                     TVMRetValue* rv,
-                     void** void_args) const {
-       int device_id;
-       CUDA_CALL(cudaGetDevice(&device_id));
-       if (fcache_[device_id] == nullptr) {
-         fcache_[device_id] = m_->GetFunc(device_id, func_name_);
-       }
-       CUstream strm = static_cast<CUstream>(CUDAThreadEntry::ThreadLocal()->stream);
-       ThreadWorkLoad wl = launch_param_config_.Extract(args);
-       CUresult result = cuLaunchKernel(
-           fcache_[device_id],
-           wl.grid_dim(0),
-           wl.grid_dim(1),
-           wl.grid_dim(2),
-           wl.block_dim(0),
-           wl.block_dim(1),
-           wl.block_dim(2),
-           0, strm, void_args, 0);
-     }
-   };
-
-This concludes an overview of how TVM compiles and executes a function. Although we did not detail TOPI or Relay, in the end, all neural network operators go through the same compilation process as above. You are encouraged to dive into the details of the rest of the codebase.
diff --git a/docs/dev/tutorial/index.rst b/docs/dev/tutorial/index.rst
deleted file mode 100644
index 77fbe0f540..0000000000
--- a/docs/dev/tutorial/index.rst
+++ /dev/null
@@ -1,29 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-.. _dev-tutorial:
-
-Developer Tutorial
-==================
-
-This section is a guide to the TVM codebase, and an introduction on how to
-contribute to different parts of the platform.
-
-.. toctree::
-   :maxdepth: 1
-
-   codebase_walkthrough
diff --git a/docs/how_to/deploy/adreno.rst b/docs/how_to/deploy/adreno.rst
deleted file mode 100644
index f0b8c6f757..0000000000
--- a/docs/how_to/deploy/adreno.rst
+++ /dev/null
@@ -1,676 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-Deploy to Adreno™ GPU
-=====================
-
-**Authors**: Daniil Barinov, Egor Churaev, Andrey Malyshev, Siva Rama Krishna
-
-Introduction
-------------
-
-Adreno™ is a series of graphics processing unit (GPU) semiconductor
-intellectual property cores developed by Qualcomm and used in many of
-their SoCs.
-
-The Adreno™ GPU accelerates the rendering of complex geometries to
-deliver high-performance graphics and a rich user experience with low
-power consumption.
-
-TVM supports deep learning acceleration on Adreno™ GPU by native OpenCL backend of TVM and
-also through OpenCLML backend. Native OpenCL backend of TVM is enhanced to make it
-Adreno™ friendly by incorporating texture memory usage and Adreno™ friendly layouts.
-OpenCLML is an SDK release by Qualcomm that provides kernel acceleration library
-for most of the deep learning operators.
-
-This guide is organized to demonstrate various design aspects of
-
-- :ref:`OpenCL Backend Ehnahcements<opencl_enhancements>`
-- :ref:`About OpenCLML<about_openclml>`
-- :ref:`Build and Deploy<build_deploy>`
-
-
-.. _opencl_enhancements:
-
-OpenCL Backend Enhancements
----------------------------
-
-OpenCL backend of TVM is enhanced to take advantage of Adreno™ specific features like
-- Texture memory usage.
-- Adreno™ friendly activation layouts.
-- Brand new schedules to accelerate with above features.
-
-One of the Adreno™'s advantages is the clever handling of textures. At
-the moment, TVM is able to benefit from this by having texture support
-for Adreno™. The graph below shows the Adreno™ A5x architecture.
-
-|High-level overview of the Adreno™ A5x architecture for OpenCL|
-
-*Fig. 1 High-level overview of the Adreno™ A5x architecture for OpenCL*
-
-*source:* `OpenCL Optimization and Best Practices for Qualcomm Adreno™ GPUs <https://dl.acm.org/doi/10.1145/3204919.3204935>`_
-
-Reasons of using textures:
-
--  Texture processor (TP) has a dedicated L1 cache, which is read-only cache and stores data
-   fetched from level-2 (L2) cache for texture operations (primary
-   reason)
-
--  The handling of image boundaries is built-in.
-
--  Supports numerous image format and data type combinations with
-   support for automatic format conversions
-
-Overall, with textures, it is possible to achieve a significant performance boost
-compared to OpenCL buffer based solutions.
-
-In general we specify target as ``target="opencl"`` for a regular OpenCL based target which generates the kernels as shown below.
-
-.. code:: c
-
-   __kernel void tvmgen_default_fused_nn_conv2d_kernel0(__global float* restrict p0, __global double* restrict p1, __global float* restrict conv2d_nhwc) {
-   // body..
-
-Above OpenCL kernel definition has ``__global float*`` poniters which are essestially OpenCL ``buffer``  objects.
-
-When enabled texture based enhancements by modifying target definition as ``target="opencl -device=adreno"`` we can see the generated
-kernels using texture backed OpenCL image objects as shown below.
-
-.. code:: c
-
-   __kernel void tvmgen_default_fused_nn_conv2d_kernel0(__write_only image2d_t pad_temp_global_texture, __read_only image2d_t p0) {
-   // body..
-
-*image2d_t* is a built-in OpenCL types that represents two-dimensional image object and provides several additional functions.
-When we use *image2d_t* we read *4 elements at one time*, and it helps to utilize hardware in a more efficient way.
-
-Please refer to :ref:`Advanced Usage<advanced_usage>` for more details about generation and inspection of kernel sources.
-
-
-.. _about_openclml:
-
-About OpenCLML
---------------
-
-OpenCLML is a SDK released by Qualcomm that provides accelerated deep learning operators.
-These operators are exposed as an extension ``cl_qcom_ml_ops`` to standard OpenCL specification.
-Please refer `Accelerate your models with our OpenCL ML SDK <https://developer.qualcomm.com/blog/accelerate-your-models-our-opencl-ml-sdk>`_ for more details.
-
-OpenCLML is integrated into TVM as a `BYOC <https://tvm.apache.org/docs/dev/how_to/relay_bring_your_own_codegen.html?highlight=bring%20your%20own>`_ solution.
-OpenCLML operators can use same context and can be enqueued on same command queue as used in native OpenCL.
-We took advantage of this to avoid any context switching over heads while fallback to native OpenCL.
-
-
-.. _build_deploy:
-
-TVM for Adreno™
----------------
-
-This section gives instructions about various ways of building and deploying model
-to Adreno™ target. Adreno™ is a remote target which is connected to the host via ADB connection.
-Deploying the compiled model here require use some tools on host as well as on target.
-
-TVM has simplified user friendly command line based tools as well as
-developer centric python API interface for various steps like auto tuning, building and deploying.
-
-
-|Adreno deployment pipeline|
-
-*Fig.2 Build and Deployment pipeline on Adreno devices*
-
-The figure above demonstrates a generalized pipeline for various stages listed below.
-
-**Model import:**
-At this stage we import a model from well known frameworks like Tensorflow, PyTorch, ONNX ...etc.
-This stage converts the given model into TVM's relay module format. Alternatively one can build a relay module manually
-by using TVM's operator inventory too. TVM module generated here is a target independent representation of the graph.
-
-**Auto Tuning:**
-At this stage we tune the TVM generated kernels specific to a target. Auto tuning process requires
-target device availability and in case of a remote target like Adreno™ on Android device we use RPC Setup for communication.
-Later sections in this guide will detail about RPC Setup for Android device. Auto tuning is not a necessary step for
-compilation of a model. It is necessary for acheiving best performance out of TVM generated kernels.
-
-**Compilation:**
-At this stage we compile the model for specific target. Given we auto tuned the module in previous stage,
-TVM compilation make use of the tuning log for genetrating best performing kernels. TVM compilation process produces artifacts
-containing kernel shared lib, graph definition in json format and parameters binary file in TVM specific format.
-
-**Deploy (or test run) on Target:**
-At this stage we run the TVM compilation output on the target. Deployment is possible from python
-environment using RPC Setup and also using TVM's native tool which is native binary cross compiled for Android.
-At this stage we can run the compiled model on Android target and unit test output correctness and performance aspects.
-
-**Application Integration:**
-This stage is all about integrating TVM compiled model in applications. Here we discuss about
-interfacing tvm runtime from Android (cpp native environment or from JNI) for setting input and getting output.
-
-**Advanced Usage:**
-This section advanced user interests like viewing generated source code, altering precision of the module ...etc.
-
-
-This tutorial covers all the above aspects as part of below sections.
-
-- :ref:`Development environment<development_environment>`
-- :ref:`RPC Setup<rpc_setup>`
-- :ref:`Commandline tools<commandline_interface>`
-- :ref:`Python interface<python_interface>`
-- :ref:`Application Integration<application_integration>`
-- :ref:`Advanced Usage<advanced_usage>`
-
-.. _development_environment:
-
-
-Development Environment Setup : Automatic
------------------------------------------
-TVM ships a predefined docker container environment with all prerequisites to get started quickly.
-You may also refer to :ref:`Manual Environment Setup<manual_setup>` for more control on the dependencies.
-
-For docker setup the pre requisite is just docker tool availabilty on host.
-
-Below commands can build a docker image for adreno.
-
-::
-
-   ./docker/build.sh ci_adreno
-   docker tag tvm.ci_adreno ci_adreno
-
-
-Now we can build both host and target utils with below command.
-
-::
-
-   ./tests/scripts/ci.py adreno -i
-
-To build TVM with OpenCLML SDK we need export the OpenCLML SDK as shown below while building
-
-::
-
-   export ADRENO_OPENCL=<Path to OpenCLML SDK>
-   ./tests/scripts/ci.py adreno -i
-
-On successful compilation this leaves us into a docker shell. The build leaves two folders
-
-* build-adreno:  The host side TVM compiler build.
-* build-adreno-target : Contains the android target components
-
-    * libtvm_runtime.so : TVM runtime library
-    * tvm_rpc : The rpc runtime environment tool
-    * rtvm : A native stand alone tool
-
-While using docker environment the android device is shared with host. Hence, it is required
-to have adb version ``1.0.41`` on the host as the docker used the same version.
-
-We can check adb devices availability inside docker environment too.
-
-::
-
-   user@ci-adreno-fpeqs:~$ adb devices
-   List of devices attached
-   aaaabbbb	device
-   ccccdddd	device
-
-.. _manual_setup:
-
-Development Environment Setup : Manual
---------------------------------------
-
-Manual build process require building of host and target components.
-
-Below command will configure the build the host compiler
-
-::
-
-   mkdir -p build
-   cd build
-   cp ../cmake/config.cmake .
-
-   # Enable RPC capability to communicate to remote device.
-   echo set\(USE_RPC ON\) >> config.cmake
-   # We use graph executor for any host(x86) side verification of the model.
-   echo set\(USE_GRAPH_EXECUTOR ON\) >> config.cmake
-   # Enable backtrace if possible for more ebug information on any crash.
-   echo set\(USE_LIBBACKTRACE AUTO\) >> config.cmake
-   # The target_host will be llvm.
-   echo set\(USE_LLVM ON\) >> config.cmake
-
-Additionally we can push below config entry to compile with OpenCLML support.
-
-::
-
-   export ADRENO_OPENCL=<Path to OpenCLML SDK>
-   echo set\(USE_CLML ${ADRENO_OPENCL}\) >> config.cmake
-
-now we can build as shown below
-
-::
-
-   cmake ..
-   make
-
-Finally we can export python path as
-
-::
-
-   export PYTHONPATH=$TVM_HOME/python:${PYTHONPATH}
-   python3 -c "import tvm" # Verify tvm python package
-
-
-Now, we can configure and build the target components with below configuration
-Target build require Android NDK to be installed.
-
-- Read documentation about *Android NDK installation* here: https://developer.android.com/ndk
-- To get access to adb tools you can see *Android Debug Bridge installation* here: https://developer.android.com/studio/command-line/adb
-
-
-::
-
-   mkdir -p build-adreno
-   cd build-adreno
-   cp ../cmake/config.cmake .
-   # Enable OpenCL backend.
-   echo set\(USE_OPENCL ON\) >> config.cmake
-   # Enable RPC functionality.
-   echo set\(USE_RPC ON\) >> config.cmake
-   # Build tvm_rpc tool that runs on target device.
-   echo set\(USE_CPP_RPC ON\) >> config.cmake
-   # Build native rtvm deploy tool.
-   echo set\(USE_CPP_RTVM ON\) >> config.cmake
-   # We use graph executor for deploying on devices like Android.
-   echo set\(USE_GRAPH_EXECUTOR ON\) >> config.cmake
-   # Backtrace enablement if possible.
-   echo set\(USE_LIBBACKTRACE AUTO\) >> config.cmake
-   # Adreno supports 32bit alignment for OpenCL allocations rather 64bit.
-   echo set\(USE_KALLOC_ALIGNMENT 32\) >> config.cmake
-
-   # Android build related defines.
-   echo set\(ANDROID_ABI arm64-v8a\) >> config.cmake
-   echo set\(ANDROID_PLATFORM android-28\) >> config.cmake
-   echo set\(MACHINE_NAME aarch64-linux-gnu\) >> config.cmake
-
-Additionally we can push below config to compile with OpenCLML support.
-
-::
-
-   export ADRENO_OPENCL=<Path to OpenCLML SDK>
-   echo set\(USE_CLML "${ADRENO_OPENCL}"\) >> config.cmake
-   echo set\(USE_CLML_GRAPH_EXECUTOR "${ADRENO_OPENCL}"\) >> config.cmake
-
-For Android target build ``ANDROID_NDK_HOME`` is a dependency and we should have the same in the enviromnet variable.
-Below commands will build Adreno™ target components
-
-::
-
-   cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" \
-      -DANDROID_ABI=arm64-v8a \
-      -DANDROID_PLATFORM=android-28 \
-      -DCMAKE_SYSTEM_VERSION=1 \
-      -DCMAKE_FIND_ROOT_PATH="${ADRENO_OPENCL}" \
-      -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-      -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-      -DCMAKE_CXX_COMPILER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang++" \
-      -DCMAKE_C_COMPILER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang" \
-      -DMACHINE_NAME="aarch64-linux-gnu" ..
-
-   make tvm_runtime tvm_rpc rtvm
-
-
-.. _rpc_setup:
-
-RPC Setup
----------
-
-RPC Setup allows remote target access over TCP/IP networking interface. RPC Setup is essential for auto tuning stage as tuning
-involves running of auto generated kernels on real device and optimize the same by using machine learning approach. Please refer
-`Auto-Tune with Templates and AutoTVM <https://tvm.apache.org/docs/how_to/tune_with_autotvm/index.html>`_ got more details about AutoTVM.
-
-RPC Setup is also useful to deply the compiled model to a remote device from python interface or ``tvmc`` tool from host device.
-
-RPC Setup has multiple components as listed below.
-
-**TVM Tracker:**
-TVM tracker is a host side daemon that manages remote devices and serve them to host side applications. Applications
-can connect to this tracker and acquire a remote device handle to communicate.
-
-**TVM RPC:**
-TVM RPC is a native application that runs on the remote device (Android in our case) and registers itself to the TVM Tracker
-running on the host.
-
-
-Hence, for RPC based setup we will have above components running on host and target device. Below sections explain how to setup the same
-manually and also inside docker using automated tools.
-
-**Automated RPC Setup:**
-Here we will explain how to setup RPC in docker environment.
-
-Below command launches tracker in docker environment, where tracker listens on port 9190.
-
-::
-
-   ./tests/scripts/ci.py adreno -i # Launch a new shell on the anreno docker
-   source  tests/scripts/setup-adreno-env.sh -e tracker -p 9190
-
-Now, the below comand can run TVM RPC on remote android device with id ``abcdefgh``.
-
-
-::
-
-   ./tests/scripts/ci.py adreno -i # Launch a new shell on adreno docker.
-   source  tests/scripts/setup-adreno-env.sh -e device -p 9190 -d abcdefgh
-
-Further, below command can be used to query the RPC setup details on any other docker terminals.
-
-::
-
-   ./tests/scripts/ci.py adreno -i # Launch a new shell on adreno docker.
-   source  tests/scripts/setup-adreno-env.sh -e query -p 9190
-
-
-**Manual RPC Setup:**
-
-Please refer to the tutorial
-`How To Deploy model on Adreno <https://tvm.apache.org/docs/how_to/deploy_models/deploy_model_on_adreno.html>`_
-for manual RPC environment setup.
-
-This concludes RPC Setup and we have rpc-tracker available on host ``127.0.0.1`` (rpc-tracker) and port ``9190`` (rpc-port).
-
-
-.. _commandline_interface:
-
-Commandline Tools
------------------
-
-Here we describe entire compilation process using command line tools. TVM has command line utility
-`tvmc <https://tvm.apache.org/docs/tutorial/tvmc_command_line_driver.html>`_ to perform
-model import, auto tuning, compilation and deply over rpc.
-`tvmc <https://tvm.apache.org/docs/tutorial/tvmc_command_line_driver.html>`_  has many options to explore and try.
-
-**Model Import & Tuning:**
-Use the below command to import a model from any framework and auto tune the same.
-Here we use a model from Keras and it uses RPC setup for tuning and finally generates tuning log file
-``keras-resnet50.log``.
-
-::
-
-   python3 -m tvm.driver.tvmc tune --target="opencl -device=adreno" \
-   --target-host="llvm -mtriple=aarch64-linux-gnu" \
-   resnet50.h5 -o \
-   keras-resnet50.log \
-   --early-stopping 0 --repeat 30 --rpc-key android \
-   --rpc-tracker 127.0.0.1:9190 --trials 1024 \
-   --tuning-records keras-resnet50-records.log --tuner xgb
-
-**Model Compilation:**
-
-Use below command for compiling the model and produce TVM compiler outputs.
-
-::
-
-   python3 -m tvm.driver.tvmc compile \
-   --cross-compiler ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang \
-   --target="opencl, llvm" --target-llvm-mtriple aarch64-linux-gnu --target-opencl-device adreno \
-   --tuning-records keras-resnet50.log -o keras-resnet50.tar resnet50.h5
-
-While enabled OpenCLML offloading we need to add target ``clml`` as shown below. Tuning log is valid for OpenCLML offloading also
-as the OpenCL path is fallback option for any operator didn't go through OpenCLML path. The tuning log will be used for such operators.
-
-::
-
-   python3 -m tvm.driver.tvmc compile \
-   --cross-compiler ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang \
-   --target="opencl, clml, llvm" --desired-layout NCHW --target-llvm-mtriple aarch64-linux-gnu --target-opencl-device adreno \
-   --tuning-records keras-resnet50.log -o keras-resnet50.tar resnet50.h5
-
-On successful compilation, above command produce ``keras-resnet50.tar``.
-It is a compressed archive with kernel shared lib(mod.so), graph json(mod.json) and params binary(mod.params).
-
-**Deploy & Run on Target:**
-
-Running the compiled model on Android target is possible in RPC way as well as native deployment.
-
-We can use below tvmc command to deploy on remore target via RPC based setup.
-
-::
-
-   python3 -m tvm.driver.tvmc run --device="cl" keras-resnet50.tar \
-   --rpc-key android --rpc-tracker 127.0.0.1:9190 --print-time
-
-`tvmc <https://tvm.apache.org/docs/tutorial/tvmc_command_line_driver.html>`_ based run has more options
-to initialize the input in various modes like fill, random ..etc.
-
-``tvmc`` based deployment generally a quick verification of compiled model on target from remote host via RPC setup.
-
-Production generally uses native deploymenmt environment like Android JNI or CPP native environments.
-Here we need to use cross compiled ``tvm_runtime`` interface to deploy the tvm compilation output, i.e. ``TVMPackage``.
-
-TVM has a standalone tool ``rtvm`` to deploy and run the model natively on ADB shell. The build process produces this tool under build-adreno-target.
-Please refer to `rtvm <https://github.com/apache/tvm/tree/main/apps/cpp_rtvm>`_ for more details about this tool.
-
-While integrating inside existing Android application TVM has multiple options. For JNI or CPP native we may use `C Runtime API <https://github.com/apache/tvm/blob/main/include/tvm/runtime/c_runtime_api.h>`_
-You may refer to ``rtvm``'s simplified interface `TVMRunner <https://github.com/apache/tvm/blob/main/apps/cpp_rtvm/tvm_runner.h>`_ also.
-
-.. _python_interface:
-
-Python Interface
-----------------
-
-This section explains importing, auto tuning, compiling and running a model using python interface.\
-TVM has a high level interface through ``tvmc`` abstraction as well as low level relay api. We will discuss about both of these in details.
-
-**TVMC Interface:**
-
-While using ``tvmc`` python interface we first load a model that produces ``TVMCModel``. ``TVMCModel`` will be used for Auto Tuning to produce tuning cache.
-Compilation process uses ``TVMCModel`` and tuning cache (optional) to produce ``TVMCPackage``. Now, ``TVMCPackage`` will be saved to file system or
-can be used to deploy and run on target device.
-
-Please refer to the tutorial for the same
-`How To Deploy model on Adreno using TVMC <https://tvm.apache.org/docs/how_to/deploy_models/deploy_model_on_adreno_tvmc.html>`_
-
-Saved ``TVMCPackage`` can be used for native deployment using ``rtvm`` utility too.
-
-Also, please refer to `tvmc <https://tvm.apache.org/docs/tutorial/tvmc_command_line_driver.html>`_
-documentation for more details about the api interface.
-
-**Relay Interface:**
-
-Relay api interface gives lower level api access to the tvm compiler interface.
-Similar to ``tvmc`` interface relay api interface provides various frontend API to convert models to a relay ``Module``.
-Relay ``Module`` will be used for all kinds transforms like precision conversions, CLML offloading and other custom transforms if any.
-The resulting Module will be used for Auto Tuning too. Finally, we use ``relay.build`` API to generate library module.
-From this library module, we can export compilation artifacts like module shared library (mod.so), params(mod.params) and json graph(mod.json).
-This library module will be used to create graph runtime to deploy and run on target device.
-
-Please refer to the tutorial `How To Deploy model on Adreno <https://tvm.apache.org/docs/how_to/deploy_models/deploy_model_on_adreno.html>`_
-for a step by step explanation of the same.
-
-Additionally, TVM also supports Java interface through `TVM4J <https://github.com/apache/tvm/tree/main/jvm>`_
-
-.. _application_integration:
-
-Application Integration
------------------------
-
-TVM compilation output is represented as module shared lib (mod.so), graph json(mod.json) and params (mod.params).
-Archived representation of TVMPackage is also contains the same.
-
-In general a CPP/C based interface will be sufficient for any Android application integration.
-
-TVM natively expose ``c_runtime_api`` for loading a TVM compiled module and run the same.
-
-Alternatively one may refer to `cpp_rtvm <https://github.com/apache/tvm/blob/main/apps/cpp_rtvm/tvm_runner.h>`_
-``TVMRunner`` interface too for further simplified version of the same.
-
-
-
-.. _advanced_usage:
-
-Advanced Usage
---------------
-
-This section details some of the advanced usage and additional information while using Adreno™ target on TVM.
-
-Generated Source Inspection
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Apart from standard tvm compilation artifacts kernel library (mod.so), graph (mod.json) and params (mod.params)
-we can also generate opencl kernel source, clml offloaded graph ...etc from lib handle as shown below.
-TVM compilation output is organized as a TVM module and many other TVM modules imported into it.
-
-Below snippet can dump CLML sub graphs in json format.
-
-.. code:: python
-
-   # Look for "clml" typed module imported.
-   clml_modules = list(filter(lambda mod: mod.type_key == "clml", lib.get_lib().imported_modules))
-   # Loop through all clml sub graphs and dump the json formatted CLML sub graphs.
-   for cmod in clml_modules:
-       print("CLML Src:", cmod.get_source())
-
-
-Similarly, below snippet can extract opencl kernel source from the compiled TVM module.
-
-.. code:: python
-
-   # Similarly we can dump open kernel source too as shown below
-   # Look for "opencl" typed module imported.
-   opencl_modules = list(filter(lambda mod: mod.type_key == "opencl", lib.get_lib().imported_modules))
-   # Now dump kernel source for each OpenCL targetted sub graph.
-   for omod in opencl_modules:
-       print("OpenCL Src:", omod.get_source())
-
-
-Precisions
-~~~~~~~~~~
-The right choice of precision for a specific workload can greatly increase the efficiency of the solution,
-shifting the initial balance of precision and speed to the side that is a priority for the problem.
-
-We can choose from *float16*, *float16_acc32* (Mixed Precision), *float32* (standard).
-
-**Float16**
-
-To leverage the GPU hardware capabilities and utilize the benefits of half precision computation and memory management,
-we can convert an original model having floating points operation to a model operating with half precision.
-Choosing lower precision will positively affect the performance of the model, but it may also have a decrease in the accuracy of the model.
-
-To do the conversion you need to call adreno specific transformation API as soon as relay module is generated through any frontend.
-
-.. code:: python
-
-   from tvm.driver.tvmc.transform import apply_graph_transforms
-   mod  = apply_graph_transforms(
-            mod,
-            {
-                "mixed_precision": True,
-                "mixed_precision_ops": ["nn.conv2d", "nn.dense"],
-                "mixed_precision_calculation_type": "float16",
-                "mixed_precision_acc_type": "float16",
-            },
-        )
-
-
-``tvm.driver.tvmc.transform.apply_graph_transforms`` is simplified API over ``ToMixedPrecision`` pass to get desired precision.
-
-We can then compile our model in any convinient way
-
-.. code:: python
-
-   with  tvm.transform.PassContext(opt_level=3):
-       lib = relay.build(
-           mod, target_host=target_host, target=target, params=params
-       )
-
-While using ``tvmc`` python interface, the below arguments enables precision conversion to float16.
-
-.. code:: python
-
-    mixed_precision = True,
-    mixed_precision_ops = ["nn.conv2d", "nn.dense"],
-    mixed_precision_calculation_type = "float16",
-    mixed_precision_acc_type = "float16"
-
-Similarly, ``tvmc`` command line interface option bas below listed options.
-
-.. code:: bash
-
-    --mixed-precision
-    --mixed-precision-ops nn.conv2d nn.dense
-    --mixed-precision-calculation-type float16
-    --mixed-precision-acc-type float16
-
-
-**float16_acc32 (Mixed Precision)**
-
-``ToMixedPrecision`` pass traverse over the network and split network to clusters of ops dealing with float or float16 data types.
-The clusters are defined by three types of operations:
-- Operations always be converted into float16 data type
-- Operations which can be converted if they followed by converted cluster
-- Operations never be converted to the float16 data type
-This list is defined in the ToMixedPrecision implementation here
-`relay/transform/mixed_precision.py <https://github.com/apache/tvm/blob/main/python/tvm/relay/transform/mixed_precision.py#L34>`_
-and can be overridden by user.
-
-The ``ToMixedPrecision`` method is a pass to convert an FP32 relay graph into an FP16 version (with
-FP16 or FP32 accumulation dtypes). Doing this transformation is useful for reducing model size
-as it halves the expected size of the weights (FP16_acc16 case).
-
-``ToMixedPrecision`` pass usage is simplified into a simple call as shown below for usage.
-
-.. code:: python
-
-   from tvm.driver.tvmc.transform import apply_graph_transforms
-   mod  = apply_graph_transforms(
-            mod,
-            {
-                "mixed_precision": True,
-                "mixed_precision_ops": ["nn.conv2d", "nn.dense"],
-                "mixed_precision_calculation_type": "float16",
-                "mixed_precision_acc_type": "float32",
-            },
-        )
-
-
-``tvm.driver.tvmc.transform.apply_graph_transforms`` is simplified API over ``ToMixedPrecision`` pass to get desired precision.
-
-We can then compile our model in any convinient way
-
-.. code:: python
-
-   with  tvm.transform.PassContext(opt_level=3):
-       lib = relay.build(
-           mod, target_host=target_host, target=target, params=params
-       )
-
-While using ``tvmc`` python interface, the below arguments enables precision conversion to float16.
-
-.. code:: python
-
-    mixed_precision = True,
-    mixed_precision_ops = ["nn.conv2d", "nn.dense"],
-    mixed_precision_calculation_type = "float16",
-    mixed_precision_acc_type = "float32"
-
-Similarly, ``tvmc`` command line interface option bas below listed options.
-
-.. code:: bash
-
-    --mixed-precision
-    --mixed-precision-ops nn.conv2d nn.dense
-    --mixed-precision-calculation-type float16
-    --mixed-precision-acc-type float32
-
-
-.. |High-level overview of the Adreno™ A5x architecture for OpenCL| image:: https://raw.githubusercontent.com/tlc-pack/web-data/main/images/how-to/adreno_architecture.png
-.. |Adreno deployment pipeline| image:: https://raw.githubusercontent.com/tlc-pack/web-data/main/images/how-to/Adreno-Deployment-Pipeline.jpg
diff --git a/docs/how_to/deploy/android.rst b/docs/how_to/deploy/android.rst
deleted file mode 100644
index 2f54697401..0000000000
--- a/docs/how_to/deploy/android.rst
+++ /dev/null
@@ -1,42 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-Deploy to Android
-=================
-
-Build model for Android Target
-------------------------------
-
-Relay compilation of model for android target could follow same approach like android_rpc.
-The code below will save the compilation output which is required on android target.
-
-
-.. code:: python
-
-    lib.export_library("deploy_lib.so", fcompile=ndk.create_shared)
-    with open("deploy_graph.json", "w") as fo:
-        fo.write(graph.json())
-    with open("deploy_param.params", "wb") as fo:
-        fo.write(runtime.save_param_dict(params))
-
-deploy_lib.so, deploy_graph.json, deploy_param.params will go to android target.
-
-TVM Runtime for Android Target
-------------------------------
-
-Refer `here <https://github.com/apache/tvm/blob/main/apps/android_deploy/README.md#build-and-installation>`_ to build CPU/OpenCL version flavor TVM runtime for android target.
-From android java TVM API to load model & execute can be referred at this `java <https://github.com/apache/tvm/blob/main/apps/android_deploy/app/src/main/java/org/apache/tvm/android/demo/MainActivity.java>`_ sample source.
diff --git a/docs/how_to/deploy/arm_compute_lib.rst b/docs/how_to/deploy/arm_compute_lib.rst
deleted file mode 100644
index 31b815d05d..0000000000
--- a/docs/how_to/deploy/arm_compute_lib.rst
+++ /dev/null
@@ -1,264 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-Relay Arm\ :sup:`®` Compute Library Integration
-===============================================
-**Author**: `Luke Hutton <https://github.com/lhutton1>`_
-
-Introduction
-------------
-
-Arm Compute Library (ACL) is an open source project that provides accelerated kernels for Arm CPU's
-and GPU's. Currently the integration offloads operators to ACL to use hand-crafted assembler
-routines in the library. By offloading select operators from a relay graph to ACL we can achieve
-a performance boost on such devices.
-
-Installing Arm Compute Library
-------------------------------
-
-Before installing Arm Compute Library, it is important to know what architecture to build for. One way
-to determine this is to use `lscpu` and look for the "Model name" of the CPU. You can then use this to
-determine the architecture by looking online.
-
-TVM only supports a single version of ACL, currently this is v21.08, there are two recommended ways to build and install
-the required libraries:
-
-* Use the script located at `docker/install/ubuntu_download_arm_compute_lib_binaries.sh`. You can use this
-  script for downloading ACL binaries for the architecture and extensions specified in `target_lib`, these
-  will be installed to the location denoted by `install_path`.
-* Alternatively, you can download the pre-built binaries from:
-  https://github.com/ARM-software/ComputeLibrary/releases. When using this package, you will need to
-  select the binaries for the architecture and extensions you require, then make sure they are visible
-  to CMake:
-
-  .. code:: bash
-
-      cd <acl-prebuilt-package>/lib
-      mv ./<architecture-and-extensions-required>/* .
-
-
-In both cases you will need to set USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR to the path where the ACL package
-is located. CMake will look in /path-to-acl/ along with /path-to-acl/lib and /path-to-acl/build for the
-required binaries. See the section below for more information on how to use these configuration options.
-
-Building with ACL support
--------------------------
-
-The current implementation has two separate build options in CMake. The reason for this split is
-because ACL cannot be used on an x86 machine. However, we still want to be able compile an ACL
-runtime module on an x86 machine.
-
-* USE_ARM_COMPUTE_LIB=ON/OFF - Enabling this flag will add support for compiling an ACL runtime module.
-* USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR=ON/OFF/path-to-acl - Enabling this flag will allow the graph executor to
-  compute the ACL offloaded functions.
-
-These flags can be used in different scenarios depending on your setup. For example, if you want
-to compile an ACL module on an x86 machine and then run the module on a remote Arm device via RPC, you will
-need to use USE_ARM_COMPUTE_LIB=ON on the x86 machine and USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR=ON on the remote
-AArch64 device.
-
-By default both options are set to OFF. Using USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR=ON will mean that ACL
-binaries are searched for by CMake in the default locations
-(see https://cmake.org/cmake/help/v3.4/command/find_library.html). In addition to this,
-/path-to-tvm-project/acl/ will also be searched. It is likely that you will need to set your own path to
-locate ACL. This can be done by specifying a path in the place of ON.
-
-These flags should be set in your config.cmake file. For example:
-
-.. code:: cmake
-
-    set(USE_ARM_COMPUTE_LIB ON)
-    set(USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR /path/to/acl)
-
-
-Usage
------
-
-.. note::
-
-    This section may not stay up-to-date with changes to the API.
-
-Create a relay graph. This may be a single operator or a whole graph. The intention is that any
-relay graph can be input. The ACL integration will only pick supported operators to be offloaded
-whilst the rest will be computed via TVM. (For this example we will use a single
-max_pool2d operator).
-
-.. code:: python
-
-    import tvm
-    from tvm import relay
-
-    data_type = "float32"
-    data_shape = (1, 14, 14, 512)
-    strides = (2, 2)
-    padding = (0, 0, 0, 0)
-    pool_size = (2, 2)
-    layout = "NHWC"
-    output_shape = (1, 7, 7, 512)
-
-    data = relay.var('data', shape=data_shape, dtype=data_type)
-    out = relay.nn.max_pool2d(data, pool_size=pool_size, strides=strides, layout=layout, padding=padding)
-    module = tvm.IRModule.from_expr(out)
-
-
-Annotate and partition the graph for ACL.
-
-.. code:: python
-
-    from tvm.relay.op.contrib.arm_compute_lib import partition_for_arm_compute_lib
-    module = partition_for_arm_compute_lib(module)
-
-
-Build the Relay graph.
-
-.. code:: python
-
-    target = "llvm -mtriple=aarch64-linux-gnu -mattr=+neon"
-    with tvm.transform.PassContext(opt_level=3, disabled_pass=["AlterOpLayout"]):
-        lib = relay.build(module, target=target)
-
-
-Export the module.
-
-.. code:: python
-
-    lib_path = '~/lib_acl.so'
-    cross_compile = 'aarch64-linux-gnu-c++'
-    lib.export_library(lib_path, cc=cross_compile)
-
-
-Run Inference. This must be on an Arm device. If compiling on x86 device and
-running on AArch64, consider using the RPC mechanism. :ref:`Tutorials for using
-the RPC mechanism <tutorial-cross-compilation-and-rpc>`
-
-.. code:: python
-
-    dev = tvm.cpu(0)
-    loaded_lib = tvm.runtime.load_module('lib_acl.so')
-    gen_module = tvm.contrib.graph_executor.GraphModule(loaded_lib['default'](dev))
-    d_data = np.random.uniform(0, 1, data_shape).astype(data_type)
-    map_inputs = {'data': d_data}
-    gen_module.set_input(**map_inputs)
-    gen_module.run()
-
-
-More examples
--------------
-The example above only shows a basic example of how ACL can be used for offloading a single
-Maxpool2D. If you would like to see more examples for each implemented operator and for
-networks refer to the tests: `tests/python/contrib/test_arm_compute_lib`. Here you can modify
-`test_config.json` to configure how a remote device is created in `infrastructure.py` and,
-as a result, how runtime tests will be run.
-
-An example configuration for `test_config.json`:
-
-* connection_type - The type of RPC connection. Options: local, tracker, remote.
-* host - The host device to connect to.
-* port - The port to use when connecting.
-* target - The target to use for compilation.
-* device_key - The device key when connecting via a tracker.
-* cross_compile - Path to cross compiler when connecting from a non-arm platform e.g. aarch64-linux-gnu-g++.
-
-.. code:: json
-
-    {
-      "connection_type": "local",
-      "host": "127.0.0.1",
-      "port": 9090,
-      "target": "llvm -mtriple=aarch64-linux-gnu -mattr=+neon",
-      "device_key": "",
-      "cross_compile": ""
-    }
-
-
-Operator support
-----------------
-+----------------------+-------------------------------------------------------------------------+
-| Relay Node           | Remarks                                                                 |
-+======================+=========================================================================+
-| nn.conv2d            | fp32:                                                                   |
-|                      |   Simple: nn.conv2d                                                     |
-|                      |   Composite: nn.pad?, nn.conv2d, nn.bias_add?, nn.relu?                 |
-|                      |                                                                         |
-|                      | Normal and depth-wise (when kernel is 3x3 or 5x5 and strides are 1x1    |
-|                      | or 2x2) convolution supported. Grouped convolution is not supported.    |
-+----------------------+-------------------------------------------------------------------------+
-| qnn.conv2d           | uint8:                                                                  |
-|                      |   Composite: nn.pad?, nn.conv2d, nn.bias_add?, nn.relu?, qnn.requantize |
-|                      |                                                                         |
-|                      | Normal and depth-wise (when kernel is 3x3 or 5x5 and strides are 1x1    |
-|                      | or 2x2) convolution supported. Grouped convolution is not supported.    |
-+----------------------+-------------------------------------------------------------------------+
-| nn.dense             | fp32:                                                                   |
-|                      |   Simple: nn.dense                                                      |
-|                      |   Composite: nn.dense, nn.bias_add?                                     |
-+----------------------+-------------------------------------------------------------------------+
-| qnn.dense            | uint8:                                                                  |
-|                      |   Composite: qnn.dense, nn.bias_add?, qnn.requantize                    |
-+----------------------+-------------------------------------------------------------------------+
-| nn.max_pool2d        | fp32, uint8                                                             |
-+----------------------+-------------------------------------------------------------------------+
-| nn.global_max_pool2d | fp32, uint8                                                             |
-+----------------------+-------------------------------------------------------------------------+
-| nn.avg_pool2d        | fp32:                                                                   |
-|                      |    Simple: nn.avg_pool2d                                                |
-|                      |                                                                         |
-|                      | uint8:                                                                  |
-|                      |    Composite: cast(int32), nn.avg_pool2d, cast(uint8)                   |
-+----------------------+-------------------------------------------------------------------------+
-| nn.global_avg_pool2d | fp32:                                                                   |
-|                      |    Simple: nn.global_avg_pool2d                                         |
-|                      |                                                                         |
-|                      | uint8:                                                                  |
-|                      |    Composite: cast(int32), nn.avg_pool2d, cast(uint8)                   |
-+----------------------+-------------------------------------------------------------------------+
-| power(of 2) +        | A special case for L2 pooling.                                          |
-| nn.avg_pool2d +      |                                                                         |
-| sqrt                 | fp32:                                                                   |
-|                      |    Composite: power(of 2), nn.avg_pool2d, sqrt                          |
-+----------------------+-------------------------------------------------------------------------+
-| reshape              | fp32, uint8                                                             |
-+----------------------+-------------------------------------------------------------------------+
-| maximum              | fp32                                                                    |
-+----------------------+-------------------------------------------------------------------------+
-| add                  | fp32                                                                    |
-+----------------------+-------------------------------------------------------------------------+
-| qnn.add              | uint8                                                                   |
-+----------------------+-------------------------------------------------------------------------+
-
-.. note::
-    A composite operator is a series of operators that map to a single Arm Compute Library operator. You can view this
-    as being a single fused operator from the view point of Arm Compute Library. '?' denotes an optional operator in
-    the series of operators that make up a composite operator.
-
-
-Adding a new operator
----------------------
-Adding a new operator requires changes to a series of places. This section will give a hint on
-what needs to be changed and where, it will not however dive into the complexities for an
-individual operator. This is left to the developer.
-
-There are a series of files we need to make changes to:
-
-* `python/relay/op/contrib/arm_compute_lib.py` In this file we define the operators we wish to offload using the
-  `op.register` decorator. This will mean the annotation pass recognizes this operator as ACL offloadable.
-* `src/relay/backend/contrib/arm_compute_lib/codegen.cc` Implement `Create[OpName]JSONNode` method. This is where we
-  declare how the operator should be represented by JSON. This will be used to create the ACL module.
-* `src/runtime/contrib/arm_compute_lib/acl_runtime.cc` Implement `Create[OpName]Layer` method. This is where we
-  define how the JSON representation can be used to create an ACL function. We simply define how to
-  translate from the JSON representation to ACL API.
-* `tests/python/contrib/test_arm_compute_lib` Add unit tests for the given operator.
diff --git a/docs/how_to/deploy/bnns.rst b/docs/how_to/deploy/bnns.rst
deleted file mode 100644
index b2afa5001d..0000000000
--- a/docs/how_to/deploy/bnns.rst
+++ /dev/null
@@ -1,184 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-Relay BNNS Integration
-======================
-**Author**: `Egor Churaev <https://github.com/echuraev>`_
-
-Introduction
-------------
-
-Apple BNNS library is a collection of functions that can be used to construct neural networks
-for inference (and train). It’s supported in macOS, iOS, tvOS, and watchOS. BNNS provides
-primitives executed on all CPU supported on those platforms and optimized for high performance
-and low-energy consumption. This integration will offload as many operators as possible from Relay to BNNS.
-
-BNNS runtime is a part of platform API and available on all modern Apple operating systems.
-Application using BNNS will not depends on any additional external dependencies.
-
-BNNS functions uses Apple private hardware capabilities which are not exposed yet by Apple. Example
-of such capabilities can be AMX Apple cpu extension.
-
-This guide will demonstrate how to build TVM with BNNS codegen and runtime enabled. It will also provide example
-code to compile and run models using BNNS runtime. Finally, we document the supported operators.
-
-Building TVM with BNNS support
-------------------------------
-
-To turn on TVM BNNS codegen and TVM BNNS runtime you need to turn on the only USE_BNNS flag
-
-* USE_BNNS=ON/OFF - This flag will enable compiling a network with offloading subgraphs to BNNS primitives
-  and will link tvm library to the BNNS runtime module.
-
-Enabling of this flag will cause to search the default Accelerate Frameworks on current target SDK.
-The minimal versions of required SDK is macOS 11.0, iOS 14.0, tvOS 14.0 and watchOS 7.0.
-
-Example setting in config.cmake file:
-
-.. code:: cmake
-
-    set(USE_BNNS ON)
-
-BNNS partitioning of Relay graph
---------------------------------
-
-Operations to be offloaded on BNNS execution must be annotated before passing of module for compilation.
-All ops annotated by `partition_for_bnns` will be offloaded for BNNS execution. The rest of the ops
-will go through the LLVM compilation and code generation.
-
-Important note: BNNS support primitives only with constant weights. To satisfy this requirements we have
-to map constants to related tensor abstraction in relay representation. To freeze tensors and operate
-with them as constants you may need to call ONNX importer with special flag "freeze_params=True"
-or performer binding manually. In general cases all relay importers don't do that by default.
-For your convenience "partition_for_bnns" can do this for you if params dictionary is passed as the argument.
-
-.. code:: python
-
-    from tvm.relay.op.contrib.bnns import partition_for_bnns
-    model = partition_for_bnns(model, params=params)
-
-
-Input data layout for operations to be offloaded to BNNS execution
-------------------------------------------------------------------
-
-BNNS kernels support only planar format of input data. The partitioner will require to have NCHW input
-layout for conv2d input.
-
-To use BNNS integration for models with interleave input layout, they should be converted before
-passing of module to `partition_for_bnns`. The layout conversion will happen only for explicitly
-enumerated types of ops. It might happen that depending on topology there might be regular data reorder
-around conv2d to interleave and planar layout. This will be reflected in performance penalties and affect
-execution time. It is recommended to analyze the whole topology and extend below list to convert all
-intermediate tensors to NCHW data layout.
-
-Example of input layouts change:
-
-.. code:: python
-
-    # For models with NHWC input layout
-    with tvm.transform.PassContext(opt_level=3):
-        mod = relay.transform.InferType()(mod)
-        mod = relay.transform.ConvertLayout({"nn.conv2d": ["NCHW", "default"],
-                                            "nn.bias_add": ["NCHW", "default"],
-                                            "nn.relu": ["NCHW"]})(mod)
-
-
-Example: Build and Deploy Mobilenet v2 1.0 with BNNS
-----------------------------------------------------
-
-Create a Relay graph from a MXNet Mobilenet v2 1.0 model.
-
-.. code:: python
-
-    import tvm
-    from tvm import relay
-    import mxnet
-    from mxnet.gluon.model_zoo.vision import get_model
-
-    dtype = "float32"
-    input_shape = (1, 3, 224, 224)
-    block = get_model('mobilenetv2_1.0', pretrained=True)
-    module, params = relay.frontend.from_mxnet(block, shape={'data': input_shape}, dtype=dtype)
-
-
-Markup the parts of graphs to be offloaded to BNNS primitives. All ops which are supported by the BNNS
-integration will be handled by BNNS invocations, the rest of the ops will go through the
-regular TVM llvm compilation and code generation.
-
-After that you need to compile new module with target corresponding to required Apple platform
-
-.. code:: python
-
-    from tvm.relay.op.contrib.bnns import partition_for_bnns
-
-    # target for macOS Big Sur 11.1:
-    target = "llvm -mtriple=x86_64-apple-darwin20.2.0"
-
-    model = partition_for_bnns(model, params=params)  # to markup operations to be offloaded to BNNS
-    with tvm.transform.PassContext(opt_level=3):
-        lib = relay.build(model, target=target, params=params)
-
-Export the module.
-
-.. code:: python
-
-    lib.export_library('compiled.dylib')
-
-
-Load module and run inference on the target machine with TVM  built with ``USE_BNNS`` enabled
-
-.. code:: python
-
-    import tvm
-    import numpy as np
-    from tvm.contrib import graph_executor
-
-    dev = tvm.cpu(0)
-    loaded_lib = tvm.runtime.load_module('compiled.dylib')
-    gen_module = tvm.contrib.graph_executor.GraphModule(loaded_lib['default'](dev))
-
-    dtype = "float32"
-    input_shape = (1, 3, 224, 224)
-    input_data = np.random.uniform(0, 1, input_shape).astype(dtype)
-    gen_module.run(data=input_data)
-
-
-
-Operator support
-----------------
-
-+------------------------+------------------------------------------------------------------------------+
-|       Relay Node       |              Remarks                                                         |
-+========================+==============================================================================+
-| nn.conv2d              |                                                                              |
-+------------------------+------------------------------------------------------------------------------+
-| nn.batch_norm          | Supported by BNNS integration only in nn.conv2d-batch_norm pattern           |
-+------------------------+------------------------------------------------------------------------------+
-| nn.dense               |                                                                              |
-+------------------------+------------------------------------------------------------------------------+
-| nn.batch_matmul        |                                                                              |
-+------------------------+------------------------------------------------------------------------------+
-| nn.bias_add            | Supported by BNNS integration only as a bias part of nn.conv2d or nn.dense   |
-|                        | fusion                                                                       |
-+------------------------+------------------------------------------------------------------------------+
-| add                    | Supported by BNNS integration only as a bias part of nn.conv2d or nn.dense   |
-|                        | fusion                                                                       |
-+------------------------+------------------------------------------------------------------------------+
-| nn.relu                | Supported by BNNS integration only as a part of nn.conv2d or nn.dense fusion |
-+------------------------+------------------------------------------------------------------------------+
-| nn.gelu                | Supported by BNNS integration only as a part of nn.conv2d or nn.dense fusion |
-+------------------------+------------------------------------------------------------------------------+
diff --git a/docs/how_to/deploy/cpp_deploy.rst b/docs/how_to/deploy/cpp_deploy.rst
deleted file mode 100644
index 44df1e55b5..0000000000
--- a/docs/how_to/deploy/cpp_deploy.rst
+++ /dev/null
@@ -1,56 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-
-Deploy TVM Module using C++ API
-===============================
-
-We provide an example on how to deploy TVM modules in `apps/howto_deploy <https://github.com/apache/tvm/tree/main/apps/howto_deploy>`_
-
-To run the example, you can use the following command
-
-
-.. code:: bash
-
-    cd apps/howto_deploy
-    ./run_example.sh
-
-
-Get TVM Runtime Library
------------------------
-
-The only thing we need is to link to a TVM runtime in your target platform.
-TVM provides a minimum runtime, which costs around 300K to 600K depending on how much modules we use.
-In most cases, we can use ``libtvm_runtime.so`` that comes with the build.
-
-If somehow you find it is hard to build ``libtvm_runtime``, checkout
-`tvm_runtime_pack.cc <https://github.com/apache/tvm/tree/main/apps/howto_deploy/tvm_runtime_pack.cc>`_.
-It is an example all in one file that gives you TVM runtime.
-You can compile this file using your build system and include this into your project.
-
-You can also checkout `apps <https://github.com/apache/tvm/tree/main/apps/>`_ for example applications build with TVM on iOS, Android and others.
-
-Dynamic Library vs. System Module
----------------------------------
-TVM provides two ways to use the compiled library.
-You can checkout `prepare_test_libs.py <https://github.com/apache/tvm/tree/main/apps/howto_deploy/prepare_test_libs.py>`_
-on how to generate the library and `cpp_deploy.cc <https://github.com/apache/tvm/tree/main/apps/howto_deploy/cpp_deploy.cc>`_ on how to use them.
-
-- Store library as a shared library and dynamically load the library into your project.
-- Bundle the compiled library into your project in system module mode.
-
-Dynamic loading is more flexible and can load new modules on the fly. System module is a more ``static`` approach.  We can use system module in places where dynamic library loading is banned.
diff --git a/docs/how_to/deploy/hls.rst b/docs/how_to/deploy/hls.rst
deleted file mode 100644
index d172332ba8..0000000000
--- a/docs/how_to/deploy/hls.rst
+++ /dev/null
@@ -1,182 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-
-HLS Backend Example
-===================
-
-TVM supports Xilinx FPGA board with SDAccel.  Here is a tutorial for how to deploy TVM to AWS F1 FPGA instance.
-
-.. note::
-
-    This feature is still experimental.  We cannot use SDAccel to deploy an end to end neural networks for now.
-
-We use two python scripts for this tutorial.
-
-- build.py - a script to synthesize FPGA bitstream.
-
-  .. code:: python
-
-      import tvm
-      from tvm import te
-
-      tgt= tvm.target.Target("sdaccel", host="llvm")
-
-      n = te.var("n")
-      A = te.placeholder((n,), name='A')
-      B = te.placeholder((n,), name='B')
-      C = te.compute(A.shape, lambda i: A[i] + B[i], name="C")
-
-      s = te.create_schedule(C.op)
-      px, x = s[C].split(C.op.axis[0], nparts=1)
-
-      s[C].bind(px, tvm.te.thread_axis("pipeline"))
-
-      fadd = tvm.build(s, [A, B, C], tgt, name="myadd")
-
-      fadd.save("myadd.o")
-      fadd.imported_modules[0].save("myadd.xclbin")
-
-      tvm.contrib.cc.create_shared("myadd.so", ["myadd.o"])
-
-- run.py - a script to use FPGA as an accelerator.
-
-  .. code:: python
-
-      import tvm
-      import numpy as np
-      import os
-
-      tgt="sdaccel"
-
-      fadd = tvm.runtime.load_module("myadd.so")
-      if os.environ.get("XCL_EMULATION_MODE"):
-          fadd_dev = tvm.runtime.load_module("myadd.xclbin")
-      else:
-          fadd_dev = tvm.runtime.load_module("myadd.awsxclbin")
-      fadd.import_module(fadd_dev)
-
-      dev = tvm.device(tgt, 0)
-
-      n = 1024
-      a = tvm.nd.array(np.random.uniform(size=n).astype("float32"), dev)
-      b = tvm.nd.array(np.random.uniform(size=n).astype("float32"), dev)
-      c = tvm.nd.array(np.zeros(n, dtype="float32"), dev)
-
-      fadd(a, b, c)
-      tvm.testing.assert_allclose(c.numpy(), a.numpy() + b.numpy())
-
-
-Setup
------
-
-- Launch an instance using the FPGA Developer AMI.  We don't need an F1 instance for emulation and synthesis, so it is recommended to use a lower cost instance for them.
-- Setup AWS FPGA development kit.
-
-  .. code:: bash
-
-      git clone https://github.com/aws/aws-fpga.git
-      cd aws-fpga
-      source sdaccel_setup.sh
-      source ${XILINX_SDX}/settings64.sh
-
-- Setup TVM with OpenCL enabled.
-
-Emulation
----------
-
-- Create emconfig.json for emulation.
-
-  .. code:: bash
-
-      emconfigutil --platform ${AWS_PLATFORM} --nd 1
-
-- Copy emconfig.json to the python binary directory.  It is because the current Xilinx toolkit assumes that both host binary and the emconfig.json file are in the same path.
-
-  .. code:: bash
-
-      cp emconfig.json $(dirname $(which python))
-
-- Run software emulation
-
-  .. code:: bash
-
-      export XCL_EMULATION_MODE=1
-      export XCL_TARGET=sw_emu
-
-      python build.py
-      python run.py
-
-- Run hardware emulation
-
-  .. code:: bash
-
-      export XCL_EMULATION_MODE=1
-      export XCL_TARGET=hw_emu
-
-      python build.py
-      python run.py
-
-Synthesis
----------
-
-- Run synthesis with the following script.
-
-  .. code:: bash
-
-      unset XCL_EMULATION_MODE
-      export XCL_TARGET=hw
-
-      python build.py
-
-- Create AWS FPGA image and upload it to AWS S3.
-
-  .. code:: bash
-
-      ${SDACCEL_DIR}/tools/create_sdaccel_afi.sh \
-          -xclbin=myadd.xclbin -o=myadd \
-          -s3_bucket=<bucket-name> -s3_dcp_key=<dcp-folder-name> \
-          -s3_logs_key=<logs-folder-name>
-
-  This also generates an awsxclbin file, which is necessary to use the AWS FPGA image on F1 instances.
-
-Run
----
-
-- Launch Amazon EC2 F1 instance.
-- Copy ``myadd.so``, ``myadd.awsxclbin``, and ``run.py`` to the F1 instance.
-- Setup AWS FPGA development kit.
-
-  .. code:: bash
-
-      git clone https://github.com/aws/aws-fpga.git
-      cd aws-fpga
-      source sdaccel_setup.sh
-
-- Setup TVM with OpenCL enabled.
-- Become root and setup environment variables.
-
-  .. code:: bash
-
-      sudo sh
-      source ${INSTALL_ROOT}/setup.sh
-
-- Run
-
-  .. code:: bash
-
-      python run.py
diff --git a/docs/how_to/deploy/index.rst b/docs/how_to/deploy/index.rst
deleted file mode 100644
index 4c3f30964b..0000000000
--- a/docs/how_to/deploy/index.rst
+++ /dev/null
@@ -1,191 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-.. _deploy-and-integration:
-
-Deploy Models and Integrate TVM
-===============================
-
-This page contains guidelines on how to deploy TVM to various platforms
-as well as how to integrate it with your project.
-
-.. image::  https://tvm.apache.org/images/release/tvm_flexible.png
-
-Build the TVM runtime library
------------------------------
-
-.. _build-tvm-runtime-on-target-device:
-
-Unlike traditional deep learning frameworks. TVM stack is divided into two major components:
-
-- TVM compiler, which does all the compilation and optimizations of the model
-- TVM runtime, which runs on the target devices.
-
-In order to integrate the compiled module, we **do not** need to build entire
-TVM on the target device. You only need to build the TVM compiler stack on your
-desktop and use that to cross-compile modules that are deployed on the target device.
-
-We only need to use a light-weight runtime API that can be integrated into various platforms.
-
-For example, you can run the following commands to build the runtime API
-on a Linux based embedded system such as Raspberry Pi:
-
-.. code:: bash
-
-    git clone --recursive https://github.com/apache/tvm tvm
-    cd tvm
-    mkdir build
-    cp cmake/config.cmake build
-    cd build
-    cmake ..
-    make runtime
-
-Note that we type ``make runtime`` to only build the runtime library.
-
-It is also possible to cross compile the runtime. Cross compiling
-the runtime library should not be confused with cross compiling models
-for embedded devices.
-
-If you want to include additional runtime such as OpenCL,
-you can modify ``config.cmake`` to enable these options.
-After you get the TVM runtime library, you can link the compiled library
-
-.. figure:: https://raw.githubusercontent.com/tlc-pack/web-data/main/images/dev/tvm_deploy_crosscompile.svg
-   :align: center
-   :width: 85%
-
-A model (optimized or not by TVM) can be cross compiled by TVM for
-different architectures such as ``aarch64`` on a ``x64_64`` host. Once the model
-is cross compiled it is necessary to have a runtime compatible with the target
-architecture to be able to run the cross compiled model.
-
-
-Cross compile the TVM runtime for other architectures
------------------------------------------------------
-
-In the example :ref:`above <build-tvm-runtime-on-target-device>` the runtime library was
-compiled on a Raspberry Pi. Producing the runtime library can be done much faster on
-hosts that have high performace processors with ample resources (such as laptops, workstation)
-compared to a target devices such as a Raspberry Pi. In-order to cross compile the runtime the toolchain
-for the target device must be installed. After installing the correct toolchain,
-the main difference compared to compiling natively is to pass some additional command
-line argument to cmake that specify a toolchain to be used. For reference
-building the TVM runtime library on a modern laptop (using 8 threads) for ``aarch64``
-takes around 20 seconds vs ~10 min to build the runtime on a Raspberry Pi 4.
-
-cross-compile for aarch64
-"""""""""""""""""""""""""
-
-.. code-block:: bash
-
-   sudo apt-get update
-   sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
-
-.. code-block:: bash
-
-    cmake .. \
-        -DCMAKE_SYSTEM_NAME=Linux \
-        -DCMAKE_SYSTEM_VERSION=1 \
-        -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc \
-        -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++ \
-        -DCMAKE_FIND_ROOT_PATH=/usr/aarch64-linux-gnu \
-        -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-        -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-        -DMACHINE_NAME=aarch64-linux-gnu
-
-    make -j$(nproc) runtime
-
-For bare metal ARM devices the following toolchain is quite handy to install instead of gcc-aarch64-linux-*
-
-.. code-block:: bash
-
-   sudo apt-get install gcc-multilib-arm-linux-gnueabihf g++-multilib-arm-linux-gnueabihf
-
-
-cross-compile for RISC-V
-"""""""""""""""""""""""""
-
-.. code-block:: bash
-
-   sudo apt-get update
-   sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
-
-
-.. code-block:: bash
-
-    cmake .. \
-        -DCMAKE_SYSTEM_NAME=Linux \
-        -DCMAKE_SYSTEM_VERSION=1 \
-        -DCMAKE_C_COMPILER=/usr/bin/riscv64-linux-gnu-gcc \
-        -DCMAKE_CXX_COMPILER=/usr/bin/riscv64-linux-gnu-g++ \
-        -DCMAKE_FIND_ROOT_PATH=/usr/riscv64-linux-gnu \
-        -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-        -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-        -DMACHINE_NAME=riscv64-linux-gnu
-
-    make -j$(nproc) runtime
-
-The ``file`` command can be used to query the architecture of the produced runtime.
-
-
-.. code-block:: bash
-
-   file libtvm_runtime.so
-   libtvm_runtime.so: ELF 64-bit LSB shared object, UCB RISC-V, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=e9ak845b3d7f2c126dab53632aea8e012d89477e, not stripped
-
-
-Optimize and tune models for target devices
--------------------------------------------
-
-The easiest and recommended way to test, tune and benchmark TVM kernels on
-embedded devices is through TVM's RPC API.
-Here are the links to the related tutorials.
-
-- :ref:`tutorial-cross-compilation-and-rpc`
-- :ref:`tutorial-deploy-model-on-rasp`
-
-Deploy optimized model on target devices
-----------------------------------------
-
-After you finished tuning and benchmarking, you might need to deploy the model on the
-target device without relying on RPC. See the following resources on how to do so.
-
-.. toctree::
-   :maxdepth: 2
-
-   cpp_deploy
-   android
-   adreno
-   integrate
-   hls
-   arm_compute_lib
-   tensorrt
-   vitis_ai
-   bnns
-   mrvl
-
-Additional Deployment How-Tos
------------------------------
-
-We have also developed a number of how-tos targeting specific devices, with
-working Python code that can be viewed in a Jupyter notebook. These how-tos
-describe how to prepare and deploy models to many of the supported backends.
-
-.. toctree::
-   :maxdepth: 1
-
-   ../deploy_models/index
diff --git a/docs/how_to/deploy/integrate.rst b/docs/how_to/deploy/integrate.rst
deleted file mode 100644
index fe40f68973..0000000000
--- a/docs/how_to/deploy/integrate.rst
+++ /dev/null
@@ -1,70 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-Integrate TVM into Your Project
-===============================
-
-TVM's runtime is designed to be lightweight and portable.
-There are several ways you can integrate TVM into your project.
-
-This article introduces possible ways to integrate TVM
-as a JIT compiler to generate functions on your system.
-
-
-DLPack Support
---------------
-
-TVM's generated function follows the PackedFunc convention.
-It is a function that can take positional arguments including
-standard types such as float, integer, string.
-The PackedFunc takes DLTensor pointer in `DLPack <https://github.com/dmlc/dlpack>`_ convention.
-So the only thing you need to solve is to create a corresponding DLTensor object.
-
-
-
-Integrate User Defined C++ Array
---------------------------------
-
-The only thing we have to do in C++ is to convert your array to DLTensor and pass in its address as
-``DLTensor*`` to the generated function.
-
-
-Integrate User Defined Python Array
------------------------------------
-
-Assume you have a python object ``MyArray``. There are three things that you need to do
-
-- Add ``_tvm_tcode`` field to your array which returns ``tvm.TypeCode.ARRAY_HANDLE``
-- Support ``_tvm_handle`` property in your object, which returns the address of DLTensor in python integer
-- Register this class by ``tvm.register_extension``
-
-.. code:: python
-
-   # Example code
-   import tvm
-
-   class MyArray(object):
-       _tvm_tcode = tvm.TypeCode.ARRAY_HANDLE
-
-       @property
-       def _tvm_handle(self):
-           dltensor_addr = self.get_dltensor_addr()
-           return dltensor_addr
-
-   # You can put registration step in a separate file mypkg.tvm.py
-   # and only optionally import that if you only want optional dependency.
-   tvm.register_extension(MyArray)
diff --git a/docs/how_to/deploy/mrvl.rst b/docs/how_to/deploy/mrvl.rst
deleted file mode 100644
index a0876fbe5a..0000000000
--- a/docs/how_to/deploy/mrvl.rst
+++ /dev/null
@@ -1,277 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-
-Marvell Machine Learning Integration
-====================================
-
-1. Introduction
----------------
-Marvell(R) supports a family of high performance Data Processing
-Units (DPUs) with integrated compute, high speed I/O and workload
-accelerators. These workload accelerators includes Marvell's
-Machine Learning Inference Processor (MLIP), a highly optimized,
-integrated inference engine.
-
-TVM supports Marvell's MLIP using the "mrvl" library. This partitions and
-compiles supported operations for accelerated execution on MLIP, or LLVM
-for general compute.
-
-For runtime, the library supports native execution on MLIP hardware
-as well as Marvell's ML simulator (mrvl-mlsim).
-
-The library supports Marvell's Octeon family of processors with ML accelarators.
-
-This guide demonstrates building TVM with codegen and
-runtime enabled. It also provides example code to compile and run
-models using 'mrvl' runtime.
-
-2. Building TVM with mrvl support
----------------------------------
-
-2.1 Clone TVM repo
--------------------
-
-Refer to the following TVM documentation for cloning TVM
-https://tvm.apache.org/docs/install/from_source.html
-
-2.2 Build and start the TVM - mrvl docker container
-----------------------------------------------------
-
-.. code:: bash
-
-    ./docker/build.sh demo_mrvl bash  # Build the docker container
-    ./docker/bash.sh tvm.demo_mrvl    # Load the docker image
-
-3. Compiling a model using TVMC command line
---------------------------------------------
-Models can be compiled and run for mrvl target using TVMC
-which is optimized for performance.
-
-Refer to the following TVMC documentation, for tvmc generic options.
-https://tvm.apache.org/docs/tutorial/tvmc_command_line_driver.html
-
-Additional mrvl-specific options may be added as attributes if
-necessary. The advanced usage is described in this document below.
-
-3.1 TVMC Compilation Flow for a model
--------------------------------------
-
-Refer to the following TVM documentation, for compilation flow
-https://tvm.apache.org/docs/arch/index.html#example-compilation-flow
-
-
-3.2. TVMC - Command line option(s): Syntax for mrvl target
-----------------------------------------------------------
-
-Compiling an ONNX model using the tvmc for mrvl target.
-
-**Syntax:**
-
-.. code:: python
-
-    python3 -m tvm.driver.tvmc compile --target="mrvl, llvm"
-        --target-llvm-<options>
-        --target-mrvl-<options>
-        --<tvm-generic-options>
-        model_file.onnx
-
-Following is an example TVMC Compile command for an ARMv9 core and
-integrated MLIP cn10ka processor, using only 4 tiles in the block.
-
-**Example:**
-
-.. code:: python
-
-    python3 -m tvm.driver.tvmc compile --target="mrvl, llvm" \
-        --target-llvm-mtriple=aarch64-linux-gnu --target-llvm-mcpu=neoverse-n2 \
-        --target-mrvl-num_tiles=4 \
-        --target-mrvl-mattr="hw -quantize=fp16 -wb_pin_ocm=1" \
-        --cross-compiler aarch64-linux-gnu-gcc \
-        --output model.tar \
-        mnist-12.onnx
-
-
-3.3. TVMC Compiler: mrvl specific Command Line Options
-------------------------------------------------------
-
-.. code:: python
-
-  --target-mrvl-mcpu
-  --target-mrvl-num_tiles
-  --target-mrvl-mattr
-
-**Description of mrvl options**
-
-* mcpu:
-    The CPU class of Marvell(R) ML Inference Processor;
-    possible values = {cn10ka, cnf10kb}; defaults to cn10ka
-
-* num_tiles:
-    Maximum number of tiles that may be used, possible values = {1,2,4,8}, defaults to 8
-
-* mattr:
-    Attributes for mrvl; possible values = {quantize, wb_pin_ocm, run_mode}
-
-    mattr specifies the data type, code generation options and optimizations.
-
-    *List of supported attributes are:*
-
-    **1. quantize**
-
-    Specify the data type. Possible values = {fp16, int8}.
-    Default is fp16, int8 is WIP and full support will be added in a future PR.
-
-    **2. wb_pin_ocm**
-
-    Optimize runtime by preloading a model's weights and bias into
-    the on chip memory. Possible values = {0, 1}. Default is 0 (no preload)
-
-    **3. run_mode**
-
-    Specify whether to compile for the simulator or for the target hardware (Octeon).
-    Possible values = {sim, hw}. Default is sim (software simulator).
-
-4. Compile ONNX model using the TVMC flow
------------------------------------------
-
-In the TVMC mrvl flow, the model is partitioned into Marvell and LLVM regions.
-Building each partitioned Marvell subgraph generates serialized nodes.json and
-const.json. Partitioned nodes.json is the representation of the model graph which is
-suitable for the Marvell compiler (mrvl-tmlc). The compiler compiles the model graph to
-generate the model binary with MLIP instructions.
-
-4.1 Compile and Run ONNX model for Simulator + LLVM / x86_64 target
---------------------------------------------------------------------
-
-**Model Compilation for Simulator + LLVM / x86_64 target**
-
-.. code:: python
-
-    python3 -m tvm.driver.tvmc compile --target="mrvl, llvm" \
-        --target-mrvl-num_tiles=4 --output model.tar model.onnx
-
-**Run TVM models on x86_64 host using MLIP Simulator**
-
-Generated model binary is simulated using Marvell's MLIP Simulator(mrvl-mlsim).
-
-.. code:: python
-
-    python3 -m tvm.driver.tvmc run --inputs infer.npz --outputs predict.npz model.tar --number=0
-
-4.2 Compile and Run ONNX model for Octeon target
-----------------------------------------------------------
-
-**Model Compilation for Octeon target**
-
-Please refer to section 3.2 for the example command line.
-
-**Run TVM models on the Octeon Target**
-
-The cross compiled binary can be run on the target hardware using the tvmc run command.
-Alternatively, the RPC flow enables remote execution on the target device from your
-local machine: https://tvm.apache.org/docs/how_to/tutorials/cross_compilation_and_rpc.html
-
-.. code:: python
-
-    python3 -m tvm.driver.tvmc run --inputs infer.npz --outputs predict.npz model.tar
-
-5. Compiling a model using Python APIs
---------------------------------------
-
-In addition to using TVMC, models can also be compiled and run using
-TVM Python API. Below is an example to compile and run the MNIST model.
-
-**Download MNIST model from the web**
-
-.. code:: bash
-
-    cd $HOME
-    wget https://github.com/onnx/models/raw/main/validated/vision/classification/mnist/model/mnist-12.onnx
-
-**Import the TVM and other dependent modules**
-
-.. code:: python
-
-    import tvm, onnx
-    import numpy as np
-    import tvm.relay as relay
-    from tvm.contrib import graph_executor
-    from tvm.relay.op.contrib.mrvl import partition_for_mrvl
-    from tvm.relay.build_module import build
-    from keras.datasets import mnist
-
-**Load model onnx file**
-
-.. code:: python
-
-    onnx_model = onnx.load("mnist-12.onnx")
-
-**Create a Relay graph from MNIST model**
-
-.. code:: python
-
-    shape_dict = {'Input3' : (1,1,28,28)}
-    mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
-
-**Define option dictionary and Partition the Model**
-
-Annotate and partition the graph for mrvl. All operations which are supported
-by the mrvl will be marked and offloaded to mrvl hardware accelerator. The rest of the
-operations will go through the regular LLVM compilation and code generation for ARM.
-
-.. code:: python
-
-    tvm_target = "llvm"
-
-    option_dict = {'num_tiles': 4}
-
-    mod = partition_for_mrvl(mod, params, **option_dict)
-
-**Build the Relay Graph**
-
-Build the Relay graph, using the new module returned by partition_for_mrvl.
-
-.. code:: python
-
-    with tvm.transform.PassContext(opt_level=3, config={"relay.ext.mrvl.options" : option_dict}):
-        model_lib = relay.build(mod, tvm_target, params=params)
-
-**Generate runtime graph of the model library**
-
-.. code:: python
-
-    dev = tvm.cpu()
-    model_rt_graph = graph_executor.GraphModule(model_lib["default"](dev))
-
-**Get test data and initialize model input**
-
-.. code:: python
-
-    (train_X, train_y), (test_X, test_y) = mnist.load_data()
-    image = tvm.nd.array(test_X[0].reshape(1, 1, 28, 28).astype("float32") / 255)
-    inputs_dict = {}
-    inputs_dict["Input3"] = image
-    model_rt_graph.set_input(**inputs_dict)
-
-**Run Inference and print the output**
-
-.. code:: python
-
-    model_rt_graph.run()
-    output_tensor = model_rt_graph.get_output(0).numpy()
-    print (output_tensor)
diff --git a/docs/how_to/deploy/tensorrt.rst b/docs/how_to/deploy/tensorrt.rst
deleted file mode 100644
index cb1b309db0..0000000000
--- a/docs/how_to/deploy/tensorrt.rst
+++ /dev/null
@@ -1,315 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-Relay TensorRT Integration
-==========================
-**Author**: `Trevor Morris <https://github.com/trevor-m>`_
-
-Introduction
-------------
-
-NVIDIA TensorRT is a library for optimized deep learning inference. This integration will offload as
-many operators as possible from Relay to TensorRT, providing a performance boost on NVIDIA GPUs
-without the need to tune schedules.
-
-This guide will demonstrate how to install TensorRT and build TVM with TensorRT BYOC and runtime
-enabled. It will also provide example code to compile and run a ResNet-18 model using TensorRT and
-how to configure the compilation and runtime settings. Finally, we document the supported operators
-and how to extend the integration to support other operators.
-
-Installing TensorRT
--------------------
-
-In order to download TensorRT, you will need to create an NVIDIA Developer program account. Please
-see NVIDIA's documentation for more info:
-https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html. If you have a Jetson device
-such as a TX1, TX2, Xavier, or Nano, TensorRT will already be installed on the device via the
-JetPack SDK.
-
-There are two methods to install TensorRT:
-
-* System install via deb or rpm package.
-* Tar file installation.
-
-With the tar file installation method, you must provide the path of the extracted tar archive to
-USE_TENSORRT_RUNTIME=/path/to/TensorRT. With the system install method,
-USE_TENSORRT_RUNTIME=ON will automatically locate your installation.
-
-Building TVM with TensorRT support
-----------------------------------
-
-There are two separate build flags for TensorRT integration in TVM. These flags also enable
-cross-compilation: USE_TENSORRT_CODEGEN=ON will also you to build a module with TensorRT support on
-a host machine, while USE_TENSORRT_RUNTIME=ON will enable the TVM runtime on an edge device to
-execute the TensorRT module. You should enable both if you want to compile and also execute models
-with the same TVM build.
-
-* USE_TENSORRT_CODEGEN=ON/OFF - This flag will enable compiling a TensorRT module, which does not require any
-  TensorRT library.
-* USE_TENSORRT_RUNTIME=ON/OFF/path-to-TensorRT - This flag will enable the TensorRT runtime module.
-  This will build TVM against the installed TensorRT library.
-
-Example setting in config.cmake file:
-
-.. code:: cmake
-
-    set(USE_TENSORRT_CODEGEN ON)
-    set(USE_TENSORRT_RUNTIME /home/ubuntu/TensorRT-7.0.0.11)
-
-
-Build and Deploy ResNet-18 with TensorRT
-----------------------------------------
-
-Create a Relay graph from a MXNet ResNet-18 model.
-
-.. code:: python
-
-    import tvm
-    from tvm import relay
-    import mxnet
-    from mxnet.gluon.model_zoo.vision import get_model
-
-    dtype = "float32"
-    input_shape = (1, 3, 224, 224)
-    block = get_model('resnet18_v1', pretrained=True)
-    mod, params = relay.frontend.from_mxnet(block, shape={'data': input_shape}, dtype=dtype)
-
-
-Annotate and partition the graph for TensorRT. All ops which are supported by the TensorRT
-integration will be marked and offloaded to TensorRT. The rest of the ops will go through the
-regular TVM CUDA compilation and code generation.
-
-.. code:: python
-
-    from tvm.relay.op.contrib.tensorrt import partition_for_tensorrt
-    mod = partition_for_tensorrt(mod, params)
-
-
-Build the Relay graph, using the new module and config returned by partition_for_tensorrt. The
-target must always be a cuda target. ``partition_for_tensorrt`` will automatically fill out the
-required values in the config, so there is no need to modify it - just pass it along to the
-PassContext so the values can be read during compilation.
-
-.. code:: python
-
-    target = "cuda"
-    with tvm.transform.PassContext(opt_level=3):
-        lib = relay.build(mod, target=target, params=params)
-
-
-Export the module.
-
-.. code:: python
-
-    lib.export_library('compiled.so')
-
-
-Load module and run inference on the target machine, which must be built with
-``USE_TENSORRT_RUNTIME`` enabled. The first run will take longer because the TensorRT engine will
-have to be built.
-
-.. code:: python
-
-    dev = tvm.cuda(0)
-    loaded_lib = tvm.runtime.load_module('compiled.so')
-    gen_module = tvm.contrib.graph_executor.GraphModule(loaded_lib['default'](dev))
-    input_data = np.random.uniform(0, 1, input_shape).astype(dtype)
-    gen_module.run(data=input_data)
-
-
-Partitioning and Compilation Settings
--------------------------------------
-
-There are some options which can be configured in ``partition_for_tensorrt``.
-
-* ``version`` - TensorRT version to target as tuple of (major, minor, patch). If TVM is compiled
-  with USE_TENSORRT_RUNTIME=ON, the linked TensorRT version will be used instead. The version
-  will affect which ops can be partitioned to TensorRT.
-* ``use_implicit_batch`` - Use TensorRT implicit batch mode (default true). Setting to false will
-  enable explicit batch mode which will widen supported operators to include those which modify the
-  batch dimension, but may reduce performance for some models.
-* ``remove_no_mac_subgraphs`` - A heuristic to improve performance. Removes subgraphs which have
-  been partitioned for TensorRT if they do not have any multiply-accumulate operations. The removed
-  subgraphs will go through TVM's standard compilation instead.
-* ``max_workspace_size`` - How many bytes of workspace size to allow each subgraph to use for
-  TensorRT engine creation. See TensorRT documentation for more info. Can be overriden at runtime.
-
-
-Runtime Settings
-----------------
-
-There are some additional options which can be configured at runtime using environment variables.
-
-* Automatic FP16 Conversion - Environment variable ``TVM_TENSORRT_USE_FP16=1`` can be set to
-  automatically convert the TensorRT components of your model to 16-bit floating point precision.
-  This can greatly increase performance, but may cause some slight loss in the model accuracy.
-* Caching TensorRT Engines - During the first inference, the runtime will invoke the TensorRT API
-  to build an engine. This can be time consuming, so you can set ``TVM_TENSORRT_CACHE_DIR`` to
-  point to a directory to save these built engines to on the disk. The next time you load the model
-  and give it the same directory, the runtime will load the already built engines to avoid the long
-  warmup time. A unique directory is required for each model.
-* TensorRT has a paramter to configure the maximum amount of scratch space that each layer in the
-  model can use. It is generally best to use the highest value which does not cause you to run out
-  of memory. You can use ``TVM_TENSORRT_MAX_WORKSPACE_SIZE`` to override this by specifying the
-  workspace size in bytes you would like to use.
-* For models which contain a dynamic batch dimension, the varaible ``TVM_TENSORRT_MULTI_ENGINE``
-  can be used to determine how TensorRT engines will be created at runtime. The default mode,
-  ``TVM_TENSORRT_MULTI_ENGINE=0``, will maintain only one engine in memory at a time. If an input
-  is encountered with a higher batch size, the engine will be rebuilt with the new max_batch_size
-  setting. That engine will be compatible with all batch sizes from 1 to max_batch_size. This mode
-  reduces the amount of memory used at runtime. The second mode, ``TVM_TENSORRT_MULTI_ENGINE=1``
-  will build a unique TensorRT engine which is optimized for each batch size that is encountered.
-  This will give greater performance, but will consume more memory.
-
-
-Operator support
-----------------
-+------------------------+------------------------------------+
-|       Relay Node       |              Remarks               |
-+========================+====================================+
-| nn.relu                |                                    |
-+------------------------+------------------------------------+
-| sigmoid                |                                    |
-+------------------------+------------------------------------+
-| tanh                   |                                    |
-+------------------------+------------------------------------+
-| nn.batch_norm          |                                    |
-+------------------------+------------------------------------+
-| nn.layer_norm          |                                    |
-+------------------------+------------------------------------+
-| nn.softmax             |                                    |
-+------------------------+------------------------------------+
-| nn.conv1d              |                                    |
-+------------------------+------------------------------------+
-| nn.conv2d              |                                    |
-+------------------------+------------------------------------+
-| nn.dense               |                                    |
-+------------------------+------------------------------------+
-| nn.bias_add            |                                    |
-+------------------------+------------------------------------+
-| add                    |                                    |
-+------------------------+------------------------------------+
-| subtract               |                                    |
-+------------------------+------------------------------------+
-| multiply               |                                    |
-+------------------------+------------------------------------+
-| divide                 |                                    |
-+------------------------+------------------------------------+
-| power                  |                                    |
-+------------------------+------------------------------------+
-| maximum                |                                    |
-+------------------------+------------------------------------+
-| minimum                |                                    |
-+------------------------+------------------------------------+
-| nn.max_pool2d          |                                    |
-+------------------------+------------------------------------+
-| nn.avg_pool2d          |                                    |
-+------------------------+------------------------------------+
-| nn.global_max_pool2d   |                                    |
-+------------------------+------------------------------------+
-| nn.global_avg_pool2d   |                                    |
-+------------------------+------------------------------------+
-| exp                    |                                    |
-+------------------------+------------------------------------+
-| log                    |                                    |
-+------------------------+------------------------------------+
-| sqrt                   |                                    |
-+------------------------+------------------------------------+
-| abs                    |                                    |
-+------------------------+------------------------------------+
-| negative               |                                    |
-+------------------------+------------------------------------+
-| nn.batch_flatten       |                                    |
-+------------------------+------------------------------------+
-| expand_dims            |                                    |
-+------------------------+------------------------------------+
-| squeeze                |                                    |
-+------------------------+------------------------------------+
-| concatenate            |                                    |
-+------------------------+------------------------------------+
-| nn.conv2d_transpose    |                                    |
-+------------------------+------------------------------------+
-| transpose              |                                    |
-+------------------------+------------------------------------+
-| layout_transform       |                                    |
-+------------------------+------------------------------------+
-| reshape                |                                    |
-+------------------------+------------------------------------+
-| nn.pad                 |                                    |
-+------------------------+------------------------------------+
-| sum                    |                                    |
-+------------------------+------------------------------------+
-| prod                   |                                    |
-+------------------------+------------------------------------+
-| max                    |                                    |
-+------------------------+------------------------------------+
-| min                    |                                    |
-+------------------------+------------------------------------+
-| mean                   |                                    |
-+------------------------+------------------------------------+
-| nn.adaptive_max_pool2d |                                    |
-+------------------------+------------------------------------+
-| nn.adaptive_avg_pool2d |                                    |
-+------------------------+------------------------------------+
-| nn.batch_matmul        |                                    |
-+------------------------+------------------------------------+
-| clip                   | Requires TensorRT 5.1.5 or greater |
-+------------------------+------------------------------------+
-| nn.leaky_relu          | Requires TensorRT 5.1.5 or greater |
-+------------------------+------------------------------------+
-| sin                    | Requires TensorRT 5.1.5 or greater |
-+------------------------+------------------------------------+
-| cos                    | Requires TensorRT 5.1.5 or greater |
-+------------------------+------------------------------------+
-| atan                   | Requires TensorRT 5.1.5 or greater |
-+------------------------+------------------------------------+
-| ceil                   | Requires TensorRT 5.1.5 or greater |
-+------------------------+------------------------------------+
-| floor                  | Requires TensorRT 5.1.5 or greater |
-+------------------------+------------------------------------+
-| split                  | Requires TensorRT 5.1.5 or greater |
-+------------------------+------------------------------------+
-| strided_slice          | Requires TensorRT 5.1.5 or greater |
-+------------------------+------------------------------------+
-| nn.conv3d              | Requires TensorRT 6.0.1 or greater |
-+------------------------+------------------------------------+
-| nn.max_pool3d          | Requires TensorRT 6.0.1 or greater |
-+------------------------+------------------------------------+
-| nn.avg_pool3d          | Requires TensorRT 6.0.1 or greater |
-+------------------------+------------------------------------+
-| nn.conv3d_transpose    | Requires TensorRT 6.0.1 or greater |
-+------------------------+------------------------------------+
-| erf                    | Requires TensorRT 7.0.0 or greater |
-+------------------------+------------------------------------+
-
-
-Adding a new operator
----------------------
-To add support for a new operator, there are a series of files we need to make changes to:
-
-* `src/runtime/contrib/tensorrt/tensorrt_ops.cc` Create a new op converter class which
-  implements the ``TensorRTOpConverter`` interface. You must implement the constructor to specify how
-  many inputs there are and whether they are tensors or weights. You must also implement the
-  ``Convert`` method to perform the conversion. This is done by using the inputs, attributes, and
-  network from params to add the new TensorRT layers and push the layer outputs. You can use the
-  existing converters as an example. Finally, register your new op conventer in the
-  ``GetOpConverters()`` map.
-* `python/relay/op/contrib/tensorrt.py` This file contains the annotation rules for TensorRT. These
-  determine which operators and their attributes that are supported. You must register an annotation
-  function for the relay operator and specify which attributes are supported by your converter, by
-  checking the attributes are returning true or false.
-* `tests/python/contrib/test_tensorrt.py` Add unit tests for the given operator.
diff --git a/docs/how_to/deploy/vitis_ai.rst b/docs/how_to/deploy/vitis_ai.rst
deleted file mode 100755
index 101be905ad..0000000000
--- a/docs/how_to/deploy/vitis_ai.rst
+++ /dev/null
@@ -1,480 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-
-Vitis AI Integration
-====================
-
-`Vitis AI <https://github.com/Xilinx/Vitis-AI>`__ is Xilinx's
-development stack for hardware-accelerated AI inference on Xilinx
-platforms, including both edge devices and Alveo cards. It consists of
-optimized IP, tools, libraries, models, and example designs. It is
-designed with high efficiency and ease of use in mind, unleashing the
-full potential of AI acceleration on Xilinx FPGA and ACAP.
-
-The current Vitis AI flow inside TVM enables acceleration of Neural
-Network model inference on edge and cloud with the `Zynq Ultrascale+
-MPSoc <https://www.xilinx.com/products/silicon-devices/soc/zynq-ultrascale-mpsoc.html>`__,
-`Alveo <https://www.xilinx.com/products/boards-and-kits/alveo.html>`__
-and `Versal <https://www.xilinx.com/products/silicon-devices/acap/versal.html>`__ platforms.
-The identifiers for the supported edge and cloud Deep Learning Processor Units (DPU's) are:
-
-+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+
-| **Target Board**                                                                        | **DPU ID**            | **TVM Target ID**          |
-+=========================================================================================+=======================+============================+
-| `ZCU104 <https://www.xilinx.com/products/boards-and-kits/zcu104.html>`__                | DPUCZDX8G             | DPUCZDX8G-zcu104           |
-+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+
-| `ZCU102 <https://www.xilinx.com/products/boards-and-kits/ek-u1-zcu102-g.html>`__        | DPUCZDX8G             | DPUCZDX8G-zcu102           |
-+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+
-| `Kria KV260 <https://www.xilinx.com/products/som/kria/kv260-vision-starter-kit.html>`__ | DPUCZDX8G             | DPUCZDX8G-kv260            |
-+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+
-| `VCK190 <https://www.xilinx.com/products/boards-and-kits/vck190.html>`__                | DPUCVDX8G             | DPUCVDX8G                  |
-+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+
-| `VCK5000 <https://www.xilinx.com/products/boards-and-kits/vck5000.html>`__              | DPUCVDX8H             | DPUCVDX8H                  |
-+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+
-| `U200 <https://www.xilinx.com/products/boards-and-kits/alveo/u200.html>`__              | DPUCADF8H             | DPUCADF8H                  |
-+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+
-| `U250 <https://www.xilinx.com/products/boards-and-kits/alveo/u250.html>`__              | DPUCADF8H             | DPUCADF8H                  |
-+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+
-| `U50 <https://www.xilinx.com/products/boards-and-kits/alveo/u50.html>`__                | DPUCAHX8H / DPUCAHX8L | DPUCAHX8H-u50 / DPUCAHX8L  |
-+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+
-| `U280 <https://www.xilinx.com/products/boards-and-kits/alveo/u280.html>`__              | DPUCAHX8H / DPUCAHX8L | DPUCAHX8H-u280 / DPUCAHX8L |
-+-----------------------------------------------------------------------------------------+-----------------------+----------------------------+
-
-For more information about the DPU identifiers see following table:
-
-+-------------------+-------------+--------------------------------+------------------------+------------------------+------------------------+
-| DPU               | Application | HW Platform                    | Quantization Method    | Quantization Bitwidth  | Design Target          |
-+===================+=============+================================+========================+========================+========================+
-| | Deep Learning   | | C: CNN    | | AD: Alveo DDR                | | X: DECENT            | | 4: 4-bit             | | G: General purpose   |
-| | Processing Unit | | R: RNN    | | AH: Alveo HBM                | | I: Integer threshold | | 8: 8-bit             | | H: High throughput   |
-|                   |             | | VD: Versal DDR with AIE & PL | | F: Float threshold   | | 16: 16-bit           | | L: Low latency       |
-|                   |             | | ZD: Zynq DDR                 | | R: RNN               | | M: Mixed Precision   | | C: Cost optimized    |
-+-------------------+-------------+--------------------------------+------------------------+------------------------+------------------------+
-
-On this page you will find information on how to `setup <#setup-instructions>`__ TVM with Vitis AI
-on different platforms (Zynq, Alveo, Versal) and on how to get started with `Compiling a Model <#compiling-a-model>`__
-and executing on different platforms: `Inference <#inference>`__.
-
-System Requirements
--------------------
-
-The `Vitis AI System Requirements page <https://github.com/Xilinx/Vitis-AI/blob/master/docs/learn/system_requirements.md>`__
-lists the system requirements for running docker containers as well as doing executing on Alveo cards.
-For edge devices (e.g. Zynq), deploying models requires a host machine for compiling models using the TVM with Vitis AI flow,
-and an edge device for running the compiled models. The host system requirements are the same as specified in the link above.
-
-Setup instructions
-------------------
-
-This section provide the instructions for setting up the TVM with Vitis AI flow for both cloud and edge.
-TVM with Vitis AI support is provided through a docker container. The provided scripts and Dockerfile
-compiles TVM and Vitis AI into a single image.
-
-1. Clone TVM repo
-
-   .. code:: bash
-
-      git clone --recursive https://github.com/apache/tvm.git
-      cd tvm
-
-2. Build and start the TVM - Vitis AI docker container.
-
-   .. code:: bash
-
-      ./docker/build.sh demo_vitis_ai bash
-      ./docker/bash.sh tvm.demo_vitis_ai
-
-      # Setup inside container
-      conda activate vitis-ai-tensorflow
-
-3. Build TVM inside the container with Vitis AI (inside tvm directory)
-
-   .. code:: bash
-
-      mkdir build
-      cp cmake/config.cmake build
-      cd build
-      echo set\(USE_LLVM ON\) >> config.cmake
-      echo set\(USE_VITIS_AI ON\) >> config.cmake
-      cmake ..
-      make -j$(nproc)
-
-4.  Install TVM
-
-    .. code:: bash
-
-      cd ../python
-      pip3 install -e . --user
-
-Inside this docker container you can now compile models for both cloud and edge targets.
-To run on cloud Alveo or Versal VCK5000 cards inside the docker container, please follow the
-`Alveo <#alveo-setup>`__ respectively  `Versal VCK5000 <#versal-vck5000-setup>`__ setup instructions.
-To setup your Zynq or Versal VCK190 evaluation board for inference, please follow
-the `Zynq <#zynq-setup>`__ respectively `Versal VCK190 <#versal-vck190-setup>`__ instructions.
-
-Alveo Setup
-~~~~~~~~~~~
-
-Check out following page for setup information: `Alveo Setup <https://github.com/Xilinx/Vitis-AI/blob/v1.4/setup/alveo/README.md>`__.
-
-After setup, you can select the right DPU inside the docker container in the following way:
-
-.. code:: bash
-
-      cd /workspace
-      git clone --branch v1.4 --single-branch --recursive https://github.com/Xilinx/Vitis-AI.git
-      cd Vitis-AI/setup/alveo
-      source setup.sh [DPU-IDENTIFIER]
-
-The DPU identifier for this can be found in the second column of the DPU Targets table at the top of this page.
-
-Versal VCK5000 Setup
-~~~~~~~~~~~~~~~~~~~~
-
-Check out following page for setup information: `VCK5000 Setup <https://github.com/Xilinx/Vitis-AI/blob/v1.4/setup/vck5000/README.md>`__.
-
-After setup, you can select the right DPU inside the docker container in the following way:
-
-.. code:: bash
-
-      cd /workspace
-      git clone --branch v1.4 --single-branch --recursive https://github.com/Xilinx/Vitis-AI.git
-      cd Vitis-AI/setup/vck5000
-      source setup.sh
-
-Zynq Setup
-~~~~~~~~~~
-
-For the Zynq target (DPUCZDX8G) the compilation stage will run inside the docker on a host machine.
-This doesn't require any specific setup except for building the TVM - Vitis AI docker. For executing the model,
-the Zynq board will first have to be set up and more information on that can be found here.
-
-1. Download the Petalinux image for your target:
-    - `ZCU104 <https://www.xilinx.com/member/forms/download/design-license-xef.html?filename=xilinx-zcu104-dpu-v2021.1-v1.4.0.img.gz>`__
-    - `ZCU102 <https://www.xilinx.com/member/forms/download/design-license-xef.html?filename=xilinx-zcu102-dpu-v2021.1-v1.4.0.img.gz>`__
-    - `Kria KV260 <https://www.xilinx.com/member/forms/download/design-license-xef.html?filename=xilinx-kv260-dpu-v2020.2-v1.4.0.img.gz>`__
-2. Use Etcher software to burn the image file onto the SD card.
-3. Insert the SD card with the image into the destination board.
-4. Plug in the power and boot the board using the serial port to operate on the system.
-5. Set up the IP information of the board using the serial port. For more details on step 1 to 5, please refer to `Setting Up The Evaluation Board <https://www.xilinx.com/html_docs/vitis_ai/1_4/installation.html#ariaid-title8>`__.
-6. Create 4GB of swap space on the board
-
-.. code:: bash
-
-      fallocate -l 4G /swapfile
-      chmod 600 /swapfile
-      mkswap /swapfile
-      swapon /swapfile
-      echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
-
-7. Install hdf5 dependency (will take between 30 min and 1 hour to finish)
-
-.. code:: bash
-
-      cd /tmp && \
-        wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7.tar.gz && \
-        tar -zxvf hdf5-1.10.7.tar.gz && \
-        cd hdf5-1.10.7 && \
-        ./configure --prefix=/usr && \
-        make -j$(nproc) && \
-        make install && \
-        cd /tmp && rm -rf hdf5-1.10.7*
-
-8. Install Python dependencies
-
-.. code:: bash
-
-      pip3 install Cython==0.29.23 h5py==2.10.0 pillow
-
-9. Install PyXIR
-
-.. code:: bash
-
-      git clone --recursive --branch rel-v0.3.1 --single-branch https://github.com/Xilinx/pyxir.git
-      cd pyxir
-      sudo python3 setup.py install --use_vart_edge_dpu
-
-10. Build and install TVM with Vitis AI
-
-.. code:: bash
-
-      git clone --recursive https://github.com/apache/tvm
-      cd tvm
-      mkdir build
-      cp cmake/config.cmake build
-      cd build
-      echo set\(USE_LLVM OFF\) >> config.cmake
-      echo set\(USE_VITIS_AI ON\) >> config.cmake
-      cmake ..
-      make tvm_runtime -j$(nproc)
-      cd ../python
-      pip3 install --no-deps  -e .
-
-11. Check whether the setup was successful in the Python shell:
-
-.. code:: bash
-
-      python3 -c 'import pyxir; import tvm'
-
-.. note::
-
-    You might see a warning about the 'cpu-tf' runtime not being found. This warning is
-    expected on the board and can be ignored.
-
-
-Versal VCK190 Setup
-~~~~~~~~~~~~~~~~~~~
-
-For the Versal VCK190 setup, please follow the instructions for `Zynq Setup <#zynq-setup>`__,
-but now use the `VCK190 image <https://www.xilinx.com/member/forms/download/design-license-xef.html?filename=xilinx-vck190-dpu-v2020.2-v1.4.0.img.gz>`__
-in step 1. The other steps are the same.
-
-
-Compiling a Model
------------------
-
-The TVM with Vitis AI flow contains two stages: Compilation and Inference.
-During the compilation a user can choose a model to compile for the cloud or
-edge target devices that are currently supported. Once a model is compiled,
-the generated files can be used to run the model on a the specified target
-device during the `Inference <#inference>`__ stage. Currently, the TVM with
-Vitis AI flow supported a selected number of Xilinx data center and edge devices.
-
-In this section we walk through the typical flow for compiling models with Vitis AI
-inside TVM.
-
-**Imports**
-
-Make sure to import PyXIR and the DPU target (``import pyxir.contrib.target.DPUCADF8H`` for DPUCADF8H):
-
-.. code:: python
-
-   import pyxir
-   import pyxir.contrib.target.DPUCADF8H
-
-   import tvm
-   import tvm.relay as relay
-   from tvm.contrib.target import vitis_ai
-   from tvm.contrib import utils, graph_executor
-   from tvm.relay.op.contrib.vitis_ai import partition_for_vitis_ai
-
-**Declare the Target**
-
-.. code:: python
-
-   tvm_target = 'llvm'
-   dpu_target = 'DPUCADF8H' # options: 'DPUCADF8H', 'DPUCAHX8H-u50', 'DPUCAHX8H-u280', 'DPUCAHX8L', 'DPUCVDX8H', 'DPUCZDX8G-zcu104', 'DPUCZDX8G-zcu102', 'DPUCZDX8G-kv260'
-
-The TVM with Vitis AI flow currently supports the DPU targets listed in
-the table at the top of this page. Once the appropriate targets are defined,
-we invoke the TVM compiler to build the graph for the specified target.
-
-**Import the Model**
-
-Example code to import an MXNet model:
-
-.. code:: python
-
-   mod, params = relay.frontend.from_mxnet(block, input_shape)
-
-
-**Partition the Model**
-
-After importing the model, we utilize the Relay API to annotate the Relay expression for the provided DPU target and partition the graph.
-
-.. code:: python
-
-    mod = partition_for_vitis_ai(mod, params, dpu=dpu_target)
-
-
-**Build the Model**
-
-The partitioned model is passed to the TVM compiler to generate the runtime libraries for the TVM Runtime.
-
-.. code:: python
-
-    export_rt_mod_file = os.path.join(os.getcwd(), 'vitis_ai.rtmod')
-    build_options = {
-        'dpu': dpu_target,
-        'export_runtime_module': export_rt_mod_file
-    }
-    with tvm.transform.PassContext(opt_level=3, config={'relay.ext.vitis_ai.options': build_options}):
-        lib = relay.build(mod, tvm_target, params=params)
-
-**Quantize the Model**
-
-Usually, to be able to accelerate inference of Neural Network models
-with Vitis AI DPU accelerators, those models need to quantized upfront.
-In TVM - Vitis AI flow, we make use of on-the-fly quantization to remove
-this additional preprocessing step. In this flow, one doesn't need to
-quantize his/her model upfront but can make use of the typical inference
-execution calls (module.run) to quantize the model on-the-fly using the
-first N inputs that are provided (see more information below). This will
-set up and calibrate the Vitis-AI DPU and from that point onwards
-inference will be accelerated for all next inputs. Note that the edge
-flow deviates slightly from the explained flow in that inference won't
-be accelerated after the first N inputs but the model will have been
-quantized and compiled and can be moved to the edge device for
-deployment. Please check out the `Running on Zynq <#running-on-zynq>`__
-section below for more information.
-
-.. code:: python
-
-   module = graph_executor.GraphModule(lib["default"](tvm.cpu()))
-
-   # First N (default = 128) inputs are used for quantization calibration and will
-   # be executed on the CPU
-   # This config can be changed by setting the 'PX_QUANT_SIZE' (e.g. export PX_QUANT_SIZE=64)
-   for i in range(128):
-      module.set_input(input_name, inputs[i])
-      module.run()
-
-By default, the number of images used for quantization is set to 128.
-You could change the number of images used for On-The-Fly Quantization
-with the PX_QUANT_SIZE environment variable. For example, execute the
-following line in the terminal before calling the compilation script
-to reduce the quantization calibration dataset to eight images.
-This can be used for quick testing.
-
-.. code:: bash
-
-    export PX_QUANT_SIZE=8
-
-Lastly, we store the compiled output from the TVM compiler on disk for
-running the model on the target device. This happens as follows for
-cloud DPU's (Alveo, VCK5000):
-
-.. code:: python
-
-   lib_path = "deploy_lib.so"
-   lib.export_library(lib_path)
-
-
-For edge targets (Zynq, VCK190) we have to rebuild for aarch64. To do this
-we first have to normally export the module to also serialize the Vitis AI
-runtime module (vitis_ai.rtmod). We will load this runtime module again
-afterwards to rebuild and export for aarch64.
-
-.. code:: python
-
-    temp = utils.tempdir()
-    lib.export_library(temp.relpath("tvm_lib.so"))
-
-    # Build and export lib for aarch64 target
-    tvm_target = tvm.target.arm_cpu('ultra96')
-    lib_kwargs = {
-       'fcompile': contrib.cc.create_shared,
-       'cc': "/usr/aarch64-linux-gnu/bin/ld"
-    }
-
-    build_options = {
-        'load_runtime_module': export_rt_mod_file
-    }
-    with tvm.transform.PassContext(opt_level=3, config={'relay.ext.vitis_ai.options': build_options}):
-         lib_edge = relay.build(mod, tvm_target, params=params)
-
-    lib_edge.export_library('deploy_lib_edge.so', **lib_kwargs)
-
-
-This concludes the tutorial to compile a model using TVM with Vitis AI.
-For instructions on how to run a compiled model please refer to the next section.
-
-Inference
----------
-
-The TVM with Vitis AI flow contains two stages: Compilation and Inference.
-During the compilation a user can choose to compile a model for any of the
-target devices that are currently supported. Once a model is compiled, the
-generated files can be used to run the model on a target device during the
-Inference stage.
-
-Check out the `Running on Alveo and VCK5000 <#running-on-alveo-and-vck5000>`__
-and `Running on Zynq and VCK190 <#running-on-zynq-and-vck190>`__ sections for
-doing inference on cloud accelerator cards respectively edge boards.
-
-Running on Alveo and VCK5000
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-After having followed the steps in the `Compiling a Model <#compiling-a-model>`__
-section, you can continue running on new inputs inside the docker for accelerated
-inference:
-
-.. code:: python
-
-    module.set_input(input_name, inputs[i])
-    module.run()
-
-Alternatively, you can load the exported runtime module (the deploy_lib.so
-exported in  `Compiling a Model <#compiling-a-model>`__):
-
-.. code:: python
-
-   import pyxir
-   import tvm
-   from tvm.contrib import graph_executor
-
-   dev = tvm.cpu()
-
-   # input_name = ...
-   # input_data = ...
-
-   # load the module into memory
-   lib = tvm.runtime.load_module("deploy_lib.so")
-
-   module = graph_executor.GraphModule(lib["default"](dev))
-   module.set_input(input_name, input_data)
-   module.run()
-
-Running on Zynq and VCK190
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Before proceeding, please follow the  `Zynq <#zynq-setup>`__ or
-`Versal VCK190 <#versal-vck190-setup>`__ setup instructions.
-
-Prior to running a model on the board, you need to compile the model for
-your target evaluation board and transfer the compiled model on to the board.
-Please refer to the `Compiling a Model <#compiling-a-model>`__ section for
-information on how to compile a model.
-
-Afterwards, you will have to transfer the compiled model (deploy_lib_edge.so)
-to the evaluation board. Then, on the board you can use the typical
-"load_module" and "module.run" APIs to execute. For this, please make sure to
-run the script as root (execute ``su`` in terminal to log into root).
-
-.. note::
-
-    Note also that you **shouldn't** import the
-    PyXIR DPU targets in the run script (``import pyxir.contrib.target.DPUCZDX8G``).
-
-.. code:: python
-
-   import pyxir
-   import tvm
-   from tvm.contrib import graph_executor
-
-   dev = tvm.cpu()
-
-   # input_name = ...
-   # input_data = ...
-
-   # load the module into memory
-   lib = tvm.runtime.load_module("deploy_lib_edge.so")
-
-   module = graph_executor.GraphModule(lib["default"](dev))
-   module.set_input(input_name, input_data)
-   module.run()
diff --git a/docs/how_to/legacy_index.rst b/docs/how_to/legacy_index.rst
deleted file mode 100644
index 91ed4639db..0000000000
--- a/docs/how_to/legacy_index.rst
+++ /dev/null
@@ -1,36 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-How To Guides
-=============
-
-These user-focused "how to" guides are designed to help you find answers to
-specific questions, like "How do I compile a model?" or "How to I optimize a
-schedule with tesor expressions?"
-
-.. toctree::
-   :maxdepth: 1
-
-   compile_models/index
-   deploy/index
-   work_with_relay/index
-   work_with_schedules/index
-   optimize_operators/index
-   tune_with_autotvm/index
-   tune_with_autoscheduler/index
-   extend_tvm/index
-   profile/index
diff --git a/docs/how_to/profile/index.rst b/docs/how_to/profile/index.rst
deleted file mode 100644
index 33642cf469..0000000000
--- a/docs/how_to/profile/index.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-Profile Models
-==============
-
-.. toctree::
-   :maxdepth: 1
-
-   papi
diff --git a/docs/how_to/profile/papi.rst b/docs/how_to/profile/papi.rst
deleted file mode 100644
index 91599c9a7c..0000000000
--- a/docs/how_to/profile/papi.rst
+++ /dev/null
@@ -1,121 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-
-Getting Started With PAPI
-=========================
-
-The Performance Application Programming Interface (PAPI) is a library that
-provides performance counters on a variety of platforms. Performance counters
-provide accurate low-level information about processors behavior during a given
-execution run. This information can contain simple metrics like total cycle
-count, cache misses, and instructions executed as well as more high level
-information like total FLOPS and warp occupancy. PAPI makes these metrics
-available while profiling.
-
-Installing PAPI
----------------
-
-PAPI can either be installed using your package manager (``apt-get install libpapi-dev``
-on Ubuntu), or from source here:
-https://github.com/icl-utk-edu/papi.
-
-Pulling the latest version of PAPI from source has caused build issues before. Therefore, it is recommended to checkout tagged version ``papi-6-0-0-1-t``.
-
-Building TVM With PAPI
-----------------------
-
-To include PAPI in your build of TVM, set the following line in you ``config.cmake``:
-
-.. code::
-
-   set(USE_PAPI ON)
-
-If PAPI is installed in a non-standard place, you can specify where it is like so:
-
-.. code::
-
-   set(USE_PAPI path/to/papi.pc)
-
-
-Using PAPI While Profiling
---------------------------
-
-If TVM has been built with PAPI (see above), then you can pass a
-:py:class:`tvm.runtime.profiling.PAPIMetricCollector` to
-:py:meth:`tvm.runtime.GraphModule.profile` to collect performance metrics. Here
-is an example:
-
-.. code:: python
-
-    import tvm
-    from tvm import relay
-    from tvm.relay.testing import mlp
-    from tvm.runtime import profiler_vm
-    import numpy as np
-
-    target = "llvm"
-    dev = tvm.cpu()
-    mod, params = mlp.get_workload(1)
-
-    exe = relay.vm.compile(mod, target, params=params)
-    vm = profiler_vm.VirtualMachineProfiler(exe, dev)
-
-    data = tvm.nd.array(np.random.rand(1, 1, 28, 28).astype("float32"), device=dev)
-    report = vm.profile(
-        data,
-        func_name="main",
-        collectors=[tvm.runtime.profiling.PAPIMetricCollector()],
-    )
-    print(report)
-
-.. code::
-
-   Name                                    perf::CACHE-MISSES   perf::CYCLES  perf::STALLED-CYCLES-BACKEND  perf::INSTRUCTIONS  perf::STALLED-CYCLES-FRONTEND
-   fused_nn_dense_nn_bias_add_nn_relu                   2,494      1,570,698                        85,608             675,564                         39,583
-   fused_nn_dense_nn_bias_add_nn_relu_1                 1,149        655,101                        13,278             202,297                         21,380
-   fused_nn_dense_nn_bias_add                             288        600,184                         8,321             163,446                         19,513
-   fused_nn_batch_flatten                                 301        587,049                         4,636             158,636                         18,565
-   fused_nn_softmax                                       154        575,143                         8,018             160,738                         18,995
-   ----------
-   Sum                                                  4,386      3,988,175                       119,861           1,360,681                        118,036
-   Total                                               10,644      8,327,360                       179,310           2,660,569                        270,044
-
-You can also change which metrics are collected:
-
-.. code:: python
-
-    report = vm.profile(
-        data,
-        func_name="main",
-        collectors=[tvm.runtime.profiling.PAPIMetricCollector({dev: ["PAPI_FP_OPS"]})],
-    )
-
-.. code::
-
-   Name                                  PAPI_FP_OPS
-   fused_nn_dense_nn_bias_add_nn_relu        200,832
-   fused_nn_dense_nn_bias_add_nn_relu_1       16,448
-   fused_nn_dense_nn_bias_add                  1,548
-   fused_nn_softmax                              160
-   fused_nn_batch_flatten                          0
-   ----------
-   Sum                                       218,988
-   Total                                     218,988
-
-You can find a list of available metrics by running the ``papi_avail`` and
-``papi_native_avail`` commands.
diff --git a/docs/index.rst b/docs/index.rst
index 2eccb60caa..05ca8c952b 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -65,16 +65,6 @@ driving its costs down.
    reference/api/python/index
    reference/api/links
 
-.. toctree::
-   :maxdepth: 1
-   :caption: Legacy
-
-   tutorial/index
-   how_to/legacy_index
-   dev/tutorial/index
-   dev/how_to/how_to.rst
-   reference/langref/index
-
 .. toctree::
    :maxdepth: 1
    :caption: About
diff --git a/docs/install/index.rst b/docs/install/index.rst
index 6bc2da97e1..b09ddb35dd 100644
--- a/docs/install/index.rst
+++ b/docs/install/index.rst
@@ -29,8 +29,7 @@ Installing TVM
 Visit the :ref:`install TVM from source <install-from-source>` page to install TVM from the source code. Installing
 from source gives you the maximum flexibility to configure the build effectively from the official source releases.
 If you are interested in deploying to mobile or embedded devices, you do not need to
-install the entire TVM stack on your device. Instead, you only need the runtime and can install using the
-:ref:`deployment and integration guide <deploy-and-integration>`.
+install the entire TVM stack on your device. Instead, you only need the runtime.
 
 If you would like to quickly try out TVM or run some demo and tutorials, you
 can :ref:`install from Docker <docker-images>`. You can also use TVM locally through ``pip``.
diff --git a/docs/reference/api/python/contrib.rst b/docs/reference/api/python/contrib.rst
index 26b5abb97f..0eb3024c2d 100644
--- a/docs/reference/api/python/contrib.rst
+++ b/docs/reference/api/python/contrib.rst
@@ -93,18 +93,6 @@ tvm.contrib.random
     :members:
 
 
-tvm.contrib.relay_viz
-~~~~~~~~~~~~~~~~~~~~~
-.. automodule:: tvm.contrib.relay_viz
-    :members:
-.. automodule:: tvm.contrib.relay_viz.dot
-    :members:
-.. automodule:: tvm.contrib.relay_viz.terminal
-    :members:
-.. automodule:: tvm.contrib.relay_viz.interface
-    :members:
-
-
 tvm.contrib.rocblas
 ~~~~~~~~~~~~~~~~~~~
 .. automodule:: tvm.contrib.rocblas
diff --git a/docs/reference/langref/hybrid_script.rst b/docs/reference/langref/hybrid_script.rst
deleted file mode 100644
index eeed07a038..0000000000
--- a/docs/reference/langref/hybrid_script.rst
+++ /dev/null
@@ -1,237 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-.. _hybrid-langref-label:
-
-Hybrid Frontend Language Reference
-==================================
-
-Overview
---------
-
-This hybrid frontend allows users to write preliminary versions of some idioms that yet have
-been supported by TVM officially.
-
-Features
---------
-
-Software Emulation
-~~~~~~~~~~~~~~~~~~
-
-Both software emulation and compilation are supported. To define a function,
-you need to use ``tvm.te.hybrid.script`` decorator to indicate this is a hybrid function:
-
-.. code-block:: python
-
-    @tvm.te.hybrid.script
-    def outer_product(a, b):
-        c = output_tensor((100, 99), 'float32')
-        for i in range(a.shape[0]):
-            for j in range(b.shape[0]):
-                c[i, j] = a[i] * b[j]
-        return c
-    a = numpy.random.randn(100)
-    b = numpy.random.randn(99)
-    c = outer_product(a, b)
-
-
-This decorator will import `Keywords`_ required spontaneously when software emulation.
-After software emulation is done, the imported keywords will be cleaned up. Users do not need
-worry about keyword conflict and pollution.
-
-Every element passed for software emulation in the argument list is either a python variable
-or ``numpy`` numeric type.
-
-Backend Compilation
-~~~~~~~~~~~~~~~~~~~
-
-This function is not encouraged to use, users are encouraged to use the second interface.
-The current parse interface looks like:
-
-.. code-block:: python
-
-   a = tvm.te.placeholder((100, ), name='a')
-   b = tvm.te.placeholder((99, ), name='b')
-   parser = tvm.hybrid.parse(outer_product, [a, b]) # return the parser of this function
-
-
-If we pass these tvm data structures, like ``Tensor``, ``Var``, ``Expr.*Imm``,
-or ``tvm.container.Array``, to this function, it returns a op node:
-
-.. code-block:: python
-
-   a = tvm.te.placeholder((100, ), name='a')
-   b = tvm.te.placeholder((99, ), name='b')
-   c = outer_product(a, b) # return the output tensor(s) of the operator
-
-You can use any methods that can be applied on a TVM ``OpNode``, like create_schedule, although
-so far, the functionality of schedule is as limited as ``ExternOpNode``. At least, it can be built
-to LLVM module.
-
-Tuning
-~~~~~~
-
-Follow up the example above, you can use some tvm like interfaces to tune the code:
-
-.. code-block:: python
-
-   i, j = c.op.axis
-   sch = te.create_schedule(op)
-   jo, ji = sch.split(j, 4)
-   sch.vectorize(ji)
-
-For now, you can use loop annotations (``unroll``, ``parallel``, ``vectorize``, and ``bind``),
-loop manipulation (``split`` and ``fuse``), and ``reorder``.
-
-.. note::
-
-        This is a preliminary function, so users should be in charge of the correctness
-        of the functionality after tuning. Specifically, users should be careful when
-        fusing and reorderding imperfect loops.
-
-Loops
-~~~~~
-
-In HalideIR, loops have in total 4 types: ``serial``, ``unrolled``, ``parallel``, and ``vectorized``.
-
-Here we use ``range`` aka ``serial``, ``unroll``, ``parallel``, and ``vectorize``,
-these **4** keywords to annotate the corresponding types of for loops.
-The usage is roughly the same as Python standard ``range``.
-
-Besides all the loop types supported in Halide, ``const_range`` is supported for some specific conditions.
-Sometimes, ``tvm.container.Array`` is desired to pass as an argument, but in TVM-HalideIR, there is no
-such support that converts ``tvm.container.Array`` to an ``Expr``. Thus, a limited feature is supported.
-Users can access containers by either constants or constants loops annotated.
-
-.. code-block:: python
-
-   @tvm.te.hybrid.script
-   def foo(a, b): # b is a tvm.container.Array
-       c = output_tensor(a.shape, a.dtype)
-       for i in const_range(len(a)): # because you have b access, i should be explicitly annotated as const_range
-           c[i] = a[i] + b[i]
-       return c
-
-
-Variables
-~~~~~~~~~
-
-All the mutable variables will be lowered to an array with size 1.
-It regards the first store of a variable as its declaration.
-
-.. note::
-
-        Unlike conventional Python, in hybrid script, the declared variable
-        can only be used in the scope level it is declared.
-
-
-.. note::
-
-        Currently, you can ONLY use basic-typed variables, i.e. the type of the
-        variable should be either ``float32``, or ``int32``.
-
-.. code-block:: python
-
-   for i in range(5):
-       s = 0 # declaration, this s will be a 1-array in lowered IR
-       for j in range(5):
-         s += a[i, j] # do something with s
-       b[i] = s # you can still use s in this level
-   a[0] = s # you CANNOT use s here, even though it is allowed in conventional Python
-
-
-Attributes
-~~~~~~~~~~
-
-So far, ONLY tensors' ``shape`` and ``dtype`` attribute are supported!
-The ``shape`` attribute is essentially a tuple, so you MUST access it as an array.
-Currently, only constant-indexed access is supported.
-
-.. code-block:: python
-
-   x = a.shape[2] # OK!
-   for i in range(3):
-      for j in a.shape[i]: # BAD! i is not a constant!
-          # do something
-
-
-Conditional Statement and Expression
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. code-block:: python
-
-   if condition1 and condition2 and condition3:
-       # do something
-   else:
-       # do something else
-   # Select
-   a = b if condition else c
-
-However, NO ``True`` and ``False`` keyword supported yet.
-
-
-Math Intrinsics
-~~~~~~~~~~~~~~~
-
-So far, these math intrinsics, ``log``, ``exp``, ``sigmoid``,
-``tanh``, ``power``, and ``popcount``, are supported.
-No import is required, just as it is mentioned in `Software Emulation`_, just use it!
-
-Array Allocation
-~~~~~~~~~~~~~~~~
-
-**Under construction, this function will be supported later!**
-
-Use a function call ``allocation(shape, type, share/local)`` to declare an array buffer.
-The basic usage is roughly the same as a normal ``numpy.array``, and you should access
-high-dim array in ``a[i, j, k]`` fashion instead of ``a[i][j][k]``,
-even for ``tvm.container.Array`` for compilation.
-
-
-Thread Bind
-~~~~~~~~~~~
-
-
-You can also do loop-thread bind by writing code like this:
-
-.. code-block:: python
-
-   for tx in bind("threadIdx.x", 100):
-       a[tx] = b[tx]
-
-
-Assert Statement
-~~~~~~~~~~~~~~~~
-
-Assert statement is supported, you can simply use it as it is in standard Python.
-
-.. code-block:: python
-
-    assert cond, mesg
-
-.. note::
-
-        ``Assert`` is NOT a function call. Users are encouraged to use assert in the way
-        presented above --- condition followed by message. It fits both Python AST and HalideIR.
-
-Keywords
-~~~~~~~~
-- For keywords: ``serial``, ``range``, ``unroll``, ``parallel``, ``vectorize``, ``bind``, ``const_range``
-- Math keywords: ``log``, ``exp``, ``sqrt``, ``rsqrt``, ``sigmoid``, ``tanh``, ``power``, ``popcount``, ``round``, ``ceil_div``
-- Allocate keywords: ``allocate``, ``output_tensor``
-- Data type keywords: ``uint8``, ``uint16``, ``uint32``, ``uint64``, ``int8``, ``int16``, ``int32``, ``int64``, ``float16``, ``float32``, ``float64``
-- Others: ``max_num_threads``
diff --git a/docs/reference/langref/index.rst b/docs/reference/langref/index.rst
deleted file mode 100644
index dcea9fa50c..0000000000
--- a/docs/reference/langref/index.rst
+++ /dev/null
@@ -1,61 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-Language Reference
-==================
-This document provides references to
-embedded languages and IRs in the TVM stack.
-
-Introduction to Relay
----------------------
-
-Relay is a functional, differentiable programming language
-designed to be an expressive intermediate representation for machine
-learning systems. Relay supports algebraic data types, closures,
-control flow, and recursion, allowing it to directly represent more
-complex models than computation graph-based IRs can.
-Relay also includes a form of dependent typing using *type relations*
-in order to handle shape analysis for operators with complex
-requirements on argument shapes.
-
-Relay is extensible by design and makes it easy for machine learning
-researchers and practitioners to develop new large-scale program
-transformations and optimizations.
-
-The below pages describe the grammar, type system,
-algebraic data types, and operators in Relay, respectively.
-
-.. toctree::
-   :maxdepth: 2
-
-   relay_expr
-   relay_type
-   relay_adt
-   relay_op
-   relay_pattern
-
-Hybrid Script
--------------
-
-The below page describes the TVM hybrid script front-end,
-which uses software emulation to support some constructs not
-officially supported in TVM.
-
-.. toctree::
-   :maxdepth: 2
-
-   hybrid_script
diff --git a/docs/reference/langref/relay_adt.rst b/docs/reference/langref/relay_adt.rst
deleted file mode 100644
index dab2e3e706..0000000000
--- a/docs/reference/langref/relay_adt.rst
+++ /dev/null
@@ -1,533 +0,0 @@
-
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-.. _adt-overview:
-
-=============================
-Algebraic Data Types in Relay
-=============================
-
-Algebraic data types (ADTs) are a staple feature of functional programming languages,
-particularly those derived from ML, because they express data structures in a
-manner that is easy to reason about when writing recursive computations.
-Because recursion is intended to be one of the primary mechanisms of control
-flow in Relay, it is important that Relay include ADTs in order to best express
-loops and other control flow structures that must be implemented using recursion.
-
-Defining and Matching on an ADT
-===============================
-
-*Note: ADTs are not presently supported in the text format. The syntax here is speculative, based on ADTs in other languages.*
-
-ADTs can be understood as a generalized version of :code:`enum` and :code:`struct` types
-from C-like languages. Like a C :code:`struct:`, an ADT instance is a container for fields
-of specified types, but the type system allows for the same type to encode different possible
-groupings of fields in a systematic manner, similar to C :code:`enum` types, which are
-defined using a finite set of possible values named by the user.
-
-Specifically, an ADT is defined as a named group of constructors, each of which is
-a function that takes values of specified types as arguments and returns an instance
-of the named ADT. An ADT instance simply contains the values of the arguments
-passed to the constructor call used to produce it.
-
-An ADT value is opaque until it is *deconstructed*, allowing the arguments to the
-constructor to be accessed again and used to compute new values. Because
-a particular ADT can have multiple constructors with different signatures,
-it is usually necessary to branch on the different possible constructors,
-resulting in the *match* syntax for ADTs. Hence, ADTs are sometimes called
-"tagged unions" because an ADT instance is tagged by the name of the constructor
-used to produce it and can later be inspected based on the tag.
-
-Because each ADT has a finite set of constructors, it is straightforward to determine
-whether a function processing an ADT instance is handling all possible cases.
-In particular, the type system can ensure that types are properly assigned in all cases when
-deconstructing an ADT instance, in contrast to :code:`union` types in C.
-Hence, it is often easy to reason about ADTs.
-
-*Implementation detail: Relay ADT definitions are global and are stored in the module, similarly to global function definitions. An ADT name is, in fact, a global type variable (just as a global function name is a global variable). The module keeps a mapping of ADT names (global type variables) to the list of constructors for that ADT.*
-
-Below is a simple example of defining an ADT and using it in a function
-via a match expression:
-
-.. code-block::
-
-   # Defines an ADT named "Numbers"
-   data Numbers {
-     Empty : () -> Numbers
-     Single : (Tensor[(), int32]) -> Numbers
-     Pair : (Tensor[(), int32], Tensor[(), int32]) -> Numbers
-   }
-   # A Numbers value can be produced using an Empty, Single, or Pair
-   # constructor, each with a signature given above
-
-   def @sum(%n : Numbers[]) -> Tensor[(), int32] {
-      # The match expression branches on the constructor that was
-      # used to produce %n. The variables in each case are bound
-      # if the constructor matches that used for %n
-      match(%n) {
-        case Empty() { 0 }
-        case Single(x) { x }
-        case Pair(x, y) { x + y }
-      }
-   }
-
-   @sum(Empty())    # evaluates to 0
-   @sum(Single(3))  # evaluates to 3
-   @sum(Pair(5, 6)) # evaluates to 11
-
-Note that ADTs are identified by name,
-meaning that two ADTs with structurally identical constructors
-will nevertheless be distinct data types from the point of view of
-the typechecker.
-
-.. code-block::
-
-   # structurally identical constructors to Numbers
-   data Numbers2 {
-     Empty2 : () -> Numbers2
-     Single2 : (Tensor[(), int32]) -> Numbers2
-     Pair2 : (Tensor[(), int32], Tensor[(), int32]) -> Numbers2
-   }
-
-   # the below results in a type error because Numbers2
-   # is a distinct type from Numbers
-   # fn() { @sum(Empty2()) }
-
-Type-Checking ADTs and Polymorphism
-===================================
-
-This section will go into more specific detail about the typing of ADTs.
-Most of the complexity involved results from the fact that, as with functions, ADTs
-can be polymorphic and take type parameters.
-
-For example, one of the standard ADTs commonly used in functional
-programming languages is the optional type, defined here:
-
-.. code-block::
-
-   # a is a type parameter
-   data Optional<a> {
-     None : () -> Optional
-     Some : (a) -> Optional
-   }
-
-Optional types are commonly used as the return type for any operation
-involving querying into a data structure (returning :code:`Some(v)`
-if a value is found and :code:`None` if it isn't).
-Taking a type parameter in the definition allows the same optional type
-to be used in a wide variety of situations, rather than having to
-define a unique ADT for each different type that could be contained in it.
-
-However, it is important to ensure that option types whose contents
-are of different types can still be distinguished by the type system,
-since it would violate type safety if a function expecting an option
-containing a :code:`Tensor[(), int32]` instead receives an option
-containing a :code:`Tensor[(3, 4), float32]`. As this example may
-imply, an ADT instance is thus given a type that contains the
-concrete type arguments for that instance, ensuring the information is
-kept around. Let the below example illustrate:
-
-.. code-block::
-
-   # the signature for option indicates the type argument
-   def @inc_scalar(%opt : Optional[Tensor[(), int32]]) -> Tensor[(), int32] {
-     match(%opt) {
-       case None() { 1 }
-       case Some(%s) { %s + 1 }
-     }
-   }
-
-   def @main() {
-     let %one : Optional[Tensor[(), int32]] = Some(1);
-     let %big : Optional[Tensor[(10, 10), float32]]
-       = Some(Constant(1, (10, 10), float32));
-     let %two = inc_scalar(%one);
-     # let %bigger = inc_scalar(%big); # type system rejects
-     # None does not take an argument so it can always implicitly
-     # be given the correct type arguments
-     let %z = inc_scalar(None());
-     ()
-   }
-
-The syntax for the annotated type arguments
-(e.g., :code:`Optional[Tensor[(), int32]]`) in the above examples is
-called a "type call," treating the polymorphic ADT definition as a
-type-level function (taking type params and returning a type, namely
-the ADT). Any ADT appearing in a type annotation or function signature
-must be annotated with type arguments (a non-polymorphic ADT must be
-in a type call with no arguments).
-
-Thus, we can say in general that if constructor :code:`C` that
-takes arguments of types :code:`T1, ..., Tn` is a constructor
-for an ADT :code:`D` that takes type parameters :code:`v1, ..., vn`
-(where :code:`T1, ..., Tn` may contain any of the :code:`v1, ..., vn`),
-then :code:`C` has
-the type :code:`fun<v1, ..., vn>(T1, ..., Tn) -> D[v1, ..., vn]`.
-This means that constructors are typed like ordinary functions and
-thus appear inside call nodes and can be passed to or returned by
-other functions. In particular, the :code:`Some` example above has
-the signature :code:`fun<a>(a) -> Optional[a]`, while :code:`None`
-has the signature :code:`fun<a>() -> Optional[a]`.
-
-Recursion with ADTs
-===================
-
-ADT definitions are allowed to be recursive, that is, a definition for
-an ADT named :code:`D` can assume the existence of type :code:`D` and
-use it as an argument to constructors. Recursion allows ADTs to
-represent complex structures such as lists or trees; it is the source
-of much of ADTs' power in functional programming, since an appropriately
-designed data structure could make it easy to concisely express a
-computation with a recursive function.
-
-Many commonly used ADTs involve recursion; some of these are given
-in `Common ADT Uses`_. As an example here, we will
-examine the list ADT, ubiquitous in functional languages:
-
-.. code-block::
-
-   data List<a> {
-      Nil : () -> List
-      Cons : (a, List[a]) -> List
-   }
-
-(Notice that the recursive reference to :code:`List` is wrapped
-in a type call even in the constructor.)
-
-The above definition means that a list of values of a particular type
-can be represented by nesting :code:`Cons` constructors until the
-end of the list is reached, which can be indicated with a :code:`Nil`
-(representing an empty list).
-
-Lists represented in this manner can easily be recursively processed.
-For example, the following function sums a list of integers:
-
-.. code-block::
-
-   def @list_sum(%l : List[Tensor[(), int32]]) -> Tensor[(), int32] {
-     match(%l) {
-       case Nil() { 0 }
-       # add the head of the list to the sum of the tail
-       case Cons(%h, %t) { %h + @list_sum(%t) }
-     }
-   }
-
-As it happens, many recursive functions on lists like the one just given
-share structures that can be factored out into generic, easily
-usable functions that will be discussed under `Common ADT Uses`_.
-
-.. _adt-pattern:
-
-Pattern Matching in Match Expressions
-=====================================
-
-Match expressions in Relay, as in other functional languages, are capable of
-more versatile pattern matching than simply having one case for each constructor
-for the datatype of the value being deconstructed.
-
-In particular, the patterns in match cases can be built up recursively:
-
-- Constructor patterns match for a particular ADT constructor. If a value matches the constructor, each argument to the constructor will be matched against a nested pattern.
-- Wildcard patterns will match any value and will not bind to a variable.
-- Variable patterns will match any value and bind it to a local variable, scoped to the match clause.
-
-In the simple case of :code:`@list_sum` above, the first match case has a :code:`Nil` constructor pattern (with no nested arguments)
-and the second has a :code:`Cons` constructor pattern that uses variable patterns for each of the arguments to :code:`Cons`.
-
-The below example uses a wildcard pattern to ignore one of the arguments to :code:`Cons`:
-
-.. code-block::
-
-   def @first<a>(%l : List[a]) -> Optional[a] {
-     match(%l) {
-       case Nil() { None() }
-       case Cons(%h, _) { Some(%h) } # list tail is unused and ignored
-     }
-   }
-
-Here, a constructor pattern is nested inside another constructor pattern to avoid nested match expressions for a list option.
-A top-level wildcard pattern is also used to handle all cases that do not match the first clause:
-
-.. code-block::
-
-   def @second_opt<a>(%ll : Optional[List[a]]) -> Optional[a] {
-     match(%ll) {
-       # we only need the second member of the list if there is one
-       case Some(Cons(_, Cons(%s, _))) { Some(%s) }
-       case _ { None() }
-     }
-   }
-
-   # @second_opt(Some(Cons(1, Nil()))) evaluates to None()
-   # @second_opt(Some(Cons(1, Cons(2, Nil())))) evaluates to Some(2)
-   # @second_opt(Some(Nil())) evaluates to None()
-   # @second_opt(None()) evaluates to None()
-
-Note that a match expression checks its patterns in the order the cases are listed: the first clause whose pattern
-that matches the input value is the one that is evaluated. Here, a top-level variable pattern binds the whole
-input value:
-
-.. code-block::
-
-   def @match_order_beware<a>(%l : List[a]) -> List[a] {
-     match(%l) {
-       case %v { %v }
-       # the above matches everything so neither of these runs
-       case Cons(%h, %t) { Cons(%h, @match_order_beware(%t)) }
-       case Nil() { Nil() }
-     }
-   }
-
-Common ADT Uses
-===============
-
-In functional programming languages, certain ADTs provide useful facilities for writing common programs.
-Parametric polymorphism and higher-order functions allow these ADTs to be easily reuseable and for generic
-functions to manipulate them in common situations. Relay includes a "Prelude" of certain pre-defined ADTs
-and functions for them that correspond to the indispensable ADTs of other languages.
-
-The option type defined under `Type-Checking ADTs and Polymorphism`_ is one such ADT, used
-whenever it can make sense for a function to only return a value under certain circumstances. Having
-the option type allows for the type system to keep track of which functions always return a value
-of a certain type versus returning an option of that type, ensuring that any options are always
-explicitly checked (contrast with returning null pointers or throwing
-exceptions as other ways to addressing that problem).
-
-Lists (defined in `Recursion with ADTs`_) can be manipulated by generic functions in a manner similar to
-list comprehensions and certain library functions in Python. Below are very common functions for iterating
-through lists, which are included in Relay's Prelude. (These have all been extensively characterized
-in the functional programming literature, and we do not attempt to reproduce that work in this document.)
-
-.. code-block::
-
-   # Map: for [h1, h2, ..., hn] returns [f(h1), f(h2), ..., f(hn)]
-   def @map<a, b>(%f : fn(a) -> b, %l : List[a]) -> List[b] {
-     match(%l) {
-       case Nil() { Nil() }
-       case Cons(%h, %t) { Cons(%f(%h), @map(%f, %t)) }
-     }
-   }
-
-   # Left fold: for [h1, h2, ..., hn] returns f(...(f(f(z, h1), h2)...), hn)
-   def @foldl<a, b>(%f : fn(b, a) -> b, %z : b, %l : List[a]) -> b {
-     match(%l) {
-       case Nil() { %z }
-       case Cons(%h, %t) { @foldl(%f, %f(%z, %h), %t) }
-     }
-   }
-
-   # Right fold: for [h1, h2, ..., hn] returns f(h1, f(h2, f(..., (f(hn, z)...)
-   def @foldr<a, b>(%f : fn(a, b) -> b, %z : b, %l : List[a] -> b {
-     match(%l) {
-       case Nil() { %z }
-       case Cons(%h, %t) { %f(%h, @foldr(%f, %z, %t)) }
-     }
-   }
-
-Using these iteration constructs, many common operations over lists can be expressed compactly.
-For example, the following map doubles all members of a list:
-
-.. code-block::
-
-   # directly written
-   def @double(%l : List[Tensor[(), int32]]) -> List[Tensor[(), int32]] {
-     match(%l) {
-       case Nil() { Nil() }
-       case Cons(%h, %t) { Cons(%h * 2, @double(%t)) }
-     }
-   }
-
-   # map takes care of the recursion
-   @map(fn(%i) { %i * 2 }, %l)
-
-The following right fold concatenates two lists:
-
-.. code-block::
-
-   # directly written
-   def @concat<a>(%l1 : List[a], %l2 : List[a]) -> List[a] {
-     match(%l1) {
-       case Nil() { %l2 }
-       case Cons(%h, %t) { Cons(%h, @concat(%t, %l2) }
-     }
-   }
-
-   # foldr takes care of the recursion
-   @foldr(fn(%h, %z) { Cons(%h, %z) }, %l2, %l1)
-
-The following left fold flattens a list of lists (using concatenation):
-
-.. code-block::
-
-  # directly written
-  def @flatten<a>(%ll : List[List[a]]) -> List[a] {
-    match(%ll) {
-      case Cons(%h, %t) { @concat(%h, @flatten(%t)) }
-      case Nil() { Nil() }
-    }
-
-  # foldl takes care of the recursion
-  @foldl(@concat, Nil(), %ll)
-
-Note that these iteration constructs can be implemented directly in Relay's
-source language and more can easily be defined (and for more data types, like trees),
-rather than being constructs built into the language (e.g.,
-`"foreach" in MXNet <https://mxnet.apache.org/versions/master/tutorials/control_flow/ControlFlowTutorial.html>`__).
-ADTs and their extensibility allow for a broad range of iterations and data structures to be expressed
-in Relay and supported by the type system without having to modify the language implementation.
-
-Implementing Neural Nets Using ADTs
-===================================
-
-In `this 2015 blog post <http://colah.github.io/posts/2015-09-NN-Types-FP/>`__, Christopher Olah notes that
-many neural networks can be easily expressed using common functional programming constructs. Relay's ADTs
-allow those examples to be implemented directly in TVM.
-
-First let us suppose that we have a function corresponding to a trained recurrent neural net (RNN)
-cell, which takes in a past state and an input value and returns a new state and output value. In
-Relay, this would have the following signature:
-
-.. code-block::
-
-   @cell : fn<state_type, in_type, out_type>(state_type, in_type) -> (state_type, out_type)
-
-We might consider a ReLU cell as a simple concrete example, with a trained version below:
-
-.. code-block::
-
-  def @linear(%x, %w, %b) { %w*%x + %b }
-
-  def @relu_cell(%w, # weights
-                 %b, # offsets
-                 %s, # state
-                 %x  # input
-  ) {
-    let %x2 = @linear(%x, %w.0, %b.0);
-    let %s2 = @linear(%s, %w.1, %b.1);
-    # doesn't change the state
-    (%s, nn.relu(%x2 + %s2))
-  }
-
-  # this is a higher-order function because it returns a closure
-  def @trained_cell(%w, %b) {
-    fn(%x, %h) { @relu_cell(%w, %b, %x, %h) }
-  }
-
-Following Olah's example, we can encode a sequence (list) of inputs with the following left fold:
-
-.. code-block::
-
-   def @encode<state_type, in_type, out_type>(%cell, %input : List[in_type], %init : state_type) -> state_type {
-     # not using the output
-     @foldl(fn(%state, %in) { %cell(%state, %in).0 }, %init, %input)
-   }
-
-Using an *unfold* iterator (from Haskell's standard library), the same cell could be used to make
-a generator network (which takes a single input and produces a sequence of outputs):
-
-.. code-block::
-
-   # included in Relay's Prelude
-   def @unfoldr<a, b>(%f : fn(b) -> Optional[(a, b)], %z : b) -> List[a] {
-     match(%f(%z)) {
-       case Some(%pair) { Cons(%pair.0, @unfoldr(%f, %pair.1)) }
-       case None() { Nil() }
-     }
-   }
-
-   # we need some way of generating an input to the cell function given only a state
-   def @gen_func<state_type, in_type, out_type>(%state : state_type) : Optional[(out_type, state_type)] {
-     let %in : Optional[in_type] = @generate_input(%state);
-     match(%in) {
-       case Some(%n) {
-         let %cell_out = @cell(%n, %state);
-         Some((%cell_out.1, %cell_out.0)) # pair of output and state
-       }
-       case None() { None() }
-     }
-   }
-
-   def @generator<state_type, in_type, out_type>(%cell, %init : state_type) -> List[out_type] {
-     @unfoldr(fn(%state) { @gen_func(%cell, %state) }, %init)
-   }
-
-An accumulating map (a fold that simultaneously updates an accumulator value and a list
-of outputs) can be used to write a general RNN (with an output for every input):
-
-.. code-block::
-
-   def @map_accumr<a, b, c>(%f : fn(a, b) -> (a, c), %acc : a, %l : List[b]) -> (a, List[c]) {
-     match(%l) {
-       case Nil() { (%acc, Nil()) }
-       case Cons(%b, %t) {
-         let %update = %f(%acc, %b);
-         let %rest = @map_accumr(%f, %update.0, %t));
-         (%rest.0, Cons(%update.1, %rest.1))
-       }
-     }
-   }
-
-   # can also be implemented as a right fold
-   # (this version is included in Relay's Prelude)
-   def @map_accumr_fold(%f, %acc, %l) {
-     @foldr(fn(%b, %p) {
-       let %f_out = %f(%p.0, %b);
-       (%f_out.0, Cons(%f_out.1, %p.1))
-     },
-     (%acc, Nil()), %l)
-   }
-
-   def @general_rnn<state_type, in_type, out_type>(%cell, %init : state_type, %input : List[in_type])
-     -> (state_type, List[out_type]) {
-     @map_accumr(%cell, %init, %input)
-   }
-
-Olah also gives an example of a bidirectional neural network, in which two sets of
-cells (which may have different weights) process the input in both directions and produce a
-single set of outputs. The following is a Relay implementation of that example:
-
-.. code-block::
-
-   # creates a list of tuples from two lists
-   # included in Relay's Prelude
-   def @zip<a, b>(%l : List[a], %m : List[b]) -> List[(a, b)] {
-     match(%l) {
-       case Nil() { Nil() }
-       case Cons(%a, %t1) {
-         match(%m) {
-           case Nil() { Nil() }
-           case Cons(%b, %t2) { Cons((%a, %b), @zip(%t1, %t2)) }
-         }
-       }
-     }
-   }
-
-   # analogous to map_accumr
-   # included in Relay's Prelude
-   def @map_accmul(%f, %acc, %l) {
-     @foldl(fn(%p, %b){
-       let %f_out = %f(%p.0, %b);
-       (%f_out.0, Cons(%f_out.1, %p.1))
-     }, (%acc, Nil()), %l)
-   }
-
-   def @bidirectional_rnn<state1_type, state2_type, in_type, out1_type, out2_type>
-     (%cell1, %cell2, %state1 : state1_type, %state2 : state2_type, %input : List[in_type])
-     -> List[(out1_type, out2_type)] {
-     @zip(@map_accumr(%cell1, %state1, %input).1, @map_accuml(%cell2, %state2, %input).1)
-   }
diff --git a/docs/reference/langref/relay_expr.rst b/docs/reference/langref/relay_expr.rst
deleted file mode 100644
index c789331efe..0000000000
--- a/docs/reference/langref/relay_expr.rst
+++ /dev/null
@@ -1,691 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-====================
-Expressions in Relay
-====================
-
-The Relay IR is a pure, expression-oriented language. The below sections
-describe the different expressions in Relay and give details of their semantics.
-
-Dataflow and Control Fragments
-==============================
-
-For the purposes of comparing Relay to traditional computational graph-based IRs, it
-can be useful to consider Relay expressions in terms of dataflow and control fragments.
-Each portion of a Relay program containing expressions that only affect the dataflow can
-be viewed as a traditional computation graph when writing and expressing transformations.
-
-The dataflow fragment covers the set of Relay expressions that do not involve
-control flow. That is, any portion of a program containing only the following
-constructs corresponds to a pure computation graph:
-
-- `Variables`_
-- Tuple `Construction`_ and `Projection`_
-- `Let Bindings`_
-- `Graph Bindings`_
-- Calls to `Operators`_ and `ADT Constructors`_
-
-Control flow expressions allow the graph topology to change
-based on the value of previously executed expressions. The control
-fragment in Relay includes the following constructs:
-
-- `If-Then-Else`_ Expressions
-- `ADT Matching`_ Expressions
-- Recursive Calls in Functions
-
-From the point of view of a computation graph, a function is a subgraph and a function call inlines the subgraph, substituting its arguments for the free variables in the subgraph with corresponding names.
-Thus, if a function's body uses only dataflow constructs,
-a call to that function is in the dataflow fragment; conversely, if the
-function's body contains control flow, a call to that function is not part of the dataflow fragment.
-
-Variables
-=========
-
-Inspired by LLVM, Relay explicitly distinguishes between local and
-global variables both in the AST and in the text format. In the text format,
-global and local variables are distinguished by prefixes, or *sigils*.
-Global variables are prefixed with :code:`@` and local variables with :code:`%`.
-
-This explicit distinction makes certain optimizations easier to implement.
-For example, inlining a global definition requires no analysis: simply
-substituting the definition suffices.
-
-Global Variable
-~~~~~~~~~~~~~~~~~~
-
-Global identifiers are prefixed by the :code:`@` sigil, such as ":code:`@global`".
-A global identifier always references a globally visible definition contained in the
-globally visible environment, known as the `module <Module and Global Functions_>`__.
-Global identifiers must be unique.
-
-See :py:class:`~tvm.relay.expr.GlobalVar` for its implementation
-and documentation.
-
-Local Variable
-~~~~~~~~~~~~~~
-
-Local identifiers are prefixed by the :code:`%` sigil,
-such as ":code:`%local`". A local identifier always references
-a function argument or a variable bound in a :code:`let` expression,
-and will be scoped to the function where it appears or the :code:`let`
-expression where it is bound, respectively.
-
-In the below code segment, notice that :code:`%a` is defined twice. This is
-permitted, as in most functional languages; in the scope of the second
-:code:`let` expression, the name :code:`%a` is "shadowed," meaning all
-references to :code:`%a` in the inner scope refer to the later definition, while
-references to :code:`%a` in the outer scope continue to refer to
-the first one.
-
-.. code-block::
-
-    let %a = 1;
-    let %b = 2 * %a;  // %b = 2
-    let %a = %a + %a; // %a = 2. %a is shadowed
-    %a + %b           // has value 2 + 2 = 4
-
-(Note that in Relay's implementation, each definition of a local variable
-creates a new :py:class:`~tvm.relay.expr.Var`, so a shadowed local variable,
-despite having the same name as one in an outer scope, will be a different
-object. This allows for comparing local variables by pointer identity with the
-knowledge that the same local variable object corresponds to a different binding site.)
-
-See :py:class:`~tvm.relay.expr.Var` for its implementation
-and documentation.
-
-Functions
-=========
-
-Functions in Relay act similarly to procedures or functions in
-other programming languages and serve to generalize the concept
-of a named subgraph.
-
-Functions are first class in Relay, which means they are expressions just like variables, constants, and tuples.
-Additionally, functions in Relay are higher-order, which means that a function can be passed as an argument to a
-function or returned by a function, as function expressions evaluate to closures (see the `Closures`_ subsection),
-which are values like tensors and tuples.
-
-See :py:class:`~tvm.relay.function.Function` for the definition and documentation of function nodes.
-
-Syntax
-~~~~~~
-
-A definition minimally consists of the keyword :code:`fn`, an empty set of
-parameters, and a body expression (:py:class:`~tvm.relay.expr.Expr`)
-contained by curly braces.
-
-.. code-block::
-
-    fn() { body }
-
-A definition may contain any number of parameters. For example, a
-simple function that invokes the :code:`add` operator:
-
-.. code-block::
-
-    fn(%x, %y) { add(%x, %y) }
-
-Notice that within the function's body, the parameters are local
-variables, just like those bound in a :code:`let` expression.
-
-One may also annotate explicit types on functions.
-For example, we can restrict the above function to only work
-on certain types:
-
-.. code-block::
-
-    fn(%x : Tensor[(10, 10), float32], %y : Tensor[(10, 10), float32])
-               -> Tensor[(10, 10), float32] {
-        add(%x, %y)
-    }
-
-The above function only takes arguments of type :code:`Tensor[(10, 10), float32]` and returns a value of
-type :code:`Tensor[(10, 10), float32]`. A function parameter is just a local
-variable (:py:class:`~tvm.relay.expr.LocalVar`) optionally annotated with a type, written as :code:`%x : T`.
-
-When the type information is omitted, Relay attempts to infer the most general type
-for the users. This property is known as generalization: for a definition without
-explicit annotations, Relay attempts to assign the most general type to the
-parameters and return type based on the function body and call sites.
-
-A recursive function expression can be defined using a :code:`let` binding,
-as here:
-
-.. code-block::
-
-    let %fact = fn(%x : Tensor[(10, 10), float32]) -> Tensor[(10, 10), float32] {
-        if (%x == Constant(0, (10, 10), float32)) {
-            Constant(1, (10, 10), float32)
-        } else {
-            %x * %fact(%x - Constant(1, (10, 10), float32))
-        }
-    };
-    %fact(Constant(10, (10, 10), float32))
-
-Closures
-~~~~~~~~
-
-A function expression evaluates to a closure. Closures
-are values that are represented as a pair of a local environment
-(storing the values for all variables defined outside the scope
-of the function's body) and the function itself.
-
-For example, in the below example, the final result will be
-a tensor of zero values because the closure for :code:`%f` stores the value of
-:code:`%x` at the pointer where :code:`%f` was defined.
-
-.. code-block::
-
-    let %g = fn() {
-      let %x = Constant(0, (10, 10), float32);
-      // %x is a free variable in the below function
-      fn(%y) { %y * %x }
-    };
-    // the %x in %g's body is not in scope anymore
-    // %f is a closure where %x maps to Constant(0, (10, 10), float32)
-    let %f = %g();
-    let %x = Constant(1, (10, 10), float32);
-    %f(%x) // evaluates to Constant(0, (10, 10), float32)
-
-Polymorphism and Type Relations
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-*Note: type parameter syntax is not yet supported in the text format.*
-
-A function may also be given a set of type parameters, which can be
-substituted for specific types at call sites. Functions with
-type parameters are *type polymorphic*; their return type or the types
-of arguments they will accept can vary based on the type arguments
-given at call sites.
-
-Type parameters are classified by *kind* and can
-only appear in parts of the type signature where their kind is appropriate
-(e.g., type parameters of kind :code:`Shape` can only appear where a shape
-would be expected in a tensor type); for a full discussion,
-see :ref:`the documentation on type parameters <type-parameter>`.
-
-For example, one can define a polymorphic identity function for
-any Relay type as follows:
-
-.. code-block::
-
-    fn<t : Type>(%x : t) -> t {
-        %x
-    }
-
-The below definition is also polymorphic, but restricts its
-arguments to tensor types:
-
-.. code-block::
-
-    fn<s : Shape, bt : BaseType>(%x : Tensor[s, bt]) {
-        %x
-    }
-
-Notice that the return type is omitted and will be inferred.
-
-*Note: "where" syntax is not yet supported in the text format.*
-
-A function may also be subject to one or more type relations, such as in
-the following:
-
-.. code-block::
-
-    fn(%x, %y) where Broadcast { add(%x, %y) }
-
-In the above definition, the types of :code:`%x` and :code:`%y` and the return type
-are subject to the :code:`Broadcast` relation, meaning all three must be tensors
-and their shapes follow the elementwise broadcast relation. As with
-operators, the definitions of relations are not transparent to Relay
-and they are instead implemented externally in either C++ or Python.
-
-As in the case of :code:`Broadcast`, relations are used to express complicated
-constraints on types (especially tensor shapes).
-All function relations must hold at all call sites;
-type checking is thus treated as a constraint-solving problem.
-For more detail on type relations and their implementations,
-please see :ref:`their section in the documentation on Relay's type system <type-relation>`.
-
-Operators
-=========
-
-An operator is a primitive operation, such as :code:`add` or :code:`conv2d`, not defined in the Relay
-language. Operators are declared in the global operator
-registry in C++. Many common operators are backed by TVM's
-Tensor Operator Inventory.
-
-To register an operator a user must provide an implementation
-of the operator, its type, and any other desired metadata.
-The operator registry is a column-based store where
-operators are keys, so any metadata (which might be referenced
-by optimization passes) may be registered as a new column.
-
-From the perspective of Relay's type system, an operator is a function,
-so operators may be called like any other function and have function
-types. In particular, operator types are registered using a single
-type relation (see :ref:`the documentation on type relations <type-relation>`), typically a relation
-specialized to that operator. For example, the :code:`add` operator
-is registered with the :code:`Broadcast` relation, indicating that the
-arguments of :code:`add` must be tensors and that the return type
-is a tensor whose shape depends on those of its arguments.
-
-Operators are rendered without a sigil (e.g :code:`conv2d`, :code:`flatten`)
-when pretty-printing Relay programs.
-Operators are explicitly contained in the program and are uniquely
-identifiable by pointer.
-
-Note that common arithmetic operators such as :code:`add` and :code:`multiply`
-may be written using the corresponding arithmetic operators in the text format
-(e.g., :code:`+` or :code:`*`) as syntactic sugar.
-
-See :py:class:`~tvm.relay.op.Op` for the definition and documentation
-of operator nodes, demonstrating the infrastructure for registering
-operator metadata. The other files in :py:class:`~tvm.relay.op` give
-handles for generating a call to various pre-registered operators.
-The :ref:`tutorial on adding operators to Relay <relay-add-op>` shows how to add further
-operators into the language.
-
-ADT Constructors
-================
-
-Algebraic data types (ADTs) in Relay are described in detail in a
-:ref:`separate overview<adt-overview>` and their integration into
-the type system is described :ref:`here<adt-typing>`.
-
-In this section, we will simply note that ADT constructors are given
-a function type and should be used inside call nodes like a function
-or operator. An ADT constructor is defined by giving the name of
-the ADT it constructs (a global type variable) and the types of the
-expected arguments for the constructor.
-
-If the ADT definition includes type variables, those type variables
-may appear in the constructor. Constructors cannot include any other
-type variables.
-
-Let us suppose that :code:`D` is an ADT that takes type parameters
-:code:`a` and :code:`b`. If :code:`C1` is a constructor for :code:`D`
-and expects two arguments, one of type :code:`a` and one of type :code:`b`, then
-:code:`C1` has the following type signature:
-:code:`fun<a, b>(a, b) -> D[a, b]`. (See either the ADT overview
-or the discussion of ADT typing for an explanation of the type call
-in the return type.)
-If another constructor for :code:`D`, :code:`C2`, takes no arguments,
-then it has the following type signature: :code:`fun<a, b>() -> D[a, b]`;
-the type parameters will always appear in the return type.
-
-Once called, a constructor produces an ADT instance, which is a
-container that stores the values of the arguments to the constructor
-as well as the name ("tag") of the constructor. The tag will be used
-for deconstructing the instances and retrieving the values when
-`ADT Matching`_.
-
-See :py:class:`~tvm.relay.adt.Constructor` for the definition and documentation.
-
-Call
-====
-
-Expressions with function types in Relay are "callable,"
-meaning that they can be invoked via a function call. These consist of
-any expression that evaluates to a closure (i.e., function expressions
-or global functions) and Relay operators.
-
-The syntax of calls follows that used in C-like languages, demonstrated in the
-example below:
-
-.. code-block::
-
-   let %c = 1;
-   let %f = fn(%x : Tensor[(), float32], %y : Tensor[(), float32]) { %x + %y + %c };
-   %f(10, 11)
-
-When a closure is called (see `Closures`_),
-the closure's body is evaluated in the stored environment
-(i.e., using the stored values for free variables) with
-local variable bindings added for each argument; the final value
-obtained by evaluating the body is the call's return value.
-Thus, in the above example, the call evaluates to 22.
-In the case of operators, the implementation is opaque to Relay,
-so the result is left up to the registered TVM implementation.
-
-*Note: type parameters are not yet supported in the text format.*
-
-A type-polymorphic function can also include type arguments at a call
-site. The type arguments are substituted for type parameters when
-type checking. If a function is type-polymorphic and type arguments are not
-given, type inference will attempt to infer type arguments if possible.
-The following code gives examples of explicit and inferred type arguments:
-
-.. code-block::
-
-    // %f : fn<a : Type, b : Type, c : Type>(a, b) -> c
-    let %x1 = %f<Tensor[(), bool], Tensor[(), bool], Tensor[(), bool)]>(True, False);
-    // %x1 is of type Tensor[(), bool]
-    let %x2 : () = %f(%x1, %x1)
-    // the type arguments in the second call are inferred to be <Tensor[(), bool], Tensor[(), bool], ()>
-
-Note that all type relations in the function type must hold at each
-call site. Specifically, this means that the relation will be checked
-against the specific types of the arguments at a given call site. This
-is also a form of polymorphism, since there may be multiple valid
-assignments of argument types and a return type so long as the relation
-is satisfied.
-
-For example, if we have a function :code:`%f` that takes tensor arguments
-and has the :code:`Broadcast` relation, then there are many different
-shapes that the arguments in the below call could have that would satisfy
-the type annotation:
-
-.. code-block::
-
-   let %x : Tensor[(100, 100, 100), float32] = %f(%a, %b);
-   %x
-
-See :py:class:`~tvm.relay.expr.Call` for its definition and documentation.
-
-.. _module-description:
-
-Module and Global Functions
-===========================
-
-Relay keeps a global data structure known as a "module" (often called an "environment" in other
-functional programming languages) to keep track of the definitions of global functions.
-In particular, the module keeps a globally accessible mapping of global variables to the
-function expressions they denote. The utility of the module is that it allows global functions
-to recursively refer to themselves or any other global function (e.g., as in mutual recursion).
-
-Note Relay's module is analogous to data structures for keeping track of subgraphs in computation
-graph-based IRs.
-
-Global functions in Relay behave identically to the function expressions defined in `Functions`_,
-but have syntactic sugar in the text format to enter their definitions into the module. Namely,
-a global function definition includes a global identifier and is allowed to recursively refer to
-that identifier in the body, as in the following example:
-
-.. code-block::
-
-   def @ackermann(%m : Tensor[(), int32], %n : Tensor[(), int32]) -> Tensor[(), int32] {
-       if (%m == 0) {
-           %n + 1
-       } else if (%m > 0 && %n == 0) {
-           @ackermann(%m - 1, 1)
-       } else {
-           @ackermann(%m - 1, @ackermann(%m, %n - 1))
-       }
-   }
-
-This definition would result in a module entry mapping the identifier :code:`@ackermann` to a function expression
-with the parameters, return type, and body above. Any reference to the identifier :code:`@ackermann` elsewhere in the
-code could then look up the identifier in the module and replace the function definition as needed.
-
-See :py:class:`~tvm.IRModule` for the definition and documentation of a module.
-
-Constant
-========
-
-This node represents a constant tensor value
-(see :py:mod:`~tvm.relay.Value` for more details).
-A constant is represented as a :py:class:`~tvm.NDArray`,
-allowing Relay to utilize TVM operators for constant evaluation.
-
-This node can also represent scalar constants, since
-scalars are tensors with a shape of :code:`()`. In the text format, numerical
-and boolean literals are thus syntactic sugar for constants encoding a
-tensor type with a rank-zero shape.
-
-See :py:class:`~tvm.relay.expr.Constant` for its definition and documentation.
-
-Tuples
-======
-
-Construction
-~~~~~~~~~~~~
-
-The tuple node builds a finite (that is, of statically known size) sequence of heterogeneous data.
-These tuples match Python's closely, and their fixed length allows for efficient projection of their
-members.
-
-.. code-block::
-
-   fn(%a : Tensor[(10, 10), float32], %b : float32, %c : Tensor[(100, 100), float32]) {
-       let %tup = (%a, %b);     // type: (Tensor[(10, 10), float32], float32)
-       ((%tup.0 + %tup.1), %c)  // type: (Tensor[(10, 10), float32], Tensor[(100, 100), float32])
-   }
-
-See :py:class:`~tvm.relay.expr.Tuple` for its definition and documentation.
-
-Projection
-~~~~~~~~~~
-
-A tuple must be indexed by an integer constant in order to extract a
-particular member of the tuple. Projections are 0-indexed.
-
-For example, the below projection evaluates to :code:`%b`:
-
-.. code-block::
-
-   (%a, %b, %c).1
-
-See :py:class:`~tvm.relay.expr.TupleGetItem` for its definition and documentation.
-
-Let Bindings
-============
-
-A :code:`let` binding is an immutable local variable binding,
-allowing the user to bind an expression to a name.
-
-A :code:`let` binding contains a local variable,
-an optional type annotation, a value, and a body expression
-that may reference the bound identifier. If a type annotation
-on the bound variable is omitted, Relay attempts to infer the
-most general type permitted for the variable.
-
-The bound variable in a :code:`let` expression is only in scope
-in its body, except when the variable defines a function expression.
-When a :code:`let` expression creates a function, the variable is also
-in scope in its value to allow for recursively defined functions
-(see the previous subsection).
-
-The value of a :code:`let` binding is the value of the final expression
-after evaluating the bindings it depends on. For example, in the
-following example the entire expression evaluates to a tensor
-of shape :code:`(10, 10)` where all elements are 1:
-
-.. code-block::
-
-   let %x : Tensor[(10, 10), float32] = Constant(1, (10, 10), float32);
-   %x + %x
-
-A sequence of :code:`let` bindings can be considered as a dataflow graph,
-where the bindings are a series of sub-graphs connected
-by bound variables. Since these binding sequences are
-pure, a pair of bindings where neither depends on the other can be safely reordered.
-For example, the first and second :code:`let` bindings below
-may be evaluated in either order because neither has a dataflow
-dependency on the other:
-
-.. code-block::
-
-   let %x = %a + %b;
-   let %y = %c + %d;
-   %x * %y
-
-See :py:class:`~tvm.relay.expr.Let` for its definition and documentation.
-
-Graph Bindings
-==============
-
-A :code:`let` binding creates a named variable that is bound to the given value
-and scoped to the subsequent expression. By contrast, a graph binding allows for
-explicitly constructing dataflow graphs in a Relay program by binding an expression
-(graph node) directly to a temporary variable, which is not scoped. Each reference
-to the variable corresponds to an edge in the dataflow graph. This has the
-semantics of substituting the expression wherever the variable appears, even though
-the graph node will only be evaluated once by the compiled program.
-
-These bindings allow for a style of programming that corresponds to that already
-employed by NNVM and other dataflow graph-based input formats. The fact that the variables
-are not scoped offers some flexibility in evaluation order compared to :code:`let`
-bindings, though this can also introduce some ambiguity in programs.
-
-*Note: Graph bindings are not currently parsed by the text format.*
-
-In Relay's text format, a graph binding can be written as below (note the lack of a
-:code:`let` keyword and a semicolon):
-
-.. code-block::
-
-   %1 = %a + %b
-   %2 = %1 + %1
-   %2 * %2
-
-Unlike a let binding, a graph binding is not represented as an AST node in Relay, but rather as a meta-variable referencing its AST node value.
-For example, a program like the above could be constructed in Relay's
-Python front-end by setting *Python variables* equal to the corresponding Relay AST node and
-using the variables repeatedly, as below (a C++ program using the corresponding API bindings
-could accomplish the same thing):
-
-.. code-block::
-
-   sum1 = relay.add(a, b)
-   sum2 = relay.add(sum1, sum1)
-   relay.multiply(sum2, sum2)
-
-For development purposes and to enable certain optimizations, Relay includes passes to
-convert between dataflow graphs defined using graph bindings and programs with :code:`let`
-bindings in A-normal form, employed by many compiler optimizations from the functional
-programming community (see `"A-Normalization: Why and How" by
-Matt Might <http://matt.might.net/articles/a-normalization/>`__ for an introduction
-to A-normal form).
-
-If-Then-Else
-============
-
-Relay has a simple if-then-else expression that allows programs to branch
-on a single value of type :code:`bool`, i.e., a zero-rank
-tensor of booleans (:code:`Tensor[(), bool]`).
-
-.. code-block::
-
-    if (%t == %u) {
-        %t
-    } else {
-        %u
-    }
-
-Since if-then-else branches are expressions, they may appear inline
-wherever any other expression may be expected, like invocations of
-the ternary operator in C-like languages. The if-then-else expression
-evaluates to the value of the "then" branch if the condition value
-evaluates to :code:`True` and evaluates to the value of the "else" branch if the
-condition value evaluates to :code:`False`.
-
-See :py:class:`~tvm.relay.expr.If` for its definition and documentation.
-
-ADT Matching
-============
-
-Instances of algebraic data types (ADTs), as discussed in the
-:ref:`ADT overview<adt-overview>`, are containers that store the
-arguments passed to the constructor used to create them, tagged by
-the constructor name.
-
-Match expressions in Relay allow for retrieving the values stored in
-an ADT instance ("deconstructing" it) based on their constructor tag.
-A match expression behaves similarly to a C-style :code:`switch` statement,
-branching on the different possible constructors for the type of the
-value being deconstructed. As the ADT overview details, match
-expressions are capable of more general pattern-matching than simply
-splitting by constructors: any ADT instance nested inside an instance
-(e.g., a list of lists) can be deconstructed at the same time as
-the outer instance, while the different fields of the instance can be
-bound to variables. (See :ref:`this section<adt-pattern>` for a detailed
-description of ADT pattern-matching.)
-
-A match expression is defined using the
-input value (an expression) and a list of clauses, each of which
-consists of a pattern and an expression. When executed, the *first*
-clause whose pattern matches the structure of the queried value is
-executed; the clause expression is evaluated and returned.
-
-For example, suppose we have an ADT for natural numbers:
-
-.. code-block::
-
-   data Nat {
-     Z : () -> Nat # zero
-     S : (Nat) -> Nat # successor (+1) to a nat
-   }
-
-Then the following function subtracts one from a passed nat:
-
-.. code-block::
-
-   fn(%v: Nat[]) -> Nat[] {
-     match(%v) {
-       case Z() { Z() }
-       case S(%n) { %n } # the variable %n is bound in the scope of this clause
-     }
-   }
-
-The following function subtracts two from its argument if it is at least
-two and returns the argument otherwise, using a nested constructor pattern:
-
-.. code-block::
-
-   fn(%v : Nat[]) -> Nat[] {
-     match(%v) {
-        case S(S(%n)) { %n }
-        # wildcard pattern: matches all cases not matched already
-        case _ { %v }
-     }
-   }
-
-As aforementioned, the ordering of match clauses is relevant.
-In the below example, the first clause will always match so
-those below it can never run:
-
-.. code-block::
-
-   fn(%v : Nat[]) -> Nat[] {
-     match(%v) {
-       case _ { %v }
-       case S(S(%n)) { S(%n) }
-       case S(%n) { %n }
-       case Z() { S(Z()) }
-     }
-   }
-
-See :py:class:`~tvm.relay.adt.Match` for its definition and documentation.
-
-TempExprs
-=========
-
-Program transformations (passes) in Relay may require inserting temporary
-state into the program AST to guide further transformations. The
-:code:`TempExpr` node is provided as a utility to developers for this purpose;
-nodes inheriting from :code:`TempExpr` cannot appear directly in user-provided
-code but may be inserted in a pass. Any :code:`TempExpr` created in a pass
-should ideally be eliminated before the pass is complete, as a
-:code:`TempExpr` only stores internal state and has no semantics of its own.
-
-For an example of :code:`TempExpr` being used in a pass, see
-:code:`src/relay/transforms/fold_scale_axis.cc`, which uses
-:code:`TempExpr` nodes to store information about scaling parameters
-as the pass tries to fold these into the weights of a convolution.
-
-See :py:class:`~tvm.relay.expr.TempExpr` for its definition and documentation.
diff --git a/docs/reference/langref/relay_op.rst b/docs/reference/langref/relay_op.rst
deleted file mode 100644
index 8bc24b9ab8..0000000000
--- a/docs/reference/langref/relay_op.rst
+++ /dev/null
@@ -1,247 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-Relay Core Tensor Operators
-===========================
-
-This page contains the list of core tensor operator primitives pre-defined in tvm.relay.
-The core tensor operator primitives cover typical workloads in deep learning.
-They can represent workloads in front-end frameworks and provide basic building blocks for optimization.
-Since deep learning is a fast evolving field, it is possible to have operators that are not in here.
-
-
-.. note::
-
-   This document will directly list the function signature of
-   these operators in the python frontend.
-
-
-Overview of Operators
----------------------
-**Level 1: Basic Operators**
-
-This level enables fully connected multi-layer perceptron.
-
-.. autosummary::
-   :nosignatures:
-
-   tvm.relay.log
-   tvm.relay.sqrt
-   tvm.relay.rsqrt
-   tvm.relay.exp
-   tvm.relay.sigmoid
-   tvm.relay.add
-   tvm.relay.subtract
-   tvm.relay.multiply
-   tvm.relay.divide
-   tvm.relay.mod
-   tvm.relay.tanh
-   tvm.relay.concatenate
-   tvm.relay.expand_dims
-   tvm.relay.nn.softmax
-   tvm.relay.nn.log_softmax
-   tvm.relay.nn.relu
-   tvm.relay.nn.dropout
-   tvm.relay.nn.batch_norm
-   tvm.relay.nn.bias_add
-
-
-**Level 2: Convolutions**
-
-This level enables typical convnet models.
-
-.. autosummary::
-   :nosignatures:
-
-   tvm.relay.nn.conv2d
-   tvm.relay.nn.conv2d_transpose
-   tvm.relay.nn.conv3d
-   tvm.relay.nn.conv3d_transpose
-   tvm.relay.nn.dense
-   tvm.relay.nn.max_pool2d
-   tvm.relay.nn.max_pool3d
-   tvm.relay.nn.avg_pool2d
-   tvm.relay.nn.avg_pool3d
-   tvm.relay.nn.global_max_pool2d
-   tvm.relay.nn.global_avg_pool2d
-   tvm.relay.nn.upsampling
-   tvm.relay.nn.upsampling3d
-   tvm.relay.nn.batch_flatten
-   tvm.relay.nn.pad
-   tvm.relay.nn.lrn
-   tvm.relay.nn.l2_normalize
-   tvm.relay.nn.bitpack
-   tvm.relay.nn.bitserial_dense
-   tvm.relay.nn.bitserial_conv2d
-   tvm.relay.nn.contrib_conv2d_winograd_without_weight_transform
-   tvm.relay.nn.contrib_conv2d_winograd_weight_transform
-   tvm.relay.nn.contrib_conv3d_winograd_without_weight_transform
-   tvm.relay.nn.contrib_conv3d_winograd_weight_transform
-
-
-**Level 3: Additional Math And Transform Operators**
-
-This level enables additional math and transform operators.
-
-.. autosummary::
-   :nosignatures:
-
-   tvm.relay.nn.leaky_relu
-   tvm.relay.nn.prelu
-   tvm.relay.reshape
-   tvm.relay.reshape_like
-   tvm.relay.copy
-   tvm.relay.transpose
-   tvm.relay.squeeze
-   tvm.relay.floor
-   tvm.relay.ceil
-   tvm.relay.sign
-   tvm.relay.trunc
-   tvm.relay.clip
-   tvm.relay.round
-   tvm.relay.abs
-   tvm.relay.negative
-   tvm.relay.take
-   tvm.relay.zeros
-   tvm.relay.zeros_like
-   tvm.relay.ones
-   tvm.relay.ones_like
-   tvm.relay.gather
-   tvm.relay.gather_nd
-   tvm.relay.full
-   tvm.relay.full_like
-   tvm.relay.cast
-   tvm.relay.reinterpret
-   tvm.relay.split
-   tvm.relay.arange
-   tvm.relay.meshgrid
-   tvm.relay.stack
-   tvm.relay.repeat
-   tvm.relay.tile
-   tvm.relay.reverse
-   tvm.relay.reverse_sequence
-   tvm.relay.unravel_index
-   tvm.relay.sparse_to_dense
-
-
-**Level 4: Broadcast and Reductions**
-
-.. autosummary::
-   :nosignatures:
-
-   tvm.relay.right_shift
-   tvm.relay.left_shift
-   tvm.relay.equal
-   tvm.relay.not_equal
-   tvm.relay.greater
-   tvm.relay.greater_equal
-   tvm.relay.less
-   tvm.relay.less_equal
-   tvm.relay.all
-   tvm.relay.any
-   tvm.relay.logical_and
-   tvm.relay.logical_or
-   tvm.relay.logical_not
-   tvm.relay.logical_xor
-   tvm.relay.maximum
-   tvm.relay.minimum
-   tvm.relay.power
-   tvm.relay.where
-   tvm.relay.argmax
-   tvm.relay.argmin
-   tvm.relay.sum
-   tvm.relay.max
-   tvm.relay.min
-   tvm.relay.mean
-   tvm.relay.variance
-   tvm.relay.std
-   tvm.relay.mean_variance
-   tvm.relay.mean_std
-   tvm.relay.prod
-   tvm.relay.strided_slice
-   tvm.relay.broadcast_to
-
-
-**Level 5: Vision/Image Operators**
-
-.. autosummary::
-   :nosignatures:
-
-   tvm.relay.image.resize1d
-   tvm.relay.image.resize2d
-   tvm.relay.image.resize3d
-   tvm.relay.image.crop_and_resize
-   tvm.relay.image.dilation2d
-   tvm.relay.vision.multibox_prior
-   tvm.relay.vision.multibox_transform_loc
-   tvm.relay.vision.nms
-   tvm.relay.vision.yolo_reorg
-
-
-**Level 6: Algorithm Operators**
-
-.. autosummary::
-   :nosignatures:
-
-   tvm.relay.argsort
-   tvm.relay.topk
-
-
-**Level 10: Temporary Operators**
-
-This level support backpropagation of broadcast operators. It is temporary.
-
-.. autosummary::
-   :nosignatures:
-
-   tvm.relay.broadcast_to_like
-   tvm.relay.collapse_sum_like
-   tvm.relay.slice_like
-   tvm.relay.shape_of
-   tvm.relay.ndarray_size
-   tvm.relay.layout_transform
-   tvm.relay.device_copy
-   tvm.relay.annotation.on_device
-   tvm.relay.reverse_reshape
-   tvm.relay.sequence_mask
-   tvm.relay.nn.batch_matmul
-   tvm.relay.nn.adaptive_max_pool2d
-   tvm.relay.nn.adaptive_avg_pool2d
-   tvm.relay.one_hot
-
-
-**Level 11: Dialect Operators**
-
-This level supports dialect operators.
-
-.. autosummary::
-   :nosignatures:
-
-   tvm.relay.qnn.op.add
-   tvm.relay.qnn.op.batch_matmul
-   tvm.relay.qnn.op.concatenate
-   tvm.relay.qnn.op.conv2d
-   tvm.relay.qnn.op.conv2d_transpose
-   tvm.relay.qnn.op.dense
-   tvm.relay.qnn.op.dequantize
-   tvm.relay.qnn.op.mul
-   tvm.relay.qnn.op.quantize
-   tvm.relay.qnn.op.requantize
-   tvm.relay.qnn.op.rsqrt
-   tvm.relay.qnn.op.simulated_dequantize
-   tvm.relay.qnn.op.simulated_quantize
-   tvm.relay.qnn.op.subtract
diff --git a/docs/reference/langref/relay_pattern.rst b/docs/reference/langref/relay_pattern.rst
deleted file mode 100644
index a80c55323b..0000000000
--- a/docs/reference/langref/relay_pattern.rst
+++ /dev/null
@@ -1,549 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-
-=========================
-Pattern Matching in Relay
-=========================
-
-There are many places in TVM where we identify pure data-flow sub-graphs of the Relay program and attempt to transform them in some way example passes include fusion, quantization, external code generation, and device specific optimizations.
-
-Many of these passes today require a lots of boring boilerplate code in order to implement as well as requiring users to think in terms of visitors and AST matching. Many of these transformations can easily be described in terms of graph rewrites. In order to build a rewriter or other advanced machinery we first need a language of patterns to describe what we can match.
-
-Such a language is not just useful for building a rewriter but also providing extension points for existing passes. For example the fusion pass could be parameterized by a set of fusion patterns which describes the capability of your hardware, and the quantization pass could take a set of patterns which describe which operators can be quantized on a given platform.
-
-In the backend world, we could use the same machinery to build a higher level API using bring your own code generation. This API takes set of patterns describing your hardware capabilities and an external compiler, providing a relatively smooth heterogeneous experience out of the box.
-
-Pattern Examples
-================
-
-There are quite a few properties of operators that are worth matching. Below we examine how to match tree properties, and expand on some use cases that are not fully explored in the prototype. This section
-demonstrates how to write patterns. It is recommended to check `tests/python/relay/test_dataflow_pattern.py`_
-for more use cases.
-
-.. _tests/python/relay/test_dataflow_pattern.py: https://github.com/apache/tvm/blob/main/tests/python/relay/test_dataflow_pattern.py
-
-.. note::
-
-    If you cannot find the corresponding pattern node to match the Relay node you want,
-    you are welcome to raise an issue or submit a PR to add it.
-
-Matching One of Two Ops
-***********************
-
-The first example is a simple case where we want to match one operator with a single input OR
-another operator with a single input:
-
-.. code-block:: python
-
-    def test_match_op_or():
-        is_add_or_sub = is_op('add') | is_op('subtract')
-        assert is_add_or_sub.match(relay.op.op.get("add"))
-        assert is_add_or_sub.match(relay.op.op.get("subtract"))
-
-
-Matching an Op with Attributes
-******************************
-
-The next example is a dense operation with any operator that is marked element-wise:
-
-.. code-block:: python
-
-    def test_no_match_attr():
-        op = is_op('nn.dense').has_attr({"TOpPattern": K_ELEMWISE})
-        op_pat = op(wildcard(), wildcard())
-        x = relay.var('x')
-        y = relay.var('y')
-        assert not op_pat.match(relay.op.nn.dense(x, y))
-
-Here is another example to match an op with a specific attribute:
-
-.. code-block:: python
-
-    def test_match_data_layout():
-        is_conv2d = is_op('nn.conv2d')(wildcard(), wildcard()).has_attr({"data_layout": "NHWC"})
-        x = relay.var('x')
-        y = relay.var('y')
-        assert not is_conv2d.match(relay.op.nn.conv2d(x, y))
-
-Or a convolution with a specific kernel size:
-
-.. code-block:: python
-
-    def test_match_kernel_size():
-        is_conv2d = is_op("nn.conv2d")(wildcard(), wildcard()).has_attr({"kernel_size": [3, 3]})
-        x = relay.var('x')
-        y = relay.var('y')
-        assert is_conv2d.match(relay.op.nn.conv2d(x, y, kernel_size=[3, 3]))
-
-
-
-Matching an Optional Op
-***********************
-
-The next example is matching a pattern with one optional operator. In this pattern,
-we can match the graph of conv2d+bias_add+relu or the graph of conv2d+bias_add.
-
-.. code-block:: python
-
-    def test_match_optional():
-        conv_node = is_op('nn.conv2d')(wildcard(), wildcard())
-        bias_node = is_op('nn.bias_add')(conv_node, wildcard())
-        pat = bias_node.optional(lambda x: is_op('nn.relu')(x))
-
-        x = relay.var('x')
-        y = relay.var('y')
-        z = relay.var('z')
-        conv2d = relay.op.nn.conv2d(x, y)
-        bias = relay.op.nn.bias_add(conv2d, z)
-        assert pat.match(bias)
-        relu = relay.op.nn.relu(bias)
-        assert pat.match(relu)
-
-
-Matching Types
-**************
-
-In addition to matching ops with attributes, we can also make a pattern to match their types, in interms of the shape and data type. Here are some examples:
-
-.. code-block:: python
-
-    def test_match_type():
-        # Match any op with float32
-        pat1 = has_dtype('float32')
-        x = relay.var('x', shape=(10, 10), dtype='float32')
-        assert pat1.match(x)
-
-        # Match any op with shape (10, 10)
-        pat2 = has_shape((10, 10))
-        x = relay.var('x', shape=(10, 10), dtype='float32')
-        assert pat2.match(x)
-
-        # Match conv2d+relu with a certain shape
-        conv2d = is_op('nn.conv2d')(wildcard(), wildcard())
-        pat3 = is_op('nn.relu')(conv2d).has_shape((1, 32, 28, 28))
-
-        x = relay.var('x', shape=(1, 3, 28, 28), dtype='float32')
-        w = relay.var('w', shape=(32, 3, 3, 3), dtype='float32')
-        conv2d = relay.nn.conv2d(x, w, strides=(1, 1), padding=(1, 1))
-        relu = relay.nn.relu(conv2d)
-        assert pat3.match(relu)
-
-
-Matching Non-Call Nodes
-***********************
-
-Sometimes we may also want to match a pattern that includes Tuple or TupleGetItem nodes.
-Since there are not call nodes, we need to use specific pattern nodes to match them:
-
-.. code-block:: python
-
-    def test_match_tuple():
-        x = relay.var('x')
-        y = relay.var('y')
-        z = relay.var('z')
-        tuple_pattern = is_tuple((wildcard(), wildcard(), wildcard()))
-        assert tuple_pattern.match(relay.expr.Tuple((x,y,z)))
-
-The next example is matching a pattern of batch_norm -> get(0) -> relu. Note that you can also use `is_tuple_get_item(bn_node)` to match a `TupleGetItem` node with any index.
-
-.. code-block:: python
-
-    def test_match_tuple_get_item():
-        bn_node = is_op('nn.batch_norm')(wildcard(), wildcard(), wildcard(), wildcard(), wildcard())
-        tuple_get_item_node = is_tuple_get_item(bn_node, 0)
-        pat = is_op('nn.relu')(tuple_get_item_node)
-
-        x = relay.var('x', shape=(1, 8))
-        gamma = relay.var("gamma", shape=(8,))
-        beta = relay.var("beta", shape=(8,))
-        moving_mean = relay.var("moving_mean", shape=(8,))
-        moving_var = relay.var("moving_var", shape=(8,))
-        bn_node = relay.nn.batch_norm(x, gamma, beta, moving_mean, moving_var)
-        tuple_get_item_node = bn_node[0]
-        out = relay.nn.relu(tuple_get_item_node)
-        pat.match(out)
-
-If we have a pattern that crosses a function boundary, we might want to match the Function itself
-
-
-.. code-block:: python
-
-  def test_match_func():
-      x = relay.var("x")
-      y = relay.var("y")
-      wc1 = wildcard()
-      wc2 = wildcard()
-      func_pattern = FunctionPattern([wc1, wc2], wc1 + wc2)
-      assert func_pattern.match(relay.Function([x, y], x + y))
-
-The next example is matching a constant node regarding its values. This is useful to check
-if a specific parameter in a subgraph has been bound or not.
-
-.. code-block:: python
-
-    def test_match_constant():
-        conv2d = is_op('nn.conv2d')(wildcard(), is_constant())
-        pattern = is_op('nn.bias_add')(conv2d, wildcard())
-
-        x = relay.var('x', shape=(1, 3, 224, 224))
-        w = relay.var('w', shape=(3, 3, 3, 3))
-        b = relay.var('b', shape=(3, ))
-        conv2d = relay.op.nn.conv2d(x, w)
-        out = relay.op.nn.bias_add(conv2d, b)
-        func = relay.Function([x, w, b], out)
-        mod = tvm.IRModule.from_expr(func)
-
-        # Two inputs of the conv2d in the graph are VarNode by default, so no match.
-        assert not pattern.match(mod['main'].body)
-
-        # The second input (weight) has been bind with constant values so it is now a constant node.
-        mod["main"] = bind_params_by_name(mod["main"],
-                                        {'w': tvm.nd.array(np.ones(shape=(3, 3, 3, 3)))})
-        assert pattern.match(mod['main'].body)
-
-On the other hand, if you need to match the constant with a specific value, you can directly
-use ``is_expr``. This could be useful for algebraic simplify.
-
-.. code-block:: python
-
-    def test_match_plus_zero():
-        zero = (is_expr(relay.const(0)) | is_expr(relay.const(0.0)))
-        pattern = wildcard() + zero
-
-        x = relay.Var('x')
-        y = x + relay.const(0)
-        assert pattern.match(y)
-
-The next example is matching function nodes with a specific attribute:
-
-.. code-block:: python
-
-    def test_match_function():
-        pattern = wildcard().has_attr({"Composite": "add"})
-
-        x = relay.var('x')
-        y = relay.var('y')
-        f = relay.Function([x, y], x + y).with_attr("Composite", "add")
-        assert pattern.match(f)
-
-A Relay ``If`` expression can be matched if all of its condition, true branch and false branch
-are matched:
-
-.. code-block:: python
-
-    def test_match_if():
-        x = is_var("x")
-        y = is_var("y")
-        pat = is_if(is_op("less")(x, y), x, y)
-
-        x = relay.var("x")
-        y = relay.var("y")
-        cond = x < y
-
-        assert pat.match(relay.expr.If(cond, x, y))
-
-
-A Relay ``Let`` expression can be matched if all of its variable, value, and body
-are matched:
-
-.. code-block:: python
-
-  def test_match_let():
-      x = is_var("x")
-      y = is_var("y")
-      let_var = is_var("let")
-      pat = is_let(let_var, is_op("less")(x, y), let_var)
-
-      x = relay.var("x")
-      y = relay.var("y")
-      lv = relay.var("let")
-      cond = x < y
-      assert pat.match(relay.expr.Let(lv, cond, lv))
-
-Matching Diamonds and Post-Dominator Graphs
-*******************************************
-
-The next example is matching a diamond with two inputs at the top of the diamond::
-
-    def test_match_diamond():
-        # Pattern
-        is_conv2d = is_op('nn.conv2d')(is_var(), is_var())
-        path1 = is_op('nn.relu')(is_conv2d)
-        path2 = is_op('nn.leaky_relu')(is_conv2d)
-        diamond = is_op('add')(path1, path2)
-
-        # Expr
-        inp = relay.var('input')
-        weight = relay.var('weight')
-        conv2d = relay.op.nn.conv2d(inp, weight)
-        relu = relay.op.nn.relu(conv2d)
-        leaky_relu = relay.op.nn.leaky_relu(conv2d, alpha=0)
-        out = relu + leaky_relu
-
-        # Check
-        assert diamond.match(out)
-
-The final example is matching diamonds with a post-dominator relationship. We embed dominator analysis as type of matching in the pattern language in order to allow for pattern matching with unknown topology. This is important because we want to be able to use the language to describe fuse patterns, like elementwise operations followed by a conv2d::
-
-    def test_match_dom_diamond():
-        # Pattern
-        is_conv2d = is_op('nn.conv2d')(is_var(), is_var())
-        reduction = is_op('add')(wildcard(), wildcard())
-        diamond = dominates(is_conv2d, is_elemwise, reduction)
-
-        # Expr
-        inp = relay.var('input')
-        weight = relay.var('weight')
-        conv2d = relay.op.nn.conv2d(inp, weight)
-        relu = relay.op.nn.relu(conv2d)
-        leaky_relu = relay.op.nn.leaky_relu(conv2d, alpha=0)
-        out = relu + leaky_relu
-
-        # Check
-        assert diamond.match(out)
-
-
-Matching Fuzzy Patterns
-=======================
-
-The Dominator analysis above lets one match a subgraph of Relay AST that doesn't correspond to a set of patterns nodes exactly 1-to-1. There are a few other places where we support such "fuzzy" matching.
-
-Tuples, Functions, and Call nodes with any number of inputs can be matched by passing `None` as the argument value, i.e.::
-
-    tuple_pattern = is_tuple(None)
-    func_pattern = FunctionPattern(None, wildcard() + wildcard())
-    call_pattern = func_pattern(None)
-
-These patterns allow matching more generic classes patterns by constraining the use of the arguments rather than the number of arguments.
-
-Additionally, we support matching Functions with fuzzy bodies, i.e., a function body that is under constrained by the pattern. The pattern `FunctionPattern([is_var(), is_var()], wildcard() + wildcard()])` will match `relay.Function([x, y], x + y)`, but it will also match `relay.Function([x, y], x * x + y)`. In the second case, the pattern doesn't perfectly constrain the body of the function, so the resulting match is fuzzy.
-
-
-Pattern Language Design
-=======================
-
-The pattern language proposed is designed to be a mirror of Relay's IR with additional support for common scenarios. The goal of the pattern language is to provide a regular-expression like capability for matching data-flow graphs and doing rewriting.
-
-The high level design is to introduce a language of patterns for now we propose the language as::
-
-    Pattern ::= expr
-            | *
-            | pattern(pattern1, ... patternN)
-            | has_type(type)
-            | has_dtype(type)
-            | has_shape(shape)
-            | has_attr(attrs)
-            | is_var(name)
-            | is_constant()
-            | is_expr(expr)
-            | is_op(op_name)
-            | is_tuple()
-            | is_tuple_get_item(pattern, index = None)
-            | is_if(cond, tru, fls)
-            | is_let(var, value, body)
-            | pattern1 `|` pattern2
-            | dominates(parent_pattern, path_pattern, child_pattern)
-            | FunctionPattern(params, body)
-
-The above language then provides a matching interface with both can select sub-graphs as well as verify that the graph does match the pattern.
-
-Expression Pattern
-******************
-
-Match a literal expression.
-
-Wildcard
-********
-
-Match any expression.
-
-Type Pattern
-************
-
-Check that the expression matched by the nested pattern has a particular type.
-
-DType Pattern
-*************
-
-Check that the expression matched by the nested pattern has a particular data type.
-
-Shape Pattern
-*************
-
-Check that the expression matched by the nested pattern has a particular output shape.
-
-Attribute Pattern
-*****************
-
-Check that the operator matched by the pattern has an attribute with a particular value.
-
-Variable Pattern
-****************
-
-Check that the expression is a relay Variable, and optional provide a name to match to the Variable name.
-
-
-Alternate
-*********
-
-Either match the first pattern or the second pattern.
-
-Domination
-**********
-
-Match child pattern, find a match for the parent pattern, insuring that the child ultimately dominates the parent (i.e., no nodes outside the pattern use outputs of the parent), and that ever node between the child and the pattern matches the path pattern.
-
-Function Pattern
-****************
-
-Match a Function with a body and parameters
-
-If Pattern
-**********
-
-Match an If with condition, true branch, and false branch
-
-Let Pattern
-***********
-
-Match a Let with a variable, value, and body
-
-Applications
-============
-
-The pattern language provides not only the pattern matching but also pattern processing.
-Here we introduce two pattern processing approaches and provide some examples.
-
-Pattern Rewriting
-*****************
-
-If you would like to replace the matched pattern with another subgraph, you can leverage
-the ``rewrite`` transformation. Here is an example of rewriting a series of arithmetic operators
-with a single batch_norm op. The constructor parameter ``require_type`` indicates whether InferType
-is required to be run before the callback.
-
-.. code-block:: python
-
-    class BatchnormCallback(DFPatternCallback):
-        # A callback class to rewrite the matched pattern to a batch_norm op.
-        def __init__(self, require_type=False):
-            super().__init__(require_type)
-            self.x = wildcard()
-            self.var = wildcard()
-            self.mean = wildcard()
-            self.beta = wildcard()
-            self.gamma = wildcard()
-            self.eps = wildcard()
-
-            self.pattern = self.gamma * (self.x - self.mean)/is_op("sqrt")(self.var + self.eps) + self.beta
-
-        def callback(self, pre, post, node_map):
-            x = node_map[self.x][0]
-            var = node_map[self.var][0]
-            mean = node_map[self.mean][0]
-            beta = node_map[self.beta][0]
-            gamma = node_map[self.gamma][0]
-            eps = node_map[self.eps][0]
-            return relay.op.nn.batch_norm(x, gamma, beta, mean, var, epsilon = eps.data.numpy().item())[0]
-
-        # A graph of arithmetic operators that are functional equivalent to batch_norm.
-        x = relay.var('x')
-        var = relay.var('var')
-        mean = relay.var('mean')
-        beta = relay.var('beta')
-        gamma = relay.var('gamma')
-        BN = gamma * (x - mean)/relay.op.sqrt(var + relay.const(1e-5)) + beta
-
-        from tvm.relay.dataflow_pattern import rewrite
-        out = rewrite(BatchnormCallback(), BN)
-        assert tvm.ir.structural_equal(out, relay.op.nn.batch_norm(x, gamma, beta, mean, var, epsilon = 1e-5)[0])
-
-The function ``def callback(self, pre, post, node_map)`` will be invoked when the rewriter matches
-``self.pattern``. ``node_map`` is a dictionary mapping from pattern nodes to matched nodes in the graph.
-
-The callback function will be invoked recursively on the returned pattern until the pattern stops changing. As a result, if ``self.pattern`` matches any part of the graph that the callback returned, the rewriter will run in a loop. If you want to avoid multiple rewrites, you can pass a ``rewrite_once=True`` parameter to the constructor.
-
-Pattern Partitioning
-********************
-
-If you would like to perform a more complex processing for matched subgraphs and you are not
-satisfied with ``rewrite``, you may consider partitioning the matched subgraphs to a separate
-Relay function and perform other processes to the function. Here we use ``pattern.partition``
-to create a new Relay function for each matched subgraph. The functionality is similar to
-the op fusion pass in TVM:
-
-.. code-block:: python
-
-    # A pattern matching conv2d+relu.
-    pattern = is_op("nn.relu")(is_op("nn.conv2d")(wildcard(), wildcard()))
-
-    # A graph.
-    x = relay.var('input')
-    w = relay.var('weight')
-    conv2d = relay.op.nn.conv2d(x, w)
-    relu = relay.op.nn.relu(conv2d)
-    print('relu')
-    # free_var %x: Tensor[(1, 3, 224, 224), float32]
-    # free_var %w: Tensor[(3, 3, 3, 3), float32]
-    # %0 = nn.conv2d(%x, %w, padding=[0, 0, 0, 0]) /* ty=Tensor[(1, 3, 222, 222), float32] */;
-    # free_var %b: Tensor[(3), float32]
-    # nn.bias_add(%0, %b) /* ty=Tensor[(1, 3, 222, 222), float32] */
-
-    # After partition.
-    print(pattern.partition(relu))
-    # free_var %x: Tensor[(1, 3, 224, 224), float32]
-    # free_var %w: Tensor[(3, 3, 3, 3), float32]
-    # free_var %b: Tensor[(3), float32]
-    # %1 = fn (%FunctionVar_0_0, %FunctionVar_0_1,
-    #          %FunctionVar_0_2, PartitionedFromPattern="nn.conv2d_nn.bias_add_") {
-    #   %0 = nn.conv2d(%FunctionVar_0_0, %FunctionVar_0_1, padding=[0, 0, 0, 0]);
-    #   nn.bias_add(%0, %FunctionVar_0_2)
-    # };
-    # %1(%x, %w, %b)
-
-Note that you can also specify the attributes for the created functions:
-
-.. code-block:: python
-
-    print(pattern.partition(relu, {'Composite': 'one_layer'}))
-    # free_var %x: Tensor[(1, 3, 224, 224), float32]
-    # free_var %w: Tensor[(3, 3, 3, 3), float32]
-    # free_var %b: Tensor[(3), float32]
-    # %1 = fn (%FunctionVar_0_0, %FunctionVar_0_1,
-    #          %FunctionVar_0_2, Composite="one_layer",
-    #                            PartitionedFromPattern="nn.conv2d_nn.bias_add_") {
-    #   %0 = nn.conv2d(%FunctionVar_0_0, %FunctionVar_0_1, padding=[0, 0, 0, 0]);
-    #   nn.bias_add(%0, %FunctionVar_0_2)
-    # };
-    # %1(%x, %w, %b)
-
-If you need a customized checking function that cannot be specified using pattern language,
-you can specify ``check`` function when partitioning. The following example demonstrates a
-case that checks input data layout of a subgraph:
-
-.. code-block:: python
-
-    def check(pre):
-        conv = pre.args[0]
-        return (conv.attrs.data_layout == "NCHW") and bool(conv.checked_type.shape[0] == 1)
-
-    pattern.partition(relu, check=check)
-
-In this example, we check if the first argument of the matched subgraph (i.e., ``pre.args[0]``)
-has data layout "NCHW" and if its batch size is 1. This feature is useful if the conditions
-of matching a pattern cannot be verified by analyzing the pattern itself.
diff --git a/docs/reference/langref/relay_type.rst b/docs/reference/langref/relay_type.rst
deleted file mode 100644
index 632c6387c5..0000000000
--- a/docs/reference/langref/relay_type.rst
+++ /dev/null
@@ -1,398 +0,0 @@
-..  Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-..    http://www.apache.org/licenses/LICENSE-2.0
-
-..  Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-
-===================
-Relay's Type System
-===================
-
-We briefly introduced types while detailing Relay's expression language,
-but have not yet described its type system. Relay is
-a statically typed and type-inferred language, allowing programs to
-be fully typed while requiring just a few explicit type annotations.
-
-Static types are useful when performing compiler optimizations because they
-communicate properties about the data a program manipulates, such as runtime
-shape, data layout, and storage, without needing to run the program.
-Relay's `Algebraic Data Types`_ allow for easily and flexibly composing
-types in order to build data structures that can be
-reasoned about inductively and used to write recursive functions.
-
-Relay's type system features a form of *dependent typing* for shapes. That is, its type system keeps track of the shapes of tensors in a Relay program. Treating tensor
-shapes as types allows Relay to perform more powerful reasoning at compile time;
-in particular, Relay can statically reason about operations whose output shapes
-vary based on the input shapes in complex ways. Casting shape inference as a type
-inference problem allows Relay to infer the shapes of all tensors at compile time,
-including in programs that use branching and function calls.
-
-Statically reasoning about shapes in this manner allows
-Relay to be ahead-of-time compiled and provides much more information about
-tensors for optimizations further in the compilation pipeline. Such optimizations
-can be implemented as passes, which are Relay-to-Relay AST transformations, and
-may use the inferred types (e.g., shape information) for making decisions about
-program transformations. For instance, :code:`src/relay/transforms/fuse_ops.cc` gives
-an implementation of a pass that uses inferred tensor shapes to replace invocations
-of operators in a Relay program with fused operator implementations.
-
-Reasoning about tensor types in Relay is encoded using *type relations*, which means
-that the bulk of type checking in Relay is constraint solving (ensuring that all
-type relations are satisfied at call sites). Type relations offer a flexible and
-relatively simple way of making the power of dependent typing available in Relay
-without greatly increasing the complexity of its type system.
-
-Below we detail the language of types in Relay and how they are assigned to Relay expressions.
-
-Type
-====
-
-The base type for all Relay types. All Relay types are sub-classes of this base type.
-
-See :py:class:`~tvm.relay.ty.Type` for its definition and documentation.
-
-Tensor Type
-===========
-
-A concrete tensor type in Relay.
-
-Tensors are typed according to data type and shape. At present, these use TVM's
-data types and shapes, but in the future, Relay may include a separate AST for
-shapes. In particular, data types include :code:`bool`, :code:`float32`, :code:`int8` and various
-other bit widths and numbers of lanes. Shapes are given as tuples of dimensions (TVM :code:`IndexExpr`),
-such as :code:`(5, 5)`; scalars are also given tuple types and have a shape of :code:`()`.
-
-Note, though, that TVM shapes can also include variables and arithmetic expressions
-including variables, so Relay's constraint solving phase will attempt to find
-assignments to all shape variables to ensure all shapes will be concrete before
-running a program.
-
-For example, here is a simple concrete tensor type corresponding to a 10-by-10 tensor of 32-bit floats:
-
-.. code-block::
-
-   Tensor[(10, 10), float32]
-
-See :py:class:`~tvm.relay.ty.TensorType` for its definition and documentation.
-
-Tuple Type
-==========
-
-A type of a tuple in Relay.
-
-Just as a tuple is simply a sequence of values of statically known length, the type
-of a tuple consists of a sequence of the types corresponding to each member of the tuple.
-
-Because a tuple type is of statically known size, the type of a tuple projection
-is simply the corresponding index into the tuple type.
-
-For example, in the below code, :code:`%t` is of type
-:code:`(Tensor[(), bool], Tensor[(10, 10), float32])`
-and :code:`%c` is of type :code:`Tensor[(10, 10), float32]`.
-
-.. code-block::
-
-   let %t = (False, Constant(1, (10, 10), float32));
-   let %c = %t.1;
-   %c
-
-See :py:class:`~tvm.relay.ty.TupleType` for its definition and documentation.
-
-.. _type-parameter:
-
-Type Parameter
-==============
-
-Type parameters represent placeholder types used for polymorphism in functions.
-Type parameters are specified according to *kind*, corresponding to the types
-those parameters are allowed to replace:
-
-- :code:`Type`, corresponding to top-level Relay types like tensor types, tuple types, and function types
-- :code:`BaseType`, corresponding to the base type of a tensor (e.g., :code:`float32`, :code:`bool`)
-- :code:`Shape`, corresponding to a tensor shape
-- :code:`ShapeVar`, corresponding to variables within a tensor shape
-
-Relay's type system enforces that type parameters are only allowed to appear where their kind permits them,
-so if type variable :code:`t` is of kind :code:`Type`, :code:`Tensor[t, float32]` is not a valid type.
-
-.. *Note: At present, only type parameters of kind :code:`Type` are supported.*
-
-Like normal parameters, concrete arguments must be given for type parameters at call sites.
-
-.. *Note: type parameter syntax is not yet supported in the text format.*
-
-For example, :code:`s` below is a type parameter of kind :code:`Shape` and it will
-be substituted with :code:`(10, 10)` at the call site below:
-
-.. code-block::
-
-   def @plus<s : Shape>(%t1 : Tensor[s, float32], %t2 : Tensor[s, float32]) {
-        add(%t1, %t2)
-   }
-   plus<(10, 10)>(%a, %b)
-
-See :py:class:`~tvm.relay.ty.TypeVar` for its definition and documentation.
-
-Type Constraint
-===============
-
-This is an abstract class representing a type constraint, to be elaborated
-upon in further releases. Currently, type relations are the only
-type constraints provided; they are discussed below.
-
-See :py:class:`~tvm.relay.ty.TypeConstraint` for its definition and documentation.
-
-Function Type
-=============
-
-A function type in Relay, see `tvm/relay/type.h` for more details.
-
-This is the type assigned to functions in Relay. A function type
-consists of a list of type parameters, a set of type constraints,
-a sequence of argument types, and a return type.
-
-We informally write function types as:
-:code:`fn<type_params>(arg_types) -> ret_type where type_constraints`
-
-A type parameter in the function type may appear in the argument
-types or the return types. Additionally, each of the type constraints
-must hold at every call site of the function. The type constraints
-typically take the function's argument types and the function's return
-type as arguments, but may take a subset instead.
-
-See :py:class:`~tvm.relay.ty.FuncType` for its definition and documentation.
-
-.. _type-relation:
-
-Type Relation
-=============
-
-A type relation is the most complex type system feature in Relay.
-It allows users to extend type inference with new rules.
-We use type relations to define types for operators that work with
-tensor shapes in complex ways, such as broadcasting operators or
-:code:`flatten`, allowing Relay to statically reason about the shapes
-in these cases.
-
-A type relation :code:`R` describes a relationship between the input and output types of a Relay function.
-Namely, :code:`R` is a function on types that
-outputs `true` if the relationship holds and `false`
-if it fails to hold. Types given to a relation may be incomplete or
-include shape variables, so type inference must assign appropriate
-values to incomplete types and shape variables for necessary relations
-to hold, if such values exist.
-
-For example we can define an identity relation to be:
-
-.. code-block:: prolog
-
-    Identity(I, I) :- true
-
-It is usually convenient to type operators
-in Relay by defining a relation specific to that operator that
-encodes all the necessary constraints on the argument types
-and the return type. For example, we can define the relation for :code:`flatten`:
-
-.. code-block:: prolog
-
-    Flatten(Tensor(sh, bt), O) :-
-      O = Tensor(sh[0], prod(sh[1:]))
-
-If we have a relation like :code:`Broadcast` it becomes possible
-to type operators like :code:`add`:
-
-.. code-block::
-
-    add : fn<t1 : Type, t2 : Type, t3 : Type>(t1, t2) -> t3
-                where Broadcast
-
-The inclusion of :code:`Broadcast` above indicates that the argument
-types and the return type must be tensors where the shape of :code:`t3` is
-the broadcast of the shapes of :code:`t1` and :code:`t2`. The type system will
-accept any argument types and return type so long as they fulfill
-:code:`Broadcast`.
-
-Note that the above example relations are written in Prolog-like syntax,
-but currently the relations must be implemented by users in C++
-or Python. More specifically, Relay's type system uses an *ad hoc* solver
-for type relations in which type relations are actually implemented as
-C++ or Python functions that check whether the relation holds and
-imperatively update any shape variables or incomplete types. In the current
-implementation, the functions implementing relations should return :code:`False`
-if the relation fails to hold and :code:`True` if the relation holds or if
-there is not enough information to determine whether it holds or not.
-
-The functions for all the relations are run as needed (if an input is updated)
-until one of the following conditions holds:
-
-1. All relations hold and no incomplete types remain (typechecking succeeds).
-2. A relation fails to hold (a type error).
-3. A fixpoint is reached where shape variables or incomplete types remain (either a type error or more type annotations may be needed).
-
-Presently all of the relations used in Relay are implemented in C++.
-See the files in :code:`src/relay/op` for examples of relations implemented
-in C++.
-
-See :py:class:`~tvm.relay.ty.TypeRelation` for its definition and documentation.
-
-Incomplete Type
-===============
-
-An incomplete type is a type or portion of a type that is not yet known.
-This is only used during type inference. Any omitted type annotation is
-replaced by an incomplete type, which will be replaced by another
-type at a later point.
-
-Incomplete types are known as "type variables" or "type holes" in the programming languages
-literature. We use the name "incomplete type" in order to more clearly distinguish them from type
-parameters: Type parameters must be bound to a function and are replaced with concrete type arguments (instantiated)
-at call sites, whereas incomplete types may appear anywhere in the program and are filled in during type inference.
-
-See :py:class:`~tvm.relay.ty.IncompleteType` for its definition and documentation.
-
-.. _adt-typing:
-
-Algebraic Data Types
-====================
-
-*Note: ADTs are not currently supported in the text format.*
-
-Algebraic data types (ADTs) are described in more detail in
-:ref:`their overview <adt-overview>`; this section describes
-their implementation in the type system.
-
-An ADT is defined by a collection of named constructors,
-each of which takes arguments of certain types.
-An instance of an ADT is a container that stores the values
-of the constructor arguments used to produce it as well as the
-name of the constructor; the values can be retrieved by
-deconstructing the instance by matching based on its constructor.
-Hence, ADTs are sometimes called "tagged unions": like a C-style
-union, the contents of an instance for a given ADT may have
-different types in certain cases, but the constructor serves as a
-tag to indicate how to interpret the contents.
-
-From the type system's perspective, it is most pertinent that
-ADTs can take type parameters (constructor arguments can be
-type parameters, though ADT instances with different type
-parameters must be treated as different types) and be
-recursive (a constructor for an ADT can take an instance of
-that ADT, thus an ADT like a tree or list can be inductively
-built up). The representation of ADTs in the type system must
-be able to accommodate these facts, as the below sections will detail.
-
-Global Type Variable
-~~~~~~~~~~~~~~~~~~~~
-
-To represent ADTs compactly and easily allow for recursive ADT definitions,
-an ADT definition is given a handle in the form of a global type variable
-that uniquely identifies it. Each ADT definition is given a fresh global
-type variable as a handle, so pointer equality can be used to distinguish
-different ADT names.
-
-For the purposes of Relay's type system, ADTs are differentiated by name;
-that means that if two ADTs have different handles, they will be
-considered different types even if all their constructors are
-structurally identical.
-
-Recursion in an ADT definition thus follows just like recursion for a
-global function: the constructor can simply reference the ADT handle
-(global type variable) in its definition.
-
-See :py:class:`~tvm.relay.ty.GlobalTypeVar` for its definition and documentation.
-
-Definitions (Type Data)
-~~~~~~~~~~~~~~~~~~~~~~~
-
-Besides a name, an ADT needs to store the constructors that are used
-to define it and any type parameters used within them. These are
-stored in the module, :ref:`analogous to global function definitions<module-description>`.
-
-While type-checking uses of ADTs, the type system sometimes must
-index into the module using the ADT name to look up information
-about constructors. For example, if a constructor is being pattern-matched
-in a match expression clause, the type-checker must check the constructor's
-signature to ensure that any bound variables are being assigned the
-correct types.
-
-See :py:class:`~tvm.relay.adt.TypeData` for its definition and documentation.
-
-Type Call
-~~~~~~~~~
-
-Because an ADT definition can take type parameters, Relay's type
-system considers an ADT definition to be a *type-level function*
-(in that the definition takes type parameters and returns the
-type of an ADT instance with those type parameters). Thus, any
-instance of an ADT is typed using a type call, which explicitly
-lists the type parameters given to the ADT definition.
-
-It is important to list the type parameters for an ADT instance,
-as two ADT instances built using different constructors but the
-same type parameters are of the *same type* while two ADT instances
-with different type parameters should not be considered the same
-type (e.g., a list of integers should not have the same type as
-a list of pairs of floating point tensors).
-
-The "function" in the type call is the ADT handle and there must
-be one argument for each type parameter in the ADT definition. (An
-ADT definition with no arguments means that any instance will have
-no type arguments passed to the type call).
-
-See :py:class:`~tvm.relay.ty.TypeCall` for its definition and documentation.
-
-Example: List ADT
-~~~~~~~~~~~~~~~~~
-
-This subsection uses the simple list ADT (included as a default
-ADT in Relay) to illustrate the constructs described in the previous
-sections. Its definition is as follows:
-
-.. code-block::
-
-   data List<a> {
-     Nil : () -> List
-     Cons : (a, List[a]) -> List
-   }
-
-Thus, the global type variable :code:`List` is the handle for the ADT.
-The type data for the list ADT in the module notes that
-:code:`List` takes one type parameter and has two constructors,
-:code:`Nil` (with signature :code:`fn<a>() -> List[a]`)
-and :code:`Cons` (with signature :code:`fn<a>(a, List[a]) -> List[a]`).
-The recursive reference to :code:`List` in the :code:`Cons`
-constructor is accomplished by using the global type
-variable :code:`List` in the constructor definition.
-
-Below two instances of lists with their types given, using type calls:
-
-.. code-block::
-
-   Cons(1, Cons(2, Nil())) # List[Tensor[(), int32]]
-   Cons((1, 1), Cons((2, 2), Nil())) # List[(Tensor[(), int32], Tensor[(), int32])]
-
-Note that :code:`Nil()` can be an instance of any list because it
-does not take any arguments that use a type parameter. (Nevertheless,
-for any *particular* instance of :code:`Nil()`, the type parameter must
-be specified.)
-
-Here are two lists that are rejected by the type system because
-the type parameters do not match:
-
-.. code-block::
-
-   # attempting to put an integer on a list of int * int tuples
-   Cons(1, Cons((1, 1), Nil()))
-   # attempting to put a list of ints on a list of lists of int * int tuples
-   Cons(Cons(1, Cons(2, Nil())), Cons(Cons((1, 1), Cons((2, 2), Nil())), Nil()))
diff --git a/gallery/how_to/compile_models/README.txt b/gallery/how_to/compile_models/README.txt
deleted file mode 100644
index 61cc5be2cb..0000000000
--- a/gallery/how_to/compile_models/README.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-.. _tutorial-frontend:
-
-Compile Deep Learning Models
-============================
-
-TVM includes a variety of front-ends that can import models in different
-formats. These how-tos demostrate how to import models using the Python API.
diff --git a/gallery/how_to/compile_models/from_coreml.py b/gallery/how_to/compile_models/from_coreml.py
deleted file mode 100644
index b54329920b..0000000000
--- a/gallery/how_to/compile_models/from_coreml.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-"""
-Compile CoreML Models
-=====================
-**Author**: `Joshua Z. Zhang <https://zhreshold.github.io/>`_, \
-            `Kazutaka Morita <https://github.com/kazum>`_, \
-            `Zhao Wu <https://github.com/FrozenGene>`_
-
-This article is an introductory tutorial to deploy CoreML models with Relay.
-
-To begin, we must install coremltools:
-
-.. code-block:: bash
-
-    %%shell
-    pip install coremltools
-
-or please refer to official site
-https://github.com/apple/coremltools
-"""
-
-import tvm
-from tvm import te
-import tvm.relay as relay
-from tvm.contrib.download import download_testdata
-import coremltools as cm
-import numpy as np
-from PIL import Image
-
-######################################################################
-# Load pretrained CoreML model
-# ----------------------------
-# We will download and load a pretrained mobilenet classification network
-# provided by apple in this example
-model_url = "https://docs-assets.developer.apple.com/coreml/models/MobileNet.mlmodel"
-model_file = "mobilenet.mlmodel"
-model_path = download_testdata(model_url, model_file, module="coreml")
-# Now you have mobilenet.mlmodel on disk
-mlmodel = cm.models.MLModel(model_path)
-
-######################################################################
-# Load a test image
-# ------------------
-# A single cat dominates the examples!
-img_url = "https://github.com/dmlc/mxnet.js/blob/main/data/cat.png?raw=true"
-img_path = download_testdata(img_url, "cat.png", module="data")
-img = Image.open(img_path).resize((224, 224))
-# Mobilenet.mlmodel's input is BGR format
-img_bgr = np.array(img)[:, :, ::-1]
-x = np.transpose(img_bgr, (2, 0, 1))[np.newaxis, :]
-
-######################################################################
-# Compile the model on Relay
-# ---------------------------
-# We should be familiar with the process right now.
-target = "llvm"
-shape_dict = {"image": x.shape}
-
-# Parse CoreML model and convert into Relay computation graph
-mod, params = relay.frontend.from_coreml(mlmodel, shape_dict)
-
-with tvm.transform.PassContext(opt_level=3):
-    lib = relay.build(mod, target, params=params)
-
-######################################################################
-# Execute on TVM
-# -------------------
-# The process is no different from other example
-from tvm.contrib import graph_executor
-
-dev = tvm.cpu(0)
-dtype = "float32"
-m = graph_executor.GraphModule(lib["default"](dev))
-# set inputs
-m.set_input("image", tvm.nd.array(x.astype(dtype)))
-# execute
-m.run()
-# get outputs
-tvm_output = m.get_output(0)
-top1 = np.argmax(tvm_output.numpy()[0])
-
-#####################################################################
-# Look up synset name
-# -------------------
-# Look up prediction top 1 index in 1000 class synset.
-synset_url = "".join(
-    [
-        "https://gist.githubusercontent.com/zhreshold/",
-        "4d0b62f3d01426887599d4f7ede23ee5/raw/",
-        "596b27d23537e5a1b5751d2b0481ef172f58b539/",
-        "imagenet1000_clsid_to_human.txt",
-    ]
-)
-synset_name = "imagenet1000_clsid_to_human.txt"
-synset_path = download_testdata(synset_url, synset_name, module="data")
-with open(synset_path) as f:
-    synset = eval(f.read())
-# You should see the following result: Top-1 id 282 class name tiger cat
-print("Top-1 id", top1, "class name", synset[top1])
diff --git a/gallery/how_to/compile_models/from_darknet.py b/gallery/how_to/compile_models/from_darknet.py
deleted file mode 100644
index ef0a858377..0000000000
--- a/gallery/how_to/compile_models/from_darknet.py
+++ /dev/null
@@ -1,203 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-"""
-Compile YOLO-V2 and YOLO-V3 in DarkNet Models
-=============================================
-**Author**: `Siju Samuel <https://siju-samuel.github.io/>`_
-
-This article is an introductory tutorial to deploy darknet models with TVM.
-All the required models and libraries will be downloaded from the internet by the script.
-This script runs the YOLO-V2 and YOLO-V3 Model with the bounding boxes
-Darknet parsing have dependancy with CFFI and CV2 library
-Please install CFFI and CV2 before executing this script
-
-.. code-block:: bash
-
-  %%shell
-  pip install cffi opencv-python
-
-"""
-
-# numpy and matplotlib
-import numpy as np
-import matplotlib.pyplot as plt
-import sys
-
-# tvm, relay
-import tvm
-from tvm import te
-from tvm import relay
-from ctypes import *
-from tvm.contrib.download import download_testdata
-from tvm.relay.testing.darknet import __darknetffi__
-import tvm.relay.testing.yolo_detection
-import tvm.relay.testing.darknet
-
-######################################################################
-# Choose the model
-# -----------------------
-# Models are: 'yolov2', 'yolov3' or 'yolov3-tiny'
-
-# Model name
-MODEL_NAME = "yolov3"
-
-######################################################################
-# Download required files
-# -----------------------
-# Download cfg and weights file if first time.
-CFG_NAME = MODEL_NAME + ".cfg"
-WEIGHTS_NAME = MODEL_NAME + ".weights"
-REPO_URL = "https://github.com/dmlc/web-data/blob/main/darknet/"
-CFG_URL = REPO_URL + "cfg/" + CFG_NAME + "?raw=true"
-WEIGHTS_URL = "https://pjreddie.com/media/files/" + WEIGHTS_NAME
-
-cfg_path = download_testdata(CFG_URL, CFG_NAME, module="darknet")
-weights_path = download_testdata(WEIGHTS_URL, WEIGHTS_NAME, module="darknet")
-
-# Download and Load darknet library
-if sys.platform in ["linux", "linux2"]:
-    DARKNET_LIB = "libdarknet2.0.so"
-    DARKNET_URL = REPO_URL + "lib/" + DARKNET_LIB + "?raw=true"
-elif sys.platform == "darwin":
-    DARKNET_LIB = "libdarknet_mac2.0.so"
-    DARKNET_URL = REPO_URL + "lib_osx/" + DARKNET_LIB + "?raw=true"
-else:
-    err = "Darknet lib is not supported on {} platform".format(sys.platform)
-    raise NotImplementedError(err)
-
-lib_path = download_testdata(DARKNET_URL, DARKNET_LIB, module="darknet")
-
-DARKNET_LIB = __darknetffi__.dlopen(lib_path)
-net = DARKNET_LIB.load_network(cfg_path.encode("utf-8"), weights_path.encode("utf-8"), 0)
-dtype = "float32"
-batch_size = 1
-
-data = np.empty([batch_size, net.c, net.h, net.w], dtype)
-shape_dict = {"data": data.shape}
-print("Converting darknet to relay functions...")
-mod, params = relay.frontend.from_darknet(net, dtype=dtype, shape=data.shape)
-
-######################################################################
-# Import the graph to Relay
-# -------------------------
-# compile the model
-target = tvm.target.Target("llvm", host="llvm")
-dev = tvm.cpu(0)
-data = np.empty([batch_size, net.c, net.h, net.w], dtype)
-shape = {"data": data.shape}
-print("Compiling the model...")
-with tvm.transform.PassContext(opt_level=3):
-    lib = relay.build(mod, target=target, params=params)
-
-[neth, netw] = shape["data"][2:]  # Current image shape is 608x608
-######################################################################
-# Load a test image
-# -----------------
-test_image = "dog.jpg"
-print("Loading the test image...")
-img_url = REPO_URL + "data/" + test_image + "?raw=true"
-img_path = download_testdata(img_url, test_image, "data")
-
-data = tvm.relay.testing.darknet.load_image(img_path, netw, neth)
-######################################################################
-# Execute on TVM Runtime
-# ----------------------
-# The process is no different from other examples.
-from tvm.contrib import graph_executor
-
-m = graph_executor.GraphModule(lib["default"](dev))
-
-# set inputs
-m.set_input("data", tvm.nd.array(data.astype(dtype)))
-# execute
-print("Running the test image...")
-
-# detection
-# thresholds
-thresh = 0.5
-nms_thresh = 0.45
-
-m.run()
-# get outputs
-tvm_out = []
-if MODEL_NAME == "yolov2":
-    layer_out = {}
-    layer_out["type"] = "Region"
-    # Get the region layer attributes (n, out_c, out_h, out_w, classes, coords, background)
-    layer_attr = m.get_output(2).numpy()
-    layer_out["biases"] = m.get_output(1).numpy()
-    out_shape = (layer_attr[0], layer_attr[1] // layer_attr[0], layer_attr[2], layer_attr[3])
-    layer_out["output"] = m.get_output(0).numpy().reshape(out_shape)
-    layer_out["classes"] = layer_attr[4]
-    layer_out["coords"] = layer_attr[5]
-    layer_out["background"] = layer_attr[6]
-    tvm_out.append(layer_out)
-
-elif MODEL_NAME == "yolov3":
-    for i in range(3):
-        layer_out = {}
-        layer_out["type"] = "Yolo"
-        # Get the yolo layer attributes (n, out_c, out_h, out_w, classes, total)
-        layer_attr = m.get_output(i * 4 + 3).numpy()
-        layer_out["biases"] = m.get_output(i * 4 + 2).numpy()
-        layer_out["mask"] = m.get_output(i * 4 + 1).numpy()
-        out_shape = (layer_attr[0], layer_attr[1] // layer_attr[0], layer_attr[2], layer_attr[3])
-        layer_out["output"] = m.get_output(i * 4).numpy().reshape(out_shape)
-        layer_out["classes"] = layer_attr[4]
-        tvm_out.append(layer_out)
-
-elif MODEL_NAME == "yolov3-tiny":
-    for i in range(2):
-        layer_out = {}
-        layer_out["type"] = "Yolo"
-        # Get the yolo layer attributes (n, out_c, out_h, out_w, classes, total)
-        layer_attr = m.get_output(i * 4 + 3).numpy()
-        layer_out["biases"] = m.get_output(i * 4 + 2).numpy()
-        layer_out["mask"] = m.get_output(i * 4 + 1).numpy()
-        out_shape = (layer_attr[0], layer_attr[1] // layer_attr[0], layer_attr[2], layer_attr[3])
-        layer_out["output"] = m.get_output(i * 4).numpy().reshape(out_shape)
-        layer_out["classes"] = layer_attr[4]
-        tvm_out.append(layer_out)
-        thresh = 0.560
-
-# do the detection and bring up the bounding boxes
-img = tvm.relay.testing.darknet.load_image_color(img_path)
-_, im_h, im_w = img.shape
-dets = tvm.relay.testing.yolo_detection.fill_network_boxes(
-    (netw, neth), (im_w, im_h), thresh, 1, tvm_out
-)
-last_layer = net.layers[net.n - 1]
-tvm.relay.testing.yolo_detection.do_nms_sort(dets, last_layer.classes, nms_thresh)
-
-coco_name = "coco.names"
-coco_url = REPO_URL + "data/" + coco_name + "?raw=true"
-font_name = "arial.ttf"
-font_url = REPO_URL + "data/" + font_name + "?raw=true"
-coco_path = download_testdata(coco_url, coco_name, module="data")
-font_path = download_testdata(font_url, font_name, module="data")
-
-with open(coco_path) as f:
-    content = f.readlines()
-
-names = [x.strip() for x in content]
-
-tvm.relay.testing.yolo_detection.show_detections(img, dets, thresh, names, last_layer.classes)
-tvm.relay.testing.yolo_detection.draw_detections(
-    font_path, img, dets, thresh, names, last_layer.classes
-)
-plt.imshow(img.transpose(1, 2, 0))
-plt.show()
diff --git a/gallery/how_to/compile_models/from_keras.py b/gallery/how_to/compile_models/from_keras.py
deleted file mode 100644
index 3da674c250..0000000000
--- a/gallery/how_to/compile_models/from_keras.py
+++ /dev/null
@@ -1,141 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-"""
-Compile Keras Models
-=====================
-**Author**: `Yuwei Hu <https://Huyuwei.github.io/>`_
-
-This article is an introductory tutorial to deploy Keras models with Relay.
-
-For us to begin with, keras should be installed.
-Tensorflow is also required since it's used as the default backend of keras.
-
-A quick solution is to install via pip
-
-.. code-block:: bash
-
-    %%shell
-    pip install keras tensorflow
-
-or please refer to official site
-https://keras.io/#installation
-"""
-
-# sphinx_gallery_start_ignore
-# sphinx_gallery_requires_cuda = True
-# sphinx_gallery_end_ignore
-import tvm
-from tvm import te
-import tvm.relay as relay
-from tvm.contrib.download import download_testdata
-import keras
-import tensorflow as tf
-import numpy as np
-
-######################################################################
-# Load pretrained keras model
-# ----------------------------
-# We load a pretrained resnet-50 classification model provided by keras.
-
-if tuple(keras.__version__.split(".")) < ("2", "4", "0"):
-    weights_url = "".join(
-        [
-            "https://github.com/fchollet/deep-learning-models/releases/",
-            "download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5",
-        ]
-    )
-    weights_file = "resnet50_keras_old.h5"
-else:
-    weights_url = "".join(
-        [
-            " https://storage.googleapis.com/tensorflow/keras-applications/",
-            "resnet/resnet50_weights_tf_dim_ordering_tf_kernels.h5",
-        ]
-    )
-    weights_file = "resnet50_keras_new.h5"
-
-
-weights_path = download_testdata(weights_url, weights_file, module="keras")
-keras_resnet50 = tf.keras.applications.resnet50.ResNet50(
-    include_top=True, weights=None, input_shape=(224, 224, 3), classes=1000
-)
-keras_resnet50.load_weights(weights_path)
-
-######################################################################
-# Load a test image
-# ------------------
-# A single cat dominates the examples!
-from PIL import Image
-from matplotlib import pyplot as plt
-from tensorflow.keras.applications.resnet50 import preprocess_input
-
-img_url = "https://github.com/dmlc/mxnet.js/blob/main/data/cat.png?raw=true"
-img_path = download_testdata(img_url, "cat.png", module="data")
-img = Image.open(img_path).resize((224, 224))
-plt.imshow(img)
-plt.show()
-# input preprocess
-data = np.array(img)[np.newaxis, :].astype("float32")
-data = preprocess_input(data).transpose([0, 3, 1, 2])
-print("input_1", data.shape)
-
-######################################################################
-# Compile the model with Relay
-# ----------------------------
-# convert the keras model(NHWC layout) to Relay format(NCHW layout).
-shape_dict = {"input_1": data.shape}
-mod, params = relay.frontend.from_keras(keras_resnet50, shape_dict)
-# compile the model
-target = "cuda"
-dev = tvm.cuda(0)
-
-# TODO(mbs): opt_level=3 causes nn.contrib_conv2d_winograd_weight_transform
-# to end up in the module which fails memory validation on cuda most likely
-# due to a latent bug. Note that the pass context only has an effect within
-# evaluate() and is not captured by create_executor().
-with tvm.transform.PassContext(opt_level=0):
-    model = relay.build_module.create_executor("graph", mod, dev, target, params).evaluate()
-
-
-######################################################################
-# Execute on TVM
-# ---------------
-dtype = "float32"
-tvm_out = model(tvm.nd.array(data.astype(dtype)))
-top1_tvm = np.argmax(tvm_out.numpy()[0])
-
-#####################################################################
-# Look up synset name
-# -------------------
-# Look up prediction top 1 index in 1000 class synset.
-synset_url = "".join(
-    [
-        "https://gist.githubusercontent.com/zhreshold/",
-        "4d0b62f3d01426887599d4f7ede23ee5/raw/",
-        "596b27d23537e5a1b5751d2b0481ef172f58b539/",
-        "imagenet1000_clsid_to_human.txt",
-    ]
-)
-synset_name = "imagenet1000_clsid_to_human.txt"
-synset_path = download_testdata(synset_url, synset_name, module="data")
-with open(synset_path) as f:
-    synset = eval(f.read())
-print("Relay top-1 id: {}, class name: {}".format(top1_tvm, synset[top1_tvm]))
-# confirm correctness with keras output
-keras_out = keras_resnet50.predict(data.transpose([0, 2, 3, 1]))
-top1_keras = np.argmax(keras_out)
-print("Keras top-1 id: {}, class name: {}".format(top1_keras, synset[top1_keras]))
diff --git a/gallery/how_to/compile_models/from_onnx.py b/gallery/how_to/compile_models/from_onnx.py
deleted file mode 100644
index c1f9be72c5..0000000000
--- a/gallery/how_to/compile_models/from_onnx.py
+++ /dev/null
@@ -1,135 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-"""
-Compile ONNX Models
-===================
-**Author**: `Joshua Z. Zhang <https://zhreshold.github.io/>`_
-
-This article is an introductory tutorial to deploy ONNX models with Relay.
-
-To begin, install the ONNX package:
-
-.. code-block:: bash
-
-    %%shell
-    pip install onnx onnxoptimizer
-
-Alternatively, you can refer to official site:
-https://github.com/onnx/onnx
-"""
-
-import onnx
-import numpy as np
-import tvm
-from tvm import te
-import tvm.relay as relay
-from tvm.contrib.download import download_testdata
-
-######################################################################
-# Load pretrained ONNX model
-# ---------------------------------------------
-# The example super resolution model used here is exactly the same model in onnx tutorial
-# http://pytorch.org/tutorials/advanced/super_resolution_with_caffe2.html
-# we skip the pytorch model construction part, and download the saved onnx model
-model_url = "".join(
-    [
-        "https://gist.github.com/zhreshold/",
-        "bcda4716699ac97ea44f791c24310193/raw/",
-        "93672b029103648953c4e5ad3ac3aadf346a4cdc/",
-        "super_resolution_0.2.onnx",
-    ]
-)
-model_path = download_testdata(model_url, "super_resolution.onnx", module="onnx")
-# now you have super_resolution.onnx on disk
-onnx_model = onnx.load(model_path)
-
-######################################################################
-# Load a test image
-# ---------------------------------------------
-# A single cat dominates the examples! This model takes a single input image of size
-# 224x224 and outputs a scaled image that is 3x greater than the input along each
-# axis, a 672x672 image. Re-scale the cat image to fit this input shape then
-# convert to `YCbCr`. The super resolution model will then be applied to the
-# luminance (`Y`) channel.
-from PIL import Image
-
-img_url = "https://github.com/dmlc/mxnet.js/blob/main/data/cat.png?raw=true"
-img_path = download_testdata(img_url, "cat.png", module="data")
-img = Image.open(img_path).resize((224, 224))
-img_ycbcr = img.convert("YCbCr")  # convert to YCbCr
-img_y, img_cb, img_cr = img_ycbcr.split()
-x = np.array(img_y)[np.newaxis, np.newaxis, :, :]
-
-######################################################################
-# Compile the model with relay
-# ---------------------------------------------
-# Typically ONNX models mix model input values with parameter values, with
-# the input having the name `1`. This model dependent, and you should check
-# with the documentation for your model to determine the full input and
-# parameter name space.
-#
-# Passing in the shape dictionary to the `relay.frontend.from_onnx` method
-# tells relay which ONNX parameters are inputs, and which are parameters, and
-# provides a static definition of the input size.
-target = "llvm"
-
-input_name = "1"
-shape_dict = {input_name: x.shape}
-mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
-
-with tvm.transform.PassContext(opt_level=1):
-    executor = relay.build_module.create_executor(
-        "graph", mod, tvm.cpu(0), target, params
-    ).evaluate()
-
-######################################################################
-# Execute on TVM
-# ---------------------------------------------
-dtype = "float32"
-tvm_output = executor(tvm.nd.array(x.astype(dtype))).numpy()
-
-######################################################################
-# Display results
-# ---------------------------------------------
-# We put input and output image neck to neck. The luminance channel, `Y` is the output
-# from the model. The chroma channels `Cb` and `Cr` are resized to match with a simple
-# bicubic algorithm. The image is then recombined and converted back to `RGB`.
-from matplotlib import pyplot as plt
-
-out_y = Image.fromarray(np.uint8((tvm_output[0, 0]).clip(0, 255)), mode="L")
-out_cb = img_cb.resize(out_y.size, Image.BICUBIC)
-out_cr = img_cr.resize(out_y.size, Image.BICUBIC)
-result = Image.merge("YCbCr", [out_y, out_cb, out_cr]).convert("RGB")
-canvas = np.full((672, 672 * 2, 3), 255)
-canvas[0:224, 0:224, :] = np.asarray(img)
-canvas[:, 672:, :] = np.asarray(result)
-plt.imshow(canvas.astype(np.uint8))
-plt.show()
-
-######################################################################
-# Notes
-# ---------------------------------------------
-# By default, ONNX defines models in terms of dynamic shapes. The ONNX importer
-# retains that dynamism upon import, and the compiler attempts to convert the model
-# into a static shapes at compile time. If this fails, there may still be dynamic
-# operations in the model. Not all TVM kernels currently support dynamic shapes,
-# please file an issue on discuss.tvm.apache.org if you hit an error with dynamic kernels.
-#
-# This particular model was build using an older version of ONNX. During the import
-# phase ONNX importer will run the ONNX verifier, which may throw a `Mismatched attribute type`
-# warning. Because TVM supports a number of different ONNX versions, the Relay model
-# will still be valid.
diff --git a/gallery/how_to/compile_models/from_paddle.py b/gallery/how_to/compile_models/from_paddle.py
deleted file mode 100644
index 5e78c8c3b0..0000000000
--- a/gallery/how_to/compile_models/from_paddle.py
+++ /dev/null
@@ -1,118 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-"""
-Compile PaddlePaddle Models
-===========================
-**Author**: `Ziyuan Ma <https://github.com/ZiyuanMa/>`_
-
-This article is an introductory tutorial to deploy PaddlePaddle models with Relay.
-To begin, we'll install PaddlePaddle>=2.1.3:
-
-.. code-block:: bash
-
-    %%shell
-    pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
-
-For more details, refer to the official install instructions at:
-https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html
-"""
-
-import tarfile
-import paddle
-import numpy as np
-import tvm
-from tvm import relay
-from tvm.contrib.download import download_testdata
-
-######################################################################
-# Load pretrained ResNet50 model
-# ---------------------------------------------
-# We load a pretrained ResNet50 provided by PaddlePaddle.
-url = "https://bj.bcebos.com/x2paddle/models/paddle_resnet50.tar"
-model_path = download_testdata(url, "paddle_resnet50.tar", module="model")
-
-with tarfile.open(model_path) as tar:
-    names = tar.getnames()
-    for name in names:
-        tar.extract(name, "./")
-
-model = paddle.jit.load("./paddle_resnet50/model")
-
-######################################################################
-# Load a test image
-# ---------------------------------------------
-# A single cat dominates the examples!
-
-from PIL import Image
-import paddle.vision.transforms as T
-
-
-transforms = T.Compose(
-    [
-        T.Resize((256, 256)),
-        T.CenterCrop(224),
-        T.ToTensor(),
-        T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
-    ]
-)
-
-img_url = "https://github.com/dmlc/mxnet.js/blob/main/data/cat.png?raw=true"
-img_path = download_testdata(img_url, "cat.png", module="data")
-img = Image.open(img_path).resize((224, 224))
-
-img = transforms(img)
-img = np.expand_dims(img, axis=0)
-
-######################################################################
-# Compile the model with relay
-# ---------------------------------------------
-
-target = "llvm"
-shape_dict = {"inputs": img.shape}
-mod, params = relay.frontend.from_paddle(model, shape_dict)
-
-with tvm.transform.PassContext(opt_level=3):
-    executor = relay.build_module.create_executor(
-        "graph", mod, tvm.cpu(0), target, params
-    ).evaluate()
-
-######################################################################
-# Execute on TVM
-# ---------------------------------------------
-dtype = "float32"
-tvm_output = executor(tvm.nd.array(img.astype(dtype))).numpy()
-
-######################################################################
-# Look up synset name
-# ---------------------------------------------
-# Look up prediction top 1 index in 1000 class synset.
-
-synset_url = "".join(
-    [
-        "https://gist.githubusercontent.com/zhreshold/",
-        "4d0b62f3d01426887599d4f7ede23ee5/raw/",
-        "596b27d23537e5a1b5751d2b0481ef172f58b539/",
-        "imagenet1000_clsid_to_human.txt",
-    ]
-)
-synset_name = "imagenet1000_clsid_to_human.txt"
-synset_path = download_testdata(synset_url, synset_name, module="data")
-with open(synset_path) as f:
-    synset = f.readlines()
-
-top1 = np.argmax(tvm_output[0])
-print(f"TVM prediction top-1 id: {top1}, class name: {synset[top1]}")
diff --git a/gallery/how_to/compile_models/from_pytorch.py b/gallery/how_to/compile_models/from_pytorch.py
deleted file mode 100644
index 14c264b9f4..0000000000
--- a/gallery/how_to/compile_models/from_pytorch.py
+++ /dev/null
@@ -1,171 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-"""
-Compile PyTorch Models
-======================
-**Author**: `Alex Wong <https://github.com/alexwong/>`_
-
-This article is an introductory tutorial to deploy PyTorch models with Relay.
-
-For us to begin, PyTorch should be installed.
-TorchVision is also required so we can use the model zoo.
-A quick solution is to install via pip:
-
-.. code-block:: bash
-
-    %%shell
-    pip install torch
-    pip install torchvision
-
-or please refer to official site
-https://pytorch.org/get-started/locally/
-
-PyTorch versions should be backwards compatible but should be used
-with the proper TorchVision version.
-
-Currently, TVM supports PyTorch 1.7 and 1.4. Other versions may
-be unstable.
-"""
-
-import tvm
-from tvm import relay
-
-import numpy as np
-
-from tvm.contrib.download import download_testdata
-
-# PyTorch imports
-import torch
-import torchvision
-
-######################################################################
-# Load a pretrained PyTorch model
-# -------------------------------
-model_name = "resnet18"
-model = getattr(torchvision.models, model_name)(pretrained=True)
-model = model.eval()
-
-# We grab the TorchScripted model via tracing
-input_shape = [1, 3, 224, 224]
-input_data = torch.randn(input_shape)
-scripted_model = torch.jit.trace(model, input_data).eval()
-
-######################################################################
-# Load a test image
-# -----------------
-# Classic cat example!
-from PIL import Image
-
-img_url = "https://github.com/dmlc/mxnet.js/blob/main/data/cat.png?raw=true"
-img_path = download_testdata(img_url, "cat.png", module="data")
-img = Image.open(img_path).resize((224, 224))
-
-# Preprocess the image and convert to tensor
-from torchvision import transforms
-
-my_preprocess = transforms.Compose(
-    [
-        transforms.Resize(256),
-        transforms.CenterCrop(224),
-        transforms.ToTensor(),
-        transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
-    ]
-)
-img = my_preprocess(img)
-img = np.expand_dims(img, 0)
-
-######################################################################
-# Import the graph to Relay
-# -------------------------
-# Convert PyTorch graph to Relay graph. The input name can be arbitrary.
-input_name = "input0"
-shape_list = [(input_name, img.shape)]
-mod, params = relay.frontend.from_pytorch(scripted_model, shape_list)
-
-######################################################################
-# Relay Build
-# -----------
-# Compile the graph to llvm target with given input specification.
-target = tvm.target.Target("llvm", host="llvm")
-dev = tvm.cpu(0)
-with tvm.transform.PassContext(opt_level=3):
-    lib = relay.build(mod, target=target, params=params)
-
-######################################################################
-# Execute the portable graph on TVM
-# ---------------------------------
-# Now we can try deploying the compiled model on target.
-from tvm.contrib import graph_executor
-
-dtype = "float32"
-m = graph_executor.GraphModule(lib["default"](dev))
-# Set inputs
-m.set_input(input_name, tvm.nd.array(img.astype(dtype)))
-# Execute
-m.run()
-# Get outputs
-tvm_output = m.get_output(0)
-
-#####################################################################
-# Look up synset name
-# -------------------
-# Look up prediction top 1 index in 1000 class synset.
-synset_url = "".join(
-    [
-        "https://raw.githubusercontent.com/Cadene/",
-        "pretrained-models.pytorch/master/data/",
-        "imagenet_synsets.txt",
-    ]
-)
-synset_name = "imagenet_synsets.txt"
-synset_path = download_testdata(synset_url, synset_name, module="data")
-with open(synset_path) as f:
-    synsets = f.readlines()
-
-synsets = [x.strip() for x in synsets]
-splits = [line.split(" ") for line in synsets]
-key_to_classname = {spl[0]: " ".join(spl[1:]) for spl in splits}
-
-class_url = "".join(
-    [
-        "https://raw.githubusercontent.com/Cadene/",
-        "pretrained-models.pytorch/master/data/",
-        "imagenet_classes.txt",
-    ]
-)
-class_name = "imagenet_classes.txt"
-class_path = download_testdata(class_url, class_name, module="data")
-with open(class_path) as f:
-    class_id_to_key = f.readlines()
-
-class_id_to_key = [x.strip() for x in class_id_to_key]
-
-# Get top-1 result for TVM
-top1_tvm = np.argmax(tvm_output.numpy()[0])
-tvm_class_key = class_id_to_key[top1_tvm]
-
-# Convert input to PyTorch variable and get PyTorch result for comparison
-with torch.no_grad():
-    torch_img = torch.from_numpy(img)
-    output = model(torch_img)
-
-    # Get top-1 result for PyTorch
-    top1_torch = np.argmax(output.numpy())
-    torch_class_key = class_id_to_key[top1_torch]
-
-print("Relay top-1 id: {}, class name: {}".format(top1_tvm, key_to_classname[tvm_class_key]))
-print("Torch top-1 id: {}, class name: {}".format(top1_torch, key_to_classname[torch_class_key]))
diff --git a/gallery/how_to/compile_models/from_tensorflow.py b/gallery/how_to/compile_models/from_tensorflow.py
deleted file mode 100644
index 741d981094..0000000000
--- a/gallery/how_to/compile_models/from_tensorflow.py
+++ /dev/null
@@ -1,257 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-"""
-Compile Tensorflow Models
-=========================
-This article is an introductory tutorial to deploy tensorflow models with TVM.
-
-For us to begin with, tensorflow python module is required to be installed.
-
-.. code-block:: bash
-
-    %%shell
-    pip install tensorflow
-
-Please refer to https://www.tensorflow.org/install
-"""
-
-# tvm, relay
-import tvm
-from tvm import te
-from tvm import relay
-
-# os and numpy
-import numpy as np
-import os.path
-
-# Tensorflow imports
-import tensorflow as tf
-
-
-# Ask tensorflow to limit its GPU memory to what's actually needed
-# instead of gobbling everything that's available.
-# https://www.tensorflow.org/guide/gpu#limiting_gpu_memory_growth
-# This way this tutorial is a little more friendly to sphinx-gallery.
-gpus = tf.config.list_physical_devices("GPU")
-if gpus:
-    try:
-        for gpu in gpus:
-            tf.config.experimental.set_memory_growth(gpu, True)
-        print("tensorflow will use experimental.set_memory_growth(True)")
-    except RuntimeError as e:
-        print("experimental.set_memory_growth option is not available: {}".format(e))
-
-
-try:
-    tf_compat_v1 = tf.compat.v1
-except ImportError:
-    tf_compat_v1 = tf
-
-# Tensorflow utility functions
-import tvm.relay.testing.tf as tf_testing
-
-# Base location for model related files.
-repo_base = "https://github.com/dmlc/web-data/raw/main/tensorflow/models/InceptionV1/"
-
-# Test image
-img_name = "elephant-299.jpg"
-image_url = os.path.join(repo_base, img_name)
-
-######################################################################
-# Tutorials
-# ---------
-# Please refer docs/frontend/tensorflow.md for more details for various models
-# from tensorflow.
-
-model_name = "classify_image_graph_def-with_shapes.pb"
-model_url = os.path.join(repo_base, model_name)
-
-# Image label map
-map_proto = "imagenet_2012_challenge_label_map_proto.pbtxt"
-map_proto_url = os.path.join(repo_base, map_proto)
-
-# Human readable text for labels
-label_map = "imagenet_synset_to_human_label_map.txt"
-label_map_url = os.path.join(repo_base, label_map)
-
-# Target settings
-# Use these commented settings to build for cuda.
-# target = tvm.target.Target("cuda", host="llvm")
-# layout = "NCHW"
-# dev = tvm.cuda(0)
-target = tvm.target.Target("llvm", host="llvm")
-layout = None
-dev = tvm.cpu(0)
-
-######################################################################
-# Download required files
-# -----------------------
-# Download files listed above.
-from tvm.contrib.download import download_testdata
-
-img_path = download_testdata(image_url, img_name, module="data")
-model_path = download_testdata(model_url, model_name, module=["tf", "InceptionV1"])
-map_proto_path = download_testdata(map_proto_url, map_proto, module="data")
-label_path = download_testdata(label_map_url, label_map, module="data")
-
-######################################################################
-# Import model
-# ------------
-# Creates tensorflow graph definition from protobuf file.
-
-with tf_compat_v1.gfile.GFile(model_path, "rb") as f:
-    graph_def = tf_compat_v1.GraphDef()
-    graph_def.ParseFromString(f.read())
-    graph = tf.import_graph_def(graph_def, name="")
-    # Call the utility to import the graph definition into default graph.
-    graph_def = tf_testing.ProcessGraphDefParam(graph_def)
-    # Add shapes to the graph.
-    with tf_compat_v1.Session() as sess:
-        graph_def = tf_testing.AddShapesToGraphDef(sess, "softmax")
-
-######################################################################
-# Decode image
-# ------------
-# .. note::
-#
-#   tensorflow frontend import doesn't support preprocessing ops like JpegDecode.
-#   JpegDecode is bypassed (just return source node).
-#   Hence we supply decoded frame to TVM instead.
-#
-
-from PIL import Image
-
-image = Image.open(img_path).resize((299, 299))
-
-x = np.array(image)
-
-######################################################################
-# Import the graph to Relay
-# -------------------------
-# Import tensorflow graph definition to relay frontend.
-#
-# Results:
-#   sym: relay expr for given tensorflow protobuf.
-#   params: params converted from tensorflow params (tensor protobuf).
-shape_dict = {"DecodeJpeg/contents": x.shape}
-dtype_dict = {"DecodeJpeg/contents": "uint8"}
-mod, params = relay.frontend.from_tensorflow(graph_def, layout=layout, shape=shape_dict)
-
-print("Tensorflow protobuf imported to relay frontend.")
-######################################################################
-# Relay Build
-# -----------
-# Compile the graph to llvm target with given input specification.
-#
-# Results:
-#   graph: Final graph after compilation.
-#   params: final params after compilation.
-#   lib: target library which can be deployed on target with TVM runtime.
-
-with tvm.transform.PassContext(opt_level=3):
-    lib = relay.build(mod, target, params=params)
-
-######################################################################
-# Execute the portable graph on TVM
-# ---------------------------------
-# Now we can try deploying the compiled model on target.
-
-from tvm.contrib import graph_executor
-
-dtype = "uint8"
-m = graph_executor.GraphModule(lib["default"](dev))
-# set inputs
-m.set_input("DecodeJpeg/contents", tvm.nd.array(x.astype(dtype)))
-# execute
-m.run()
-# get outputs
-tvm_output = m.get_output(0, tvm.nd.empty(((1, 1008)), "float32"))
-
-######################################################################
-# Process the output
-# ------------------
-# Process the model output to human readable text for InceptionV1.
-predictions = tvm_output.numpy()
-predictions = np.squeeze(predictions)
-
-# Creates node ID --> English string lookup.
-node_lookup = tf_testing.NodeLookup(label_lookup_path=map_proto_path, uid_lookup_path=label_path)
-
-# Print top 5 predictions from TVM output.
-top_k = predictions.argsort()[-5:][::-1]
-for node_id in top_k:
-    human_string = node_lookup.id_to_string(node_id)
-    score = predictions[node_id]
-    print("%s (score = %.5f)" % (human_string, score))
-
-######################################################################
-# Inference on tensorflow
-# -----------------------
-# Run the corresponding model on tensorflow
-
-
-def create_graph():
-    """Creates a graph from saved GraphDef file and returns a saver."""
-    # Creates graph from saved graph_def.pb.
-    with tf_compat_v1.gfile.GFile(model_path, "rb") as f:
-        graph_def = tf_compat_v1.GraphDef()
-        graph_def.ParseFromString(f.read())
-        graph = tf.import_graph_def(graph_def, name="")
-        # Call the utility to import the graph definition into default graph.
-        graph_def = tf_testing.ProcessGraphDefParam(graph_def)
-
-
-def run_inference_on_image(image):
-    """Runs inference on an image.
-
-    Parameters
-    ----------
-    image: String
-        Image file name.
-
-    Returns
-    -------
-        Nothing
-    """
-    if not tf_compat_v1.gfile.Exists(image):
-        tf.logging.fatal("File does not exist %s", image)
-    image_data = tf_compat_v1.gfile.GFile(image, "rb").read()
-
-    # Creates graph from saved GraphDef.
-    create_graph()
-
-    with tf_compat_v1.Session() as sess:
-        softmax_tensor = sess.graph.get_tensor_by_name("softmax:0")
-        predictions = sess.run(softmax_tensor, {"DecodeJpeg/contents:0": image_data})
-
-        predictions = np.squeeze(predictions)
-
-        # Creates node ID --> English string lookup.
-        node_lookup = tf_testing.NodeLookup(
-            label_lookup_path=map_proto_path, uid_lookup_path=label_path
-        )
-
-        # Print top 5 predictions from tensorflow.
-        top_k = predictions.argsort()[-5:][::-1]
-        print("===== TENSORFLOW RESULTS =======")
-        for node_id in top_k:
-            human_string = node_lookup.id_to_string(node_id)
-            score = predictions[node_id]
-            print("%s (score = %.5f)" % (human_string, score))
-
-
-run_inference_on_image(img_path)
diff --git a/gallery/how_to/compile_models/from_tflite.py b/gallery/how_to/compile_models/from_tflite.py
deleted file mode 100644
index 226e67c82e..0000000000
--- a/gallery/how_to/compile_models/from_tflite.py
+++ /dev/null
@@ -1,193 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-"""
-Compile TFLite Models
-=====================
-**Author**: `Zhao Wu <https://github.com/FrozenGene>`_
-
-This article is an introductory tutorial to deploy TFLite models with Relay.
-
-To get started, TFLite package needs to be installed as prerequisite.
-
-.. code-block:: bash
-
-    %%shell
-    pip install tflite==2.1.0
-
-or you could generate TFLite package yourself. The steps are the following:
-
-.. code-block:: bash
-
-    # Get the flatc compiler.
-    # Please refer to https://github.com/google/flatbuffers for details
-    # and make sure it is properly installed.
-    flatc --version
-
-    # Get the TFLite schema.
-    wget https://raw.githubusercontent.com/tensorflow/tensorflow/r1.13/tensorflow/lite/schema/schema.fbs
-
-    # Generate TFLite package.
-    flatc --python schema.fbs
-
-    # Add current folder (which contains generated tflite module) to PYTHONPATH.
-    export PYTHONPATH=${PYTHONPATH:+$PYTHONPATH:}$(pwd)
-
-
-Now please check if TFLite package is installed successfully, ``python -c "import tflite"``
-
-Below you can find an example on how to compile TFLite model using TVM.
-"""
-
-######################################################################
-# Utils for downloading and extracting zip files
-# ----------------------------------------------
-
-import os
-
-
-def extract(path):
-    import tarfile
-
-    if path.endswith("tgz") or path.endswith("gz"):
-        dir_path = os.path.dirname(path)
-        tar = tarfile.open(path)
-        tar.extractall(path=dir_path)
-        tar.close()
-    else:
-        raise RuntimeError("Could not decompress the file: " + path)
-
-
-######################################################################
-# Load pretrained TFLite model
-# ----------------------------
-# Load mobilenet V1 TFLite model provided by Google
-from tvm.contrib.download import download_testdata
-
-model_url = "http://download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224.tgz"
-
-# Download model tar file and extract it to get mobilenet_v1_1.0_224.tflite
-model_path = download_testdata(model_url, "mobilenet_v1_1.0_224.tgz", module=["tf", "official"])
-model_dir = os.path.dirname(model_path)
-extract(model_path)
-
-# Now we can open mobilenet_v1_1.0_224.tflite
-tflite_model_file = os.path.join(model_dir, "mobilenet_v1_1.0_224.tflite")
-tflite_model_buf = open(tflite_model_file, "rb").read()
-
-# Get TFLite model from buffer
-try:
-    import tflite
-
-    tflite_model = tflite.Model.GetRootAsModel(tflite_model_buf, 0)
-except AttributeError:
-    import tflite.Model
-
-    tflite_model = tflite.Model.Model.GetRootAsModel(tflite_model_buf, 0)
-
-######################################################################
-# Load a test image
-# -----------------
-# A single cat dominates the examples!
-from PIL import Image
-from matplotlib import pyplot as plt
-import numpy as np
-
-image_url = "https://github.com/dmlc/mxnet.js/blob/main/data/cat.png?raw=true"
-image_path = download_testdata(image_url, "cat.png", module="data")
-resized_image = Image.open(image_path).resize((224, 224))
-plt.imshow(resized_image)
-plt.show()
-image_data = np.asarray(resized_image).astype("float32")
-
-# Add a dimension to the image so that we have NHWC format layout
-image_data = np.expand_dims(image_data, axis=0)
-
-# Preprocess image as described here:
-# https://github.com/tensorflow/models/blob/edb6ed22a801665946c63d650ab9a0b23d98e1b1/research/slim/preprocessing/inception_preprocessing.py#L243
-image_data[:, :, :, 0] = 2.0 / 255.0 * image_data[:, :, :, 0] - 1
-image_data[:, :, :, 1] = 2.0 / 255.0 * image_data[:, :, :, 1] - 1
-image_data[:, :, :, 2] = 2.0 / 255.0 * image_data[:, :, :, 2] - 1
-print("input", image_data.shape)
-
-######################################################################
-# Compile the model with relay
-# ----------------------------
-
-# TFLite input tensor name, shape and type
-input_tensor = "input"
-input_shape = (1, 224, 224, 3)
-input_dtype = "float32"
-
-# Parse TFLite model and convert it to a Relay module
-from tvm import relay, transform
-
-mod, params = relay.frontend.from_tflite(
-    tflite_model, shape_dict={input_tensor: input_shape}, dtype_dict={input_tensor: input_dtype}
-)
-
-# Build the module against to x86 CPU
-target = "llvm"
-with transform.PassContext(opt_level=3):
-    lib = relay.build(mod, target, params=params)
-
-######################################################################
-# Execute on TVM
-# --------------
-import tvm
-from tvm import te
-from tvm.contrib import graph_executor as runtime
-
-# Create a runtime executor module
-module = runtime.GraphModule(lib["default"](tvm.cpu()))
-
-# Feed input data
-module.set_input(input_tensor, tvm.nd.array(image_data))
-
-# Run
-module.run()
-
-# Get output
-tvm_output = module.get_output(0).numpy()
-
-######################################################################
-# Display results
-# ---------------
-
-# Load label file
-label_file_url = "".join(
-    [
-        "https://raw.githubusercontent.com/",
-        "tensorflow/tensorflow/master/tensorflow/lite/java/demo/",
-        "app/src/main/assets/",
-        "labels_mobilenet_quant_v1_224.txt",
-    ]
-)
-label_file = "labels_mobilenet_quant_v1_224.txt"
-label_path = download_testdata(label_file_url, label_file, module="data")
-
-# List of 1001 classes
-with open(label_path) as f:
-    labels = f.readlines()
-
-# Convert result to 1D data
-predictions = np.squeeze(tvm_output)
-
-# Get top 1 prediction
-prediction = np.argmax(predictions)
-
-# Convert id to class name and show the result
-print("The image prediction result is: id " + str(prediction) + " name: " + labels[prediction])
diff --git a/gallery/how_to/deploy_models/README.txt b/gallery/how_to/deploy_models/README.txt
deleted file mode 100644
index 22323c4e52..0000000000
--- a/gallery/how_to/deploy_models/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Deploy Deep Learning Models
----------------------------
-
-TVM is capable of deploying models to a variety of different platforms. These
-how-tos describe how to prepapre and deploy models to many of the supported
-backends.
diff --git a/gallery/how_to/deploy_models/deploy_model_on_adreno.py b/gallery/how_to/deploy_models/deploy_model_on_adreno.py
deleted file mode 100644
index 0ea76bb288..0000000000
--- a/gallery/how_to/deploy_models/deploy_model_on_adreno.py
+++ /dev/null
@@ -1,473 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-"""
-.. _tutorial-deploy-model-on-adreno:
-
-Deploy the Pretrained Model on Adreno™
-======================================
-**Author**: Daniil Barinov, Siva Rama Krishna
-
-This article is a step-by-step tutorial to deploy pretrained Pytorch ResNet-18 model on Adreno (on different precisions).
-
-For us to begin with, PyTorch must be installed.
-TorchVision is also required since we will be using it as our model zoo.
-
-A quick solution is to install it via pip:
-
-.. code-block:: bash
-
-  %%shell
-  pip install torch
-  pip install torchvision
-
-Besides that, you should have TVM builded for Android.
-See the following instructions on how to build it.
-
-`Deploy to Adreno GPU <https://tvm.apache.org/docs/how_to/deploy/adreno.html>`_
-
-After the build section there should be two files in *build* directory «libtvm_runtime.so» and «tvm_rpc».
-Let's push them to the device and run TVM RPC Server.
-"""
-
-######################################################################
-# TVM RPC Server
-# --------------
-# To get the hash of the device use:
-#
-# .. code-block:: bash
-#
-#   adb devices
-#
-# Set the android device to use, if you have several devices connected to your computer.
-#
-# .. code-block:: bash
-#
-#   export ANDROID_SERIAL=<device-hash>
-#
-# Then to upload these two files to the device you should use:
-#
-# .. code-block:: bash
-#
-#   adb push {libtvm_runtime.so,tvm_rpc} /data/local/tmp
-#
-# At this moment you will have «libtvm_runtime.so» and «tvm_rpc» on path /data/local/tmp on your device.
-# Sometimes cmake can’t find «libc++_shared.so». Use:
-#
-# .. code-block:: bash
-#
-#   find ${ANDROID_NDK_HOME} -name libc++_shared.so
-#
-# to find it and also push it with adb on the desired device:
-#
-# .. code-block:: bash
-#
-#   adb push libc++_shared.so /data/local/tmp
-#
-# We are now ready to run the TVM RPC Server.
-# Launch rpc_tracker with following line in 1st console:
-#
-# .. code-block:: bash
-#
-#   python3 -m tvm.exec.rpc_tracker --port 9190
-#
-# Then we need to run tvm_rpc server from under the desired device in 2nd console:
-#
-# .. code-block:: bash
-#
-#   adb reverse tcp:9190 tcp:9190
-#   adb forward tcp:5000 tcp:5000
-#   adb forward tcp:5002 tcp:5001
-#   adb forward tcp:5003 tcp:5002
-#   adb forward tcp:5004 tcp:5003
-#   adb shell LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/tvm_rpc server --host=0.0.0.0 --port=5000 --tracker=127.0.0.1:9190 --key=android --port-end=5100
-#
-# Before proceeding to compile and infer model, specify TVM_TRACKER_HOST and TVM_TRACKER_PORT
-#
-# .. code-block:: bash
-#
-#   export TVM_TRACKER_HOST=0.0.0.0
-#   export TVM_TRACKER_PORT=9190
-#
-# check that the tracker is running and the device is available
-#
-# .. code-block:: bash
-#
-#     python -m tvm.exec.query_rpc_tracker --port 9190
-#
-# For example, if we have 1 Android device,
-# the output can be:
-#
-# .. code-block:: bash
-#
-#    Queue Status
-#    ----------------------------------
-#    key          total  free  pending
-#    ----------------------------------
-#    android      1      1     0
-#    ----------------------------------
-
-#################################################################
-# Configuration
-# -------------
-
-import os
-import torch
-import torchvision
-import tvm
-from tvm import te
-from tvm import relay, rpc
-from tvm.contrib import utils, ndk
-from tvm.contrib import graph_executor
-from tvm.relay.op.contrib import clml
-from tvm import autotvm
-
-# Below are set of configuration that controls the behaviour of this script like
-# local run or device run, target definitions,  dtype setting and auto tuning enablement.
-# Change these settings as needed if required.
-
-# Adreno devices are efficient with float16 compared to float32
-# Given the expected output doesn't effect by lowering precision
-# it's advisable to use lower precision.
-# We have a helper API to make the precision conversion simple and
-# it supports dtype with "float16" and "float16_acc32" modes.
-# Let's choose "float16" for calculation and "float32" for accumulation.
-
-calculation_dtype = "float16"
-acc_dtype = "float32"
-
-# Specify Adreno target before compiling to generate texture
-# leveraging kernels and get all the benefits of textures
-# Note: This generated example running on our x86 server for demonstration.
-# If running it on the Android device, we need to
-# specify its instruction set. Set :code:`local_demo` to False if you want
-# to run this tutorial with a real device over rpc.
-local_demo = True
-
-# by default on CPU target will execute.
-# select 'cpu', 'opencl' and 'opencl -device=adreno'
-test_target = "cpu"
-
-# Change target configuration.
-# Run `adb shell cat /proc/cpuinfo` to find the arch.
-arch = "arm64"
-target = tvm.target.Target("llvm -mtriple=%s-linux-android" % arch)
-
-# Auto tuning is compute intensive and time taking task,
-# hence disabling for default run. Please enable it if required.
-is_tuning = False
-tune_log = "adreno-resnet18.log"
-
-# To enable OpenCLML accelerated operator library.
-enable_clml = False
-
-#################################################################
-# Get a PyTorch Model
-# -------------------
-# Get resnet18 from torchvision models
-model_name = "resnet18"
-model = getattr(torchvision.models, model_name)(pretrained=True)
-model = model.eval()
-
-# We grab the TorchScripted model via tracing
-input_shape = [1, 3, 224, 224]
-input_data = torch.randn(input_shape)
-scripted_model = torch.jit.trace(model, input_data).eval()
-
-#################################################################
-# Load a test image
-# -----------------
-# As an example we would use classical cat image from ImageNet
-
-from PIL import Image
-from tvm.contrib.download import download_testdata
-from matplotlib import pyplot as plt
-import numpy as np
-
-img_url = "https://github.com/dmlc/mxnet.js/blob/main/data/cat.png?raw=true"
-img_path = download_testdata(img_url, "cat.png", module="data")
-img = Image.open(img_path).resize((224, 224))
-plt.imshow(img)
-plt.show()
-
-# Preprocess the image and convert to tensor
-from torchvision import transforms
-
-my_preprocess = transforms.Compose(
-    [
-        transforms.Resize(256),
-        transforms.CenterCrop(224),
-        transforms.ToTensor(),
-        transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
-    ]
-)
-img = my_preprocess(img)
-img = np.expand_dims(img, 0)
-
-#################################################################
-# Convert PyTorch model to Relay module
-# -------------------------------------
-# TVM has frontend api for various frameworks under relay.frontend and now
-# for pytorch model import we have relay.frontend.from_pytorch api.
-# Input name can be arbitrary
-input_name = "input0"
-shape_list = [(input_name, img.shape)]
-
-mod, params = relay.frontend.from_pytorch(scripted_model, shape_list)
-
-#################################################################
-# Precisions
-# ----------
-
-# Adreno devices are efficient with float16 compared to float32
-# Given the expected output doesn't effect by lowering precision
-# it's advisable to use lower precision.
-
-# TVM support Mixed Precision through ToMixedPrecision transformation pass.
-# We may need to register precision rules like precision type, accumultation
-# datatype ...etc. for the required operators to override the default settings.
-# The below helper api simplifies the precision conversions across the module.
-
-# Calculation dtype is set to "float16" and accumulation dtype is set to "float32"
-# in configuration section above.
-
-from tvm.driver.tvmc.transform import apply_graph_transforms
-
-mod = apply_graph_transforms(
-    mod,
-    {
-        "mixed_precision": True,
-        "mixed_precision_ops": ["nn.conv2d", "nn.dense"],
-        "mixed_precision_calculation_type": calculation_dtype,
-        "mixed_precision_acc_type": acc_dtype,
-    },
-)
-
-#################################################################
-# As you can see in the IR, the architecture now contains cast operations, which are
-# needed to convert to FP16 precision.
-# You can also use "float16" or "float32" precisions as other dtype options.
-
-#################################################################
-# Prepare TVM Target
-# ------------------
-
-# This generated example running on our x86 server for demonstration.
-
-# To deply and tun on real target over RPC please set :code:`local_demo` to False in above configuration sestion.
-# Also, :code:`test_target` is set to :code:`llvm` as this example to make compatible for x86 demonstration.
-# Please change it to :code:`opencl` or :code:`opencl -device=adreno` for RPC target in configuration above.
-
-if local_demo:
-    target = tvm.target.Target("llvm")
-elif test_target.find("opencl"):
-    target = tvm.target.Target(test_target, host=target)
-
-##################################################################
-# AutoTuning
... 15699 lines suppressed ...