This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git
The following commit(s) were added to refs/heads/master by this push:
new cc8cacb [DOCS] Bring relay docs to the top-level flat view (#5343)
cc8cacb is described below
commit cc8cacb14448308f3411fba920c3bbc700d115ed
Author: Tianqi Chen <[email protected]>
AuthorDate: Wed Apr 15 15:32:59 2020 -0700
[DOCS] Bring relay docs to the top-level flat view (#5343)
- Changes most of the relay docs to use autosummary.
- Bring relay API docs to the top-level flat view for easier discovery
- Removed a few cases of re-exports.
---
docs/api/python/index.rst | 10 +++++++++-
docs/api/python/relay/frontend.rst | 19 +++----------------
docs/api/python/relay/image.rst | 4 ++--
docs/api/python/relay/index.rst | 25 +++----------------------
docs/api/python/relay/nn.rst | 4 ++--
docs/api/python/relay/op.rst | 24 ------------------------
docs/api/python/relay/testing.rst | 32 +++++++++++++++++++++++++++++++-
docs/api/python/relay/transform.rst | 1 -
docs/api/python/relay/vision.rst | 2 +-
python/tvm/relay/op/image/__init__.py | 3 +--
python/tvm/relay/op/image/image.py | 1 -
python/tvm/relay/op/nn/nn.py | 11 ++++++-----
python/tvm/relay/op/vision/multibox.py | 10 ++++++----
python/tvm/relay/op/vision/nms.py | 8 +++++---
python/tvm/relay/testing/__init__.py | 6 ++----
python/tvm/relay/testing/nat.py | 2 +-
16 files changed, 72 insertions(+), 90 deletions(-)
diff --git a/docs/api/python/index.rst b/docs/api/python/index.rst
index 09da9f1..c279dc2 100644
--- a/docs/api/python/index.rst
+++ b/docs/api/python/index.rst
@@ -29,10 +29,18 @@ Python API
tir
te
driver
+ relay/index
+ relay/frontend
+ relay/nn
+ relay/vision
+ relay/image
+ relay/transform
+ relay/analysis
+ relay/backend
+ relay/testing
autotvm
rpc
contrib
graph_runtime
- relay/index
vta/index
topi
diff --git a/docs/api/python/relay/frontend.rst
b/docs/api/python/relay/frontend.rst
index 4b4bcf0..a62e36e 100644
--- a/docs/api/python/relay/frontend.rst
+++ b/docs/api/python/relay/frontend.rst
@@ -20,19 +20,6 @@ tvm.relay.frontend
------------------
.. automodule:: tvm.relay.frontend
-
-.. autofunction:: tvm.relay.frontend.from_mxnet
-
-.. autofunction:: tvm.relay.frontend.from_keras
-
-.. autofunction:: tvm.relay.frontend.from_onnx
-
-.. autofunction:: tvm.relay.frontend.from_tflite
-
-.. autofunction:: tvm.relay.frontend.from_coreml
-
-.. autofunction:: tvm.relay.frontend.from_caffe2
-
-.. autofunction:: tvm.relay.frontend.from_tensorflow
-
-.. autofunction:: tvm.relay.frontend.from_pytorch
+ :members:
+ :imported-members:
+ :autosummary:
diff --git a/docs/api/python/relay/image.rst b/docs/api/python/relay/image.rst
index e29cf30..efd142f 100644
--- a/docs/api/python/relay/image.rst
+++ b/docs/api/python/relay/image.rst
@@ -19,7 +19,7 @@
tvm.relay.image
---------------
-.. automodule:: tvm.relay.op.image
+.. automodule:: tvm.relay.image
:members:
:imported-members:
- :exclude-members:
+ :autosummary:
diff --git a/docs/api/python/relay/index.rst b/docs/api/python/relay/index.rst
index 49bb4ab..084b745 100644
--- a/docs/api/python/relay/index.rst
+++ b/docs/api/python/relay/index.rst
@@ -16,32 +16,13 @@
under the License.
tvm.relay
-=========
-
-This document contains the Python API for the Relay frontend, optimizer, and
-compiler toolchain.
-
-Relay is the second-generation, high-level intermediate representation (IR)
for the TVM
-compiler stack.
-
-.. toctree::
- :maxdepth: 2
-
- analysis
- backend
- frontend
- image
- transform
- nn
- op
- vision
- testing
+---------
.. automodule:: tvm.relay
:members:
:imported-members:
- :exclude-members: RelayExpr, Pass, PassInfo, function_pass, PassContext,
- ModulePass, FunctionPass, Sequential, module_pass, Type, TypeKind,
+ :exclude-members: RelayExpr,
+ Type, TypeKind,
TypeVar, GlobalTypeVar, TypeConstraint, FuncType, TupleType,
IncompleteType,
TypeCall, TypeRelation, TensorType, RelayRefType, GlobalVar, SourceName,
Span, Var, Op, Constructor
diff --git a/docs/api/python/relay/nn.rst b/docs/api/python/relay/nn.rst
index c67c932..b54b752 100644
--- a/docs/api/python/relay/nn.rst
+++ b/docs/api/python/relay/nn.rst
@@ -17,7 +17,7 @@
tvm.relay.nn
------------
-.. automodule:: tvm.relay.op.nn.nn
+.. automodule:: tvm.relay.nn
:members:
:imported-members:
- :exclude-members:
+ :autosummary:
diff --git a/docs/api/python/relay/op.rst b/docs/api/python/relay/op.rst
deleted file mode 100644
index 8843b28..0000000
--- a/docs/api/python/relay/op.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.
-
-tvm.relay.op
-------------
-.. automodule:: tvm.relay.op
- :members:
- :imported-members:
- :exclude-members: Tuple, TupleWrapper
- :autosummary:
diff --git a/docs/api/python/relay/testing.rst
b/docs/api/python/relay/testing.rst
index 5af5ba7..1d0bfe0 100644
--- a/docs/api/python/relay/testing.rst
+++ b/docs/api/python/relay/testing.rst
@@ -18,4 +18,34 @@
tvm.relay.testing
-----------------
-.. autoclass:: tvm.relay.testing.resnet
+.. automodule:: tvm.relay.testing
+ :members:
+ :imported-members:
+ :autosummary:
+
+.. automodule:: tvm.relay.testing.mlp
+ :members:
+
+.. automodule:: tvm.relay.testing.resnet
+ :members:
+
+.. automodule:: tvm.relay.testing.dcgan
+ :members:
+
+.. automodule:: tvm.relay.testing.mobilenet
+ :members:
+
+.. automodule:: tvm.relay.testing.lstm
+ :members:
+
+.. automodule:: tvm.relay.testing.inception_v3
+ :members:
+
+.. automodule:: tvm.relay.testing.squeezenet
+ :members:
+
+.. automodule:: tvm.relay.testing.vgg
+ :members:
+
+.. automodule:: tvm.relay.testing.densenet
+ :members:
diff --git a/docs/api/python/relay/transform.rst
b/docs/api/python/relay/transform.rst
index b5040a0..c66904d 100644
--- a/docs/api/python/relay/transform.rst
+++ b/docs/api/python/relay/transform.rst
@@ -21,5 +21,4 @@ tvm.relay.transform
.. automodule:: tvm.relay.transform
:members:
:imported-members:
- :exclude-members: Object
:autosummary:
diff --git a/docs/api/python/relay/vision.rst b/docs/api/python/relay/vision.rst
index 1b5ca74..f6bedee 100644
--- a/docs/api/python/relay/vision.rst
+++ b/docs/api/python/relay/vision.rst
@@ -19,7 +19,7 @@
tvm.relay.vision
----------------
-.. automodule:: tvm.relay.op.vision
+.. automodule:: tvm.relay.vision
:members:
:imported-members:
:autosummary:
diff --git a/python/tvm/relay/op/image/__init__.py
b/python/tvm/relay/op/image/__init__.py
index 4483bd7..146b449 100644
--- a/python/tvm/relay/op/image/__init__.py
+++ b/python/tvm/relay/op/image/__init__.py
@@ -16,6 +16,5 @@
# under the License.
# pylint: disable=wildcard-import
"""Image network related operators."""
-from __future__ import absolute_import as _abs
from .image import *
-from ._image import *
+from . import _image
diff --git a/python/tvm/relay/op/image/image.py
b/python/tvm/relay/op/image/image.py
index 284bd4a..097322c 100644
--- a/python/tvm/relay/op/image/image.py
+++ b/python/tvm/relay/op/image/image.py
@@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
"""Image operations."""
-from __future__ import absolute_import as _abs
from . import _make
def resize(data,
diff --git a/python/tvm/relay/op/nn/nn.py b/python/tvm/relay/op/nn/nn.py
index a126e8d..d0a81bc 100644
--- a/python/tvm/relay/op/nn/nn.py
+++ b/python/tvm/relay/op/nn/nn.py
@@ -16,8 +16,8 @@
# under the License.
#pylint: disable=invalid-name, too-many-lines
"""Neural network operations."""
-from __future__ import absolute_import as _abs
-from ...expr import TupleWrapper
+from tvm.relay import expr
+
from . import _make
from .util import get_pad_tuple2d, get_pad_tuple3d
@@ -1457,7 +1457,7 @@ def dropout(data, rate=0.5):
result : tvm.relay.Expr
The result of dropout
"""
- return TupleWrapper(dropout_raw(data, rate), 2)[0]
+ return expr.TupleWrapper(dropout_raw(data, rate), 2)[0]
def dropout_raw(data, rate=0.5):
@@ -1580,7 +1580,7 @@ def batch_norm(data,
epsilon,
center,
scale)
- return TupleWrapper(result, 3)
+ return expr.TupleWrapper(result, 3)
def instance_norm(data,
@@ -1791,7 +1791,8 @@ def sparse_transpose(x):
Tuple of output sparse tensor (same shape and format as input),
i.e. if CSR then output is in ([data, indices, indptr]) form
"""
- return TupleWrapper(_make.sparse_transpose(x.data, x.indices, x.indptr), 3)
+ return expr.TupleWrapper(
+ _make.sparse_transpose(x.data, x.indices, x.indptr), 3)
def contrib_conv2d_winograd_without_weight_transform(data,
weight,
diff --git a/python/tvm/relay/op/vision/multibox.py
b/python/tvm/relay/op/vision/multibox.py
index 55fb01c..75daff9 100644
--- a/python/tvm/relay/op/vision/multibox.py
+++ b/python/tvm/relay/op/vision/multibox.py
@@ -15,8 +15,9 @@
# specific language governing permissions and limitations
# under the License.
"""Multibox operations."""
+from tvm.relay import expr
from . import _make
-from ...expr import TupleWrapper
+
def multibox_prior(data,
sizes=(1.0,),
@@ -86,6 +87,7 @@ def multibox_transform_loc(cls_prob,
-------
ret : tuple of tvm.relay.Expr
"""
- return TupleWrapper(_make.multibox_transform_loc(cls_prob, loc_pred,
- anchor, clip, threshold,
- variances), 2)
+ return expr.TupleWrapper(
+ _make.multibox_transform_loc(cls_prob, loc_pred,
+ anchor, clip, threshold,
+ variances), 2)
diff --git a/python/tvm/relay/op/vision/nms.py
b/python/tvm/relay/op/vision/nms.py
index cba08bf..70a9ec9 100644
--- a/python/tvm/relay/op/vision/nms.py
+++ b/python/tvm/relay/op/vision/nms.py
@@ -15,8 +15,9 @@
# specific language governing permissions and limitations
# under the License.
"""Non-maximum suppression operations."""
+from tvm.relay import expr
from . import _make
-from ...expr import TupleWrapper
+
def get_valid_counts(data,
score_threshold,
@@ -47,8 +48,9 @@ def get_valid_counts(data,
out_tensor : relay.Expr
Rearranged data tensor.
"""
- return TupleWrapper(_make.get_valid_counts(data, score_threshold,
- id_index, score_index), 2)
+ return expr.TupleWrapper(
+ _make.get_valid_counts(data, score_threshold,
+ id_index, score_index), 2)
def non_max_suppression(data,
diff --git a/python/tvm/relay/testing/__init__.py
b/python/tvm/relay/testing/__init__.py
index 58c6fe8..b8ef906 100644
--- a/python/tvm/relay/testing/__init__.py
+++ b/python/tvm/relay/testing/__init__.py
@@ -23,9 +23,7 @@ import tvm
from tvm import te
import tvm.relay as relay
import tvm.relay.op as op
-from tvm.relay import transform
-from tvm.relay import Function, GlobalVar, ScopeBuilder, Tuple, TupleGetItem,
create_executor
-from tvm.relay import TensorType, TupleType
+
from . import mlp
from . import resnet
@@ -55,7 +53,7 @@ def run_opt_pass(expr, opt_pass):
def run_infer_type(expr):
- return run_opt_pass(expr, transform.InferType())
+ return run_opt_pass(expr, relay.transform.InferType())
def _np_randn_from_type(t, scale=1, mean=0):
diff --git a/python/tvm/relay/testing/nat.py b/python/tvm/relay/testing/nat.py
index 4906eef..1ca456b 100644
--- a/python/tvm/relay/testing/nat.py
+++ b/python/tvm/relay/testing/nat.py
@@ -140,7 +140,7 @@ def add_nat_definitions(prelude):
"""Given a Relay prelude, adds a Peano nat ADT, as well as functions
for adding nats and doubling nats. It also adds versions of
update, nth, and iterate that take nats instead of scalars (the
- names are prefixed with 'nat_')."""
+ names are prefixed with `nat_`)."""
define_nat_adt(prelude)
define_nat_double(prelude)
define_nat_add(prelude)