Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
flybirding10011
DI-treetensor
提交
d1ed0cfe
D
DI-treetensor
项目概览
flybirding10011
/
DI-treetensor
与 Fork 源项目一致
Fork自
OpenDILab开源决策智能平台 / DI-treetensor
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DI-treetensor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d1ed0cfe
编写于
9月 14, 2021
作者:
HansBug
😆
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
doc(hansbug): split docs for numpy.funcs to serverial pages
上级
adf83c6a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
53 deletion
+52
-53
docs/source/api_doc/numpy/funcs.rst.py
docs/source/api_doc/numpy/funcs.rst.py
+42
-31
docs/source/api_doc/numpy/index.rst
docs/source/api_doc/numpy/index.rst
+1
-1
docs/source/api_doc/torch/index.rst
docs/source/api_doc/torch/index.rst
+1
-1
treetensor/numpy/funcs.py
treetensor/numpy/funcs.py
+7
-19
treetensor/torch/funcs.py
treetensor/torch/funcs.py
+1
-1
未找到文件。
docs/source/api_doc/numpy/funcs.rst.py
浏览文件 @
d1ed0cfe
import
codecs
import
re
import
re
import
numpy
as
np
import
numpy
as
np
...
@@ -21,34 +22,44 @@ if __name__ == '__main__':
...
@@ -21,34 +22,44 @@ if __name__ == '__main__':
print_title
(
tnp
.
funcs
.
__name__
,
levelc
=
'='
)
print_title
(
tnp
.
funcs
.
__name__
,
levelc
=
'='
)
current_module
(
tnp
.
funcs
.
__name__
)
current_module
(
tnp
.
funcs
.
__name__
)
for
_name
in
sorted
(
tnp
.
funcs
.
__all__
):
with
print_block
(
'toctree'
,
params
=
dict
(
maxdepth
=
1
))
as
tf
:
_item
=
getattr
(
tnp
.
funcs
,
_name
)
for
_name
in
sorted
(
tnp
.
funcs
.
__all__
):
_origin
=
get_origin
(
_item
)
_file_tag
=
f
'funcs.
{
_name
}
.auto'
print_title
(
_name
,
levelc
=
'-'
)
_filename
=
f
'
{
_file_tag
}
.rst'
print
(
_file_tag
,
file
=
tf
)
with
print_block
(
'autofunction'
,
value
=
_name
):
pass
_item
=
getattr
(
tnp
.
funcs
,
_name
)
_origin
=
get_origin
(
_item
)
if
_origin
and
(
_origin
.
__doc__
or
''
).
strip
():
with
codecs
.
open
(
_filename
,
'w'
)
as
sf
:
with
print_block
(
'admonition'
,
value
=
'Numpy Version Related'
,
params
=
{
'class'
:
'tip'
})
as
f
:
print_title
(
_name
,
levelc
=
'='
,
file
=
sf
)
print_doc
(
f
"""
current_module
(
tnp
.
funcs
.
__name__
,
file
=
sf
)
This documentation is based on
`numpy.
{
_name
}
<https://numpy.org/doc/
{
_short_version
}
/reference/generated/numpy.
{
_name
}
.html>`_
print_title
(
"Documentation"
,
levelc
=
'-'
,
file
=
sf
)
in `numpy v
{
_numpy_version
}
<https://numpy.org/doc/
{
_short_version
}
/>`_.
with
print_block
(
'autofunction'
,
value
=
_name
,
file
=
sf
):
**Its arguments
\'
arrangements depend on the version of numpy you installed**.
pass
If some arguments listed here are not working properly, please check your numpy's version
if
_origin
and
(
_origin
.
__doc__
or
''
).
strip
():
with the following command and find its documentation.
with
print_block
(
'admonition'
,
value
=
'Numpy Version Related'
,
params
=
{
'class'
:
'tip'
},
file
=
sf
)
as
f
:
.. code-block:: shell
print_doc
(
f
"""
:linenos:
This documentation is based on
`numpy.
{
_name
}
<https://numpy.org/doc/
{
_short_version
}
/reference/generated/numpy.
{
_name
}
.html>`_
python -c 'import numpy as np;print(np.__version__)'
in `numpy v
{
_numpy_version
}
<https://numpy.org/doc/
{
_short_version
}
/>`_.
**Its arguments
\'
arrangements depend on the version of numpy you installed**.
The arguments and keyword arguments supported in numpy v
{
_numpy_version
}
is listed below.
If some arguments listed here are not working properly, please check your numpy's version
"""
,
file
=
f
)
with the following command and find its documentation.
print
()
.. code-block:: shell
print_doc
(
_raw_doc_process
(
_origin
.
__doc__
or
''
))
:linenos:
print
()
python -c 'import numpy as np;print(np.__version__)'
The arguments and keyword arguments supported in numpy v
{
_numpy_version
}
is listed below.
"""
,
file
=
f
)
print
(
file
=
sf
)
print_title
(
f
"Description For numpy v
{
_short_version
}
"
,
levelc
=
'-'
,
file
=
sf
)
print_doc
(
_raw_doc_process
(
_origin
.
__doc__
or
''
),
file
=
sf
)
print
(
file
=
sf
)
docs/source/api_doc/numpy/index.rst
浏览文件 @
d1ed0cfe
...
@@ -2,7 +2,7 @@ treetensor.numpy
...
@@ -2,7 +2,7 @@ treetensor.numpy
=====================
=====================
.. toctree::
.. toctree::
:maxdepth:
3
:maxdepth:
2
funcs.auto
funcs.auto
numpy.auto
numpy.auto
docs/source/api_doc/torch/index.rst
浏览文件 @
d1ed0cfe
...
@@ -2,7 +2,7 @@ treetensor.torch
...
@@ -2,7 +2,7 @@ treetensor.torch
=====================
=====================
.. toctree::
.. toctree::
:maxdepth:
3
:maxdepth:
2
funcs.auto
funcs.auto
size.auto
size.auto
...
...
treetensor/numpy/funcs.py
浏览文件 @
d1ed0cfe
import
builtins
import
builtins
from
typing
import
List
import
numpy
as
np
import
numpy
as
np
from
treevalue
import
TreeValue
from
treevalue
import
func_treelize
as
original_func_treelize
from
treevalue
import
func_treelize
as
original_func_treelize
from
treevalue.utils
import
post_process
from
.numpy
import
TreeNumpy
from
.numpy
import
TreeNumpy
from
..common
import
ireduce
,
TreeObject
from
..common
import
ireduce
,
TreeObject
from
..utils
import
replaceable_partial
,
doc_from
from
..utils
import
replaceable_partial
,
doc_from
,
args_mapping
__all__
=
[
__all__
=
[
'all'
,
'any'
,
'all'
,
'any'
,
'equal'
,
'array_equal'
,
'equal'
,
'array_equal'
,
]
]
func_treelize
=
post_process
(
post_process
(
args_mapping
(
def
_doc_stripper
(
src
,
_
,
lines
:
List
[
str
]):
lambda
i
,
x
:
TreeValue
(
x
)
if
isinstance
(
x
,
(
dict
,
TreeValue
))
else
x
)))(
_name
,
_version
=
src
.
__name__
,
np
.
__version__
replaceable_partial
(
original_func_treelize
,
return_type
=
TreeNumpy
)
_short_version
=
'.'
.
join
(
_version
.
split
(
'.'
)[:
2
])
)
return
[
f
'.. note::'
,
f
''
,
f
' This documentation is based on '
f
' `numpy.
{
_name
}
<https://numpy.org/doc/
{
_short_version
}
/reference/generated/numpy.
{
_name
}
.html>`_ '
f
' in `numpy v
{
_version
}
<https://numpy.org/doc/
{
_short_version
}
/>`_.'
,
f
' **Its arguments
\'
arrangements depend on the version of numpy you installed**.'
,
f
''
,
*
lines
,
]
func_treelize
=
replaceable_partial
(
original_func_treelize
,
return_type
=
TreeNumpy
)
@
doc_from
(
np
.
all
)
@
doc_from
(
np
.
all
)
...
...
treetensor/torch/funcs.py
浏览文件 @
d1ed0cfe
...
@@ -27,7 +27,7 @@ __all__ = [
...
@@ -27,7 +27,7 @@ __all__ = [
]
]
func_treelize
=
post_process
(
post_process
(
args_mapping
(
func_treelize
=
post_process
(
post_process
(
args_mapping
(
lambda
i
,
x
:
T
ensor
(
x
)
if
isinstance
(
x
,
(
dict
,
TreeValue
))
else
x
)))(
lambda
i
,
x
:
T
reeValue
(
x
)
if
isinstance
(
x
,
(
dict
,
TreeValue
))
else
x
)))(
replaceable_partial
(
original_func_treelize
,
return_type
=
Tensor
)
replaceable_partial
(
original_func_treelize
,
return_type
=
Tensor
)
)
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录