Unverified Commit 36a83c7f by Zhi Committed by GitHub

[docs] Update relay docs (#5112)

* Update relay docs

* any -> py:func

* make clean
parent 1d83ece5
......@@ -19,43 +19,7 @@ tvm.relay.analysis
----------------------
.. automodule:: tvm.relay.analysis
.. autofunction:: tvm.relay.analysis.post_order_visit
.. autofunction:: tvm.relay.analysis.well_formed
.. autofunction:: tvm.relay.analysis.check_kind
.. autofunction:: tvm.relay.analysis.check_constant
.. autofunction:: tvm.relay.analysis.free_vars
.. autofunction:: tvm.relay.analysis.bound_vars
.. autofunction:: tvm.relay.analysis.all_vars
.. autofunction:: tvm.relay.analysis.free_type_vars
.. autofunction:: tvm.relay.analysis.bound_type_vars
.. autofunction:: tvm.relay.analysis.all_type_vars
.. autofunction:: tvm.relay.analysis.alpha_equal
.. autofunction:: tvm.relay.analysis.assert_alpha_equal
.. autofunction:: tvm.relay.analysis.graph_equal
.. autofunction:: tvm.relay.analysis.assert_graph_equal
.. autofunction:: tvm.relay.analysis.collect_device_info
.. autofunction:: tvm.relay.analysis.collect_device_annotation_ops
.. autofunction:: tvm.relay.analysis.get_total_mac_number
.. autofunction:: tvm.relay.analysis.unmatched_cases
.. autofunction:: tvm.relay.analysis.detect_feature
.. autofunction:: tvm.relay.analysis.structural_hash
:members:
:imported-members:
:exclude-members: Object, RelayExpr, IRModule, Type
:autosummary:
.. 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.relay.base
--------------
.. automodule:: tvm.relay.base
.. autoclass:: tvm.relay.base.RelayNode
:members:
.. autoclass:: tvm.relay.base.Id
:members:
.. 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.relay.build_module
----------------------
.. automodule:: tvm.relay.build
.. automodule:: tvm.relay.build_module
.. autofunction:: tvm.relay.build_module.build
.. autofunction:: tvm.relay.build_module.optimize
.. autofunction:: tvm.relay.build_module.create_executor
.. autoclass:: tvm.relay.build_module.GraphExecutor
:members:
.. 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.relay.expr
--------------
.. automodule:: tvm.relay.expr
.. autofunction:: tvm.relay.expr.var
.. autofunction:: tvm.relay.expr.const
.. autofunction:: tvm.relay.expr.bind
.. autoclass:: tvm.relay.expr.Expr
:members:
.. autoclass:: tvm.relay.expr.Constant
:members:
.. autoclass:: tvm.relay.expr.Tuple
:members:
.. autoclass:: tvm.relay.expr.Call
:members:
.. autoclass:: tvm.relay.expr.Let
:members:
.. autoclass:: tvm.relay.expr.If
:members:
.. autoclass:: tvm.relay.expr.TupleGetItem
:members:
.. autoclass:: tvm.relay.expr.RefCreate
:members:
.. autoclass:: tvm.relay.expr.RefRead
:members:
.. autoclass:: tvm.relay.expr.RefWrite
:members:
.. autoclass:: tvm.relay.expr.TupleGetItem
:members:
.. autoclass:: tvm.relay.expr.TempExpr
:members:
.. autoclass:: tvm.relay.expr.TupleWrapper
:members:
......@@ -19,8 +19,7 @@
tvm.relay.image
---------------
.. automodule:: tvm.relay.image
:members:
.. automodule:: tvm.relay.op.image
:members:
:members:
:imported-members:
:exclude-members:
......@@ -27,16 +27,22 @@ compiler stack.
.. toctree::
:maxdepth: 2
analysis
backend
base
build_module
expr
frontend
image
analysis
transform
nn
op
scope_builder
vision
testing
.. automodule:: tvm.relay
:members:
:imported-members:
:exclude-members: RelayExpr, Pass, PassInfo, function_pass, PassContext,
ModulePass, FunctionPass, Sequential, module_pass, Type, TypeKind,
TypeVar, GlobalTypeVar, TypeConstraint, FuncType, TupleType, IncompleteType,
TypeCall, TypeRelation, TensorType, RelayRefType, GlobalVar, SourceName,
Span, Var, Op, Constructor
:autosummary:
......@@ -17,8 +17,7 @@
tvm.relay.nn
------------
.. automodule:: tvm.relay.nn
:members:
.. automodule:: tvm.relay.op.nn.nn
:members:
:imported-members:
:exclude-members:
......@@ -20,5 +20,5 @@ tvm.relay.op
.. automodule:: tvm.relay.op
:members:
:imported-members:
:exclude-members: Tuple
:exclude-members: Tuple, TupleWrapper
:autosummary:
.. 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.relay.scope_builder
-----------------------
.. automodule:: tvm.relay.scope_builder
.. autoclass:: tvm.relay.scope_builder.ScopeBuilder
:members:
......@@ -19,73 +19,7 @@ tvm.relay.transform
----------------------
.. automodule:: tvm.relay.transform
.. autofunction:: tvm.relay.transform.build_config
.. autofunction:: tvm.relay.transform.module_pass
.. autofunction:: tvm.relay.transform.function_pass
.. autofunction:: tvm.relay.transform.InferType
.. autofunction:: tvm.relay.transform.FoldScaleAxis
.. autofunction:: tvm.relay.transform.BackwardFoldScaleAxis
.. autofunction:: tvm.relay.transform.ForwardFoldScaleAxis
.. autofunction:: tvm.relay.transform.SimplifyInference
.. autofunction:: tvm.relay.transform.CanonicalizeOps
.. autofunction:: tvm.relay.transform.DeadCodeElimination
.. autofunction:: tvm.relay.transform.FoldConstant
.. autofunction:: tvm.relay.transform.FuseOps
.. autofunction:: tvm.relay.transform.CombineParallelConv2D
.. autofunction:: tvm.relay.transform.CombineParallelDense
.. autofunction:: tvm.relay.transform.AlterOpLayout
.. autofunction:: tvm.relay.transform.Legalize
.. autofunction:: tvm.relay.transform.RewriteAnnotatedOps
.. autofunction:: tvm.relay.transform.ToANormalForm
.. autofunction:: tvm.relay.transform.ToCPS
.. autofunction:: tvm.relay.transform.EtaExpand
.. autofunction:: tvm.relay.transform.ToGraphNormalForm
.. autofunction:: tvm.relay.transform.EliminateCommonSubexpr
.. autofunction:: tvm.relay.transform.PartialEvaluate
.. autofunction:: tvm.relay.transform.CanonicalizeCast
.. autofunction:: tvm.relay.transform.LambdaLift
.. autofunction:: tvm.relay.transform.PrintIR
.. autoclass:: tvm.relay.transform.Pass
:members:
.. autoclass:: tvm.relay.transform.PassInfo
:members:
.. autoclass:: tvm.relay.transform.PassContext
:members:
.. autoclass:: tvm.relay.transform.ModulePass
:members:
.. autoclass:: tvm.relay.transform.FunctionPass
:members:
.. autoclass:: tvm.relay.transform.Sequential
:members:
:imported-members:
:exclude-members: Object
:autosummary:
......@@ -19,11 +19,7 @@
tvm.relay.vision
----------------
.. automodule:: tvm.relay.vision
:members:
.. automodule:: tvm.relay.op.vision.multibox
:members:
.. automodule:: tvm.relay.op.vision.nms
.. automodule:: tvm.relay.op.vision
:members:
:imported-members:
:autosummary:
......@@ -250,6 +250,7 @@ def run_doxygen(folder):
tvm_alias_check_map = {
"tvm.te": ["tvm.tir"],
"tvm.tir": ["tvm.ir", "tvm.runtime"],
"tvm.relay": ["tvm.ir", "tvm.tir"],
}
def update_alias_docstring(name, obj, lines):
......
......@@ -218,158 +218,3 @@ This level supports dialect operators.
tvm.relay.qnn.op.requantize
tvm.relay.qnn.op.conv2d
Level 1 Definitions
-------------------
.. autofunction:: tvm.relay.log
.. autofunction:: tvm.relay.sqrt
.. autofunction:: tvm.relay.rsqrt
.. autofunction:: tvm.relay.exp
.. autofunction:: tvm.relay.sigmoid
.. autofunction:: tvm.relay.add
.. autofunction:: tvm.relay.subtract
.. autofunction:: tvm.relay.multiply
.. autofunction:: tvm.relay.divide
.. autofunction:: tvm.relay.floor_divide
.. autofunction:: tvm.relay.mod
.. autofunction:: tvm.relay.floor_mod
.. autofunction:: tvm.relay.tanh
.. autofunction:: tvm.relay.concatenate
.. autofunction:: tvm.relay.expand_dims
.. autofunction:: tvm.relay.nn.softmax
.. autofunction:: tvm.relay.nn.log_softmax
.. autofunction:: tvm.relay.nn.relu
.. autofunction:: tvm.relay.nn.dropout
.. autofunction:: tvm.relay.nn.batch_norm
.. autofunction:: tvm.relay.nn.bias_add
Level 2 Definitions
-------------------
.. autofunction:: tvm.relay.nn.conv2d
.. autofunction:: tvm.relay.nn.conv2d_transpose
.. autofunction:: tvm.relay.nn.dense
.. autofunction:: tvm.relay.nn.max_pool2d
.. autofunction:: tvm.relay.nn.max_pool3d
.. autofunction:: tvm.relay.nn.avg_pool2d
.. autofunction:: tvm.relay.nn.avg_pool3d
.. autofunction:: tvm.relay.nn.global_max_pool2d
.. autofunction:: tvm.relay.nn.global_avg_pool2d
.. autofunction:: tvm.relay.nn.upsampling
.. autofunction:: tvm.relay.nn.upsampling3d
.. autofunction:: tvm.relay.nn.batch_flatten
.. autofunction:: tvm.relay.nn.pad
.. autofunction:: tvm.relay.nn.lrn
.. autofunction:: tvm.relay.nn.l2_normalize
.. autofunction:: tvm.relay.nn.contrib_conv2d_winograd_without_weight_transform
.. autofunction:: tvm.relay.nn.contrib_conv2d_winograd_weight_transform
Level 3 Definitions
-------------------
.. autofunction:: tvm.relay.nn.leaky_relu
.. autofunction:: tvm.relay.nn.prelu
.. autofunction:: tvm.relay.reshape
.. autofunction:: tvm.relay.reshape_like
.. autofunction:: tvm.relay.copy
.. autofunction:: tvm.relay.transpose
.. autofunction:: tvm.relay.squeeze
.. autofunction:: tvm.relay.floor
.. autofunction:: tvm.relay.ceil
.. autofunction:: tvm.relay.sign
.. autofunction:: tvm.relay.trunc
.. autofunction:: tvm.relay.clip
.. autofunction:: tvm.relay.round
.. autofunction:: tvm.relay.abs
.. autofunction:: tvm.relay.negative
.. autofunction:: tvm.relay.take
.. autofunction:: tvm.relay.zeros
.. autofunction:: tvm.relay.zeros_like
.. autofunction:: tvm.relay.ones
.. autofunction:: tvm.relay.ones_like
.. autofunction:: tvm.relay.gather_nd
.. autofunction:: tvm.relay.full
.. autofunction:: tvm.relay.full_like
.. autofunction:: tvm.relay.cast
.. autofunction:: tvm.relay.reinterpret
.. autofunction:: tvm.relay.split
.. autofunction:: tvm.relay.arange
.. autofunction:: tvm.relay.stack
.. autofunction:: tvm.relay.repeat
.. autofunction:: tvm.relay.tile
.. autofunction:: tvm.relay.reverse
Level 4 Definitions
-------------------
.. autofunction:: tvm.relay.right_shift
.. autofunction:: tvm.relay.left_shift
.. autofunction:: tvm.relay.equal
.. autofunction:: tvm.relay.not_equal
.. autofunction:: tvm.relay.greater
.. autofunction:: tvm.relay.greater_equal
.. autofunction:: tvm.relay.less
.. autofunction:: tvm.relay.less_equal
.. autofunction:: tvm.relay.all
.. autofunction:: tvm.relay.any
.. autofunction:: tvm.relay.logical_and
.. autofunction:: tvm.relay.logical_or
.. autofunction:: tvm.relay.logical_not
.. autofunction:: tvm.relay.maximum
.. autofunction:: tvm.relay.minimum
.. autofunction:: tvm.relay.power
.. autofunction:: tvm.relay.where
.. autofunction:: tvm.relay.argmax
.. autofunction:: tvm.relay.argmin
.. autofunction:: tvm.relay.sum
.. autofunction:: tvm.relay.max
.. autofunction:: tvm.relay.min
.. autofunction:: tvm.relay.mean
.. autofunction:: tvm.relay.variance
.. autofunction:: tvm.relay.std
.. autofunction:: tvm.relay.mean_variance
.. autofunction:: tvm.relay.mean_std
.. autofunction:: tvm.relay.prod
.. autofunction:: tvm.relay.strided_slice
.. autofunction:: tvm.relay.broadcast_to
Level 5 Definitions
-------------------
.. autofunction:: tvm.relay.image.resize
.. autofunction:: tvm.relay.image.crop_and_resize
.. autofunction:: tvm.relay.image.dilation2d
.. autofunction:: tvm.relay.vision.multibox_prior
.. autofunction:: tvm.relay.vision.multibox_transform_loc
.. autofunction:: tvm.relay.vision.nms
.. autofunction:: tvm.relay.vision.yolo_reorg
Level 6 Definitions
-------------------
.. autofunction:: tvm.relay.argsort
.. autofunction:: tvm.relay.topk
Level 10 Definitions
--------------------
.. autofunction:: tvm.relay.broadcast_to_like
.. autofunction:: tvm.relay.collapse_sum_like
.. autofunction:: tvm.relay.slice_like
.. autofunction:: tvm.relay.shape_of
.. autofunction:: tvm.relay.ndarray_size
.. autofunction:: tvm.relay.layout_transform
.. autofunction:: tvm.relay.device_copy
.. autofunction:: tvm.relay.annotation.on_device
.. autofunction:: tvm.relay.reverse_reshape
.. autofunction:: tvm.relay.sequence_mask
.. autofunction:: tvm.relay.nn.batch_matmul
.. autofunction:: tvm.relay.nn.adaptive_max_pool2d
.. autofunction:: tvm.relay.nn.adaptive_avg_pool2d
.. autofunction:: tvm.relay.one_hot
Level 11 Definitions
--------------------
.. autofunction:: tvm.relay.qnn.op.requantize
.. autofunction:: tvm.relay.qnn.op.conv2d
......@@ -21,8 +21,7 @@ from .analysis import *
# Call graph
from . import call_graph
from .call_graph import CallGraph
# Feature
from . import feature
CallGraph = call_graph.CallGraph
......@@ -34,6 +34,7 @@ find . -type f -path "*.pyc" | xargs rm -f
echo "PreCheck sphinx doc generation WARNINGS.."
cd docs
make clean
TVM_TUTORIAL_EXEC_PATTERN=none make html 2>/tmp/$$.log.txt
grep -v -E "__mro__|RemovedInSphinx|UserWarning|FutureWarning|Keras" < /tmp/$$.log.txt > /tmp/$$.logclean.txt || true
......
......@@ -56,7 +56,7 @@ from tvm.contrib import graph_runtime
#
# In this tutorial, we assume we will do inference on our device
# and the batch size is set to be 1. Input images are RGB color
# images of size 224 * 224. We can call the :any:`tvm.relay.expr.TupleWrapper.astext()`
# images of size 224 * 224. We can call the :any:`tvm.relay.TupleWrapper.astext()`
# to show the network structure.
batch_size = 1
......@@ -79,14 +79,14 @@ print(mod.astext(show_meta_data=False))
# Currently this value can be 0 to 3. The optimization passes include
# operator fusion, pre-computation, layout transformation and so on.
#
# :any:`relay.build_module.build` returns three components: the execution graph in
# :py:func:`relay.build` returns three components: the execution graph in
# json format, the TVM module library of compiled functions specifically
# for this graph on the target hardware, and the parameter blobs of
# the model. During the compilation, Relay does the graph-level
# optimization while TVM does the tensor-level optimization, resulting
# in an optimized runtime module for model serving.
#
# We'll first compile for Nvidia GPU. Behind the scene, `relay.build_module.build`
# We'll first compile for Nvidia GPU. Behind the scene, :py:func:`relay.build`
# first does a number of graph-level optimizations, e.g. pruning, fusing, etc.,
# then registers the operators (i.e. the nodes of the optimized graphs) to
# TVM implementations to generate a `tvm.module`.
......@@ -97,8 +97,7 @@ print(mod.astext(show_meta_data=False))
opt_level = 3
target = tvm.target.cuda()
with relay.build_config(opt_level=opt_level):
graph, lib, params = relay.build_module.build(
mod, target, params=params)
graph, lib, params = relay.build(mod, target, params=params)
#####################################################################
# Run the generate library
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment