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 2020/03/08 16:01:29 UTC
[incubator-tvm] branch master updated: Docs and Readme updated as
per new namespace change (#4989)
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 78fa1d5 Docs and Readme updated as per new namespace change (#4989)
78fa1d5 is described below
commit 78fa1d5e9d4382ba099b6633af0d360557cb5034
Author: ANSHUMAN TRIPATHY <an...@huawei.com>
AuthorDate: Sun Mar 8 21:31:18 2020 +0530
Docs and Readme updated as per new namespace change (#4989)
---
docs/deploy/aocl_fpga.md | 12 ++++++------
docs/deploy/aws_fpga.md | 11 ++++++-----
docs/dev/codebase_walkthrough.rst | 6 +++---
docs/dev/inferbound.rst | 9 +++++----
docs/dev/runtime.rst | 3 ++-
docs/langref/hybrid_script.rst | 10 +++++-----
jvm/README.md | 13 +++++++------
rust/frontend/README.md | 11 ++++++-----
web/README.md | 9 +++++----
9 files changed, 45 insertions(+), 39 deletions(-)
diff --git a/docs/deploy/aocl_fpga.md b/docs/deploy/aocl_fpga.md
index 1f13025..24f8b65 100644
--- a/docs/deploy/aocl_fpga.md
+++ b/docs/deploy/aocl_fpga.md
@@ -27,16 +27,16 @@ We use two python scripts for this tutorial.
- build.py - a script to synthesize FPGA bitstream.
```
import tvm
-
+from tvm import te
tgt_host="llvm"
tgt="aocl_sw_emu"
-n = tvm.var("n")
-A = tvm.placeholder((n,), name='A')
-B = tvm.placeholder((n,), name='B')
-C = tvm.compute(A.shape, lambda i: A[i] + B[i], name="C")
+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 = tvm.create_schedule(C.op)
+s = te.create_schedule(C.op)
px, x = s[C].split(C.op.axis[0], nparts=1)
s[C].bind(px, tvm.thread_axis("pipeline"))
diff --git a/docs/deploy/aws_fpga.md b/docs/deploy/aws_fpga.md
index 82492af..894585f 100644
--- a/docs/deploy/aws_fpga.md
+++ b/docs/deploy/aws_fpga.md
@@ -27,16 +27,17 @@ We use two python scripts for this tutorial.
- build.py - a script to synthesize FPGA bitstream.
```python
import tvm
+from tvm import te
tgt_host="llvm"
tgt="sdaccel"
-n = tvm.var("n")
-A = tvm.placeholder((n,), name='A')
-B = tvm.placeholder((n,), name='B')
-C = tvm.compute(A.shape, lambda i: A[i] + B[i], name="C")
+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 = tvm.create_schedule(C.op)
+s = te.create_schedule(C.op)
px, x = s[C].split(C.op.axis[0], nparts=1)
s[C].bind(px, tvm.thread_axis("pipeline"))
diff --git a/docs/dev/codebase_walkthrough.rst b/docs/dev/codebase_walkthrough.rst
index 8513ce5..054c693 100644
--- a/docs/dev/codebase_walkthrough.rst
+++ b/docs/dev/codebase_walkthrough.rst
@@ -51,9 +51,9 @@ We use a simple example that uses the low level TVM API directly. The example is
::
n = 1024
- A = tvm.placeholder((n,), name='A')
- B = tvm.placeholder((n,), name='B')
- C = tvm.compute(A.shape, lambda i: A[i] + B[i], name="C")
+ 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``.
diff --git a/docs/dev/inferbound.rst b/docs/dev/inferbound.rst
index 2f4d428..98957d5 100644
--- a/docs/dev/inferbound.rst
+++ b/docs/dev/inferbound.rst
@@ -623,15 +623,16 @@ Above, we discussed the behavior of PassUpDomain on Split relations only. In the
::
import tvm
+ from tvm import te
n = 4
m = 4
- A = tvm.placeholder((n, m), name='A')
- B = tvm.compute((n, m), lambda bi, bj: A[bi, bj]+2, name='B')
- C = tvm.compute((n, m), lambda ci, cj: B[ci, cj]*3, name='C')
+ A = te.placeholder((n, m), name='A')
+ B = te.compute((n, m), lambda bi, bj: A[bi, bj]+2, name='B')
+ C = te.compute((n, m), lambda ci, cj: B[ci, cj]*3, name='C')
- s = tvm.create_schedule(C.op)
+ s = te.create_schedule(C.op)
fused_axes = s[C].fuse(C.op.axis[0], C.op.axis[1])
xo, xi = s[C].split(fused_axes, 4)
diff --git a/docs/dev/runtime.rst b/docs/dev/runtime.rst
index 9e542bf..6c1a0ab 100644
--- a/docs/dev/runtime.rst
+++ b/docs/dev/runtime.rst
@@ -260,8 +260,9 @@ For example, in the following code, we accessed the op field of the TensorNode.
.. code:: python
import tvm
+ from tvm import te
- x = tvm.placeholder((3,4), name="x")
+ x = te.placeholder((3,4), name="x")
# access the op field of TensorNode
print(x.op.name)
diff --git a/docs/langref/hybrid_script.rst b/docs/langref/hybrid_script.rst
index 99f44ce..82c4f3c 100644
--- a/docs/langref/hybrid_script.rst
+++ b/docs/langref/hybrid_script.rst
@@ -64,8 +64,8 @@ The current parse interface looks like:
.. code-block:: python
- a = tvm.placeholder((100, ), name='a')
- b = tvm.placeholder((99, ), name='b')
+ 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
@@ -74,8 +74,8 @@ or ``tvm.container.Array``, to this function, it returns a op node:
.. code-block:: python
- a = tvm.placeholder((100, ), name='a')
- b = tvm.placeholder((99, ), name='b')
+ a = tvm.te.placeholder((100, ), name='a')
+ b = tvm.te.placeholder((99, ), name='b')
c = outer_product(a, b, c) # 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
@@ -90,7 +90,7 @@ Follow up the example above, you can use some tvm like interfaces to tune the co
.. code-block:: python
i, j = c.op.axis
- sch = tvm.create_schedule(op)
+ sch = te.create_schedule(op)
jo, ji = sch.split(j, 4)
sch.vectorize(ji)
diff --git a/jvm/README.md b/jvm/README.md
index 59c0bd2..dcc5342 100644
--- a/jvm/README.md
+++ b/jvm/README.md
@@ -96,14 +96,15 @@ There's nothing special for this part. The following Python snippet generate add
```python
import os
import tvm
+from tvm import te
from tvm.contrib import cc, util
def test_add(target_dir):
- n = tvm.var("n")
- A = tvm.placeholder((n,), name='A')
- B = tvm.placeholder((n,), name='B')
- C = tvm.compute(A.shape, lambda i: A[i] + B[i], name="C")
- s = tvm.create_schedule(C.op)
+ 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)
fadd = tvm.build(s, [A, B, C], "llvm", target_host="llvm", name="myadd")
fadd.save(os.path.join(target_dir, "add_cpu.o"))
@@ -175,4 +176,4 @@ Server server = new Server(proxyHost, proxyPort, "key");
server.start();
```
-You can also use `StandaloneServerProcessor` and `ConnectProxyServerProcessor` to build your own RPC server. Refer to [Android RPC Server](https://github.com/apache/incubator-tvm/blob/master/apps/android_rpc/app/src/main/java/org/apache/tvm/tvmrpc/RPCProcessor.java) for more details.
\ No newline at end of file
+You can also use `StandaloneServerProcessor` and `ConnectProxyServerProcessor` to build your own RPC server. Refer to [Android RPC Server](https://github.com/apache/incubator-tvm/blob/master/apps/android_rpc/app/src/main/java/org/apache/tvm/tvmrpc/RPCProcessor.java) for more details.
diff --git a/rust/frontend/README.md b/rust/frontend/README.md
index 9dce7ea..41a6bd3 100644
--- a/rust/frontend/README.md
+++ b/rust/frontend/README.md
@@ -122,17 +122,18 @@ One can use the following Python snippet to generate `add_gpu.so` which add two
```python
import os
import tvm
+from tvm import te
from tvm.contrib import cc
def test_add(target_dir):
if not tvm.runtime.enabled("cuda"):
print("skip {__file__} because cuda is not enabled...".format(__file__=__file__))
return
- n = tvm.var("n")
- A = tvm.placeholder((n,), name='A')
- B = tvm.placeholder((n,), name='B')
- C = tvm.compute(A.shape, lambda i: A[i] + B[i], name="C")
- s = tvm.create_schedule(C.op)
+ 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)
bx, tx = s[C].split(C.op.axis[0], factor=64)
s[C].bind(bx, tvm.thread_axis("blockIdx.x"))
s[C].bind(tx, tvm.thread_axis("threadIdx.x"))
diff --git a/web/README.md b/web/README.md
index e47c603..5dfd691 100644
--- a/web/README.md
+++ b/web/README.md
@@ -87,16 +87,17 @@ the compilation process.
```python
import tvm
+from tvm import te
from tvm.contrib import emscripten
import os
def prepare_test_libs(base_path):
target = "llvm -target=asmjs-unknown-emscripten -system-lib"
if not tvm.runtime.enabled(target):
raise RuntimeError("Target %s is not enbaled" % target)
- n = tvm.var("n")
- A = tvm.placeholder((n,), name='A')
- B = tvm.compute(A.shape, lambda *i: A(*i) + 1.0, name='B')
- s = tvm.create_schedule(B.op)
+ n = te.var("n")
+ A = te.placeholder((n,), name='A')
+ B = te.compute(A.shape, lambda *i: A(*i) + 1.0, name='B')
+ s = te.create_schedule(B.op)
fadd1 = tvm.build(s, [A, B], target, name="add_one")
obj_path = os.path.join(base_path, "test_add_one.bc")
fadd1.save(obj_path)