提交 460ae25e 编写于 作者: HansBug's avatar HansBug 😆

doc(hansbug): create a new start up

上级 ec7f9fd0
......@@ -13,6 +13,7 @@ module.
:caption: Tutorials
tutorials/installation/index
tutorials/quick_start/index
.. toctree::
......
import builtins
import os
from functools import partial
import treetensor.torch as torch
print = partial(builtins.print, sep=os.linesep)
if __name__ == '__main__':
t1 = torch.tensor([[1, 2, 3],
[4, 5, 6]])
print('new native tensor:', t1)
t2 = torch.tensor({
'a': [1, 2, 3],
'b': {'x': [[4, 5], [6, 7]]},
})
print('new tree tensor:', t2)
t3 = torch.randn(2, 3)
print('new random native tensor:', t3)
t4 = torch.randn({
'a': (2, 3),
'b': {'x': (3, 4)},
})
print('new random tree tensor:', t4)
Quick Start
==================
Create a Tree-based Tensor
------------------------------
You can create a tree-based tensor or a native tensor \
like the following example code.
.. literalinclude:: create_tensor.demo.py
:language: python
:linenos:
The output should be like below.
.. literalinclude:: create_tensor.demo.py.txt
:language: text
:linenos:
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册