Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDILab开源决策智能平台
treevalue
提交
c68859ae
T
treevalue
项目概览
OpenDILab开源决策智能平台
/
treevalue
大约 1 年 前同步成功
通知
3
Star
213
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
treevalue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c68859ae
编写于
6月 21, 2022
作者:
HansBug
😆
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(hansbug): try fix the problem when testing win32 wheel
上级
1d4cd4a0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
9 deletion
+49
-9
pyproject.toml
pyproject.toml
+3
-3
requirements-test-win.txt
requirements-test-win.txt
+15
-0
test/tree/general/test_general_benchmark.py
test/tree/general/test_general_benchmark.py
+22
-5
test/tree/general/test_tensor.py
test/tree/general/test_tensor.py
+9
-1
未找到文件。
pyproject.toml
浏览文件 @
c68859ae
...
...
@@ -12,11 +12,11 @@ skip = ["pp*"] # Do not build for PyPy
[tool.cibuildwheel.windows]
archs
=
[
"x86"
,
'AMD64'
]
before-test
=
[
# Unittest for windows
"pip install -r
\"
{project}
/requirements-test
.txt
\"
"
,
"pip install -r
\"
{project}
\\
requirements-test-win
.txt
\"
"
,
]
test-command
=
[
"xcopy /e /i
\"
{project}
/
test
\"
test"
,
"copy
\"
{project}
/
pytest.ini
\"
pytest.ini"
,
"xcopy /e /i
\"
{project}
\\
test
\"
test"
,
"copy
\"
{project}
\\
pytest.ini
\"
pytest.ini"
,
"pytest test -sv -m unittest --log-level=DEBUG"
,
"rmdir /s /q test"
,
]
...
...
requirements-test-win.txt
0 → 100644
浏览文件 @
c68859ae
coverage>=5
mock>=4.0.3
flake8~=3.5
pytest~=6.2.5
pytest-cov~=3.0.0
pytest-mock~=3.6.1
pytest-xdist>=1.34.0
pytest-rerunfailures~=10.2
pytest-timeout~=2.0.2
pytest-benchmark~=3.4.0
testtools>=2
hbutils>=0.6.13
setuptools<=59.5.0
numpy>=1.10
easydict>=1.7,<2
\ No newline at end of file
test/tree/general/test_general_benchmark.py
浏览文件 @
c68859ae
import
unittest
from
functools
import
lru_cache
from
typing
import
Optional
from
hbutils.testing
import
vpip
try
:
import
torch
except
ImportError
:
torch
=
None
import
pytest
import
torch
from
treevalue
import
TreeValue
,
func_treelize
,
FastTreeValue
_TREE_DATA_1
=
{
'a'
:
torch
.
randn
(
2
,
3
),
'x'
:
{
'c'
:
torch
.
randn
(
3
,
4
)}}
_TREE_1
=
FastTreeValue
(
_TREE_DATA_1
)
@
lru_cache
()
def
_get_tree
()
->
Optional
[
FastTreeValue
]:
if
torch
is
not
None
:
_TREE_DATA_1
=
{
'a'
:
torch
.
randn
(
2
,
3
),
'x'
:
{
'c'
:
torch
.
randn
(
3
,
4
)}}
return
FastTreeValue
(
_TREE_DATA_1
)
else
:
return
None
@
pytest
.
mark
.
benchmark
(
group
=
'treevalue_dynamic'
)
@
unittest
.
skipUnless
(
vpip
(
'torch'
)
>=
'1.1.0'
,
'Torch>=1.1.0 only'
)
class
TestTreeGeneralBenchmark
:
def
test_dynamic_execute
(
self
,
benchmark
):
def
sin
(
t
):
return
t
.
sin
()
return
benchmark
(
sin
,
_
TREE_1
)
return
benchmark
(
sin
,
_
get_tree
()
)
def
test_static_execute
(
self
,
benchmark
):
sinf
=
func_treelize
(
return_type
=
TreeValue
)(
torch
.
sin
)
...
...
@@ -21,4 +38,4 @@ class TestTreeGeneralBenchmark:
def
sin
(
t
):
return
sinf
(
t
)
return
benchmark
(
sin
,
_
TREE_1
)
return
benchmark
(
sin
,
_
get_tree
()
)
test/tree/general/test_tensor.py
浏览文件 @
c68859ae
import
unittest
import
pytest
import
torch
from
hbutils.testing
import
vpip
try
:
import
torch
except
ImportError
:
torch
=
None
from
treevalue.tree
import
func_treelize
,
FastTreeValue
@
pytest
.
mark
.
unittest
@
unittest
.
skipUnless
(
vpip
(
'torch'
)
>=
'1.1.0'
,
'Torch>=1.1.0 only'
)
def
test_for_torch_support
():
sin
=
func_treelize
()(
torch
.
sin
)
cos
=
func_treelize
()(
torch
.
cos
)
# the same sin function
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录