-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
添加单测调用多样性检测工具 Validate Unittest #328
添加单测调用多样性检测工具 Validate Unittest #328
Conversation
|
tools/callvariety/.gitignore
Outdated
@@ -0,0 +1,2 @@ | |||
callvariety_report.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validate_unittest
validation
改成这样命名吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已更新
fb04838
to
18cdb21
Compare
好的我试试 已更新,现在有大约 800 个不符合规范的单测 |
@@ -69,14 +69,3 @@ def test_case_5(): | |||
""" | |||
) | |||
obj.run(pytorch_code, ["result", "out"], check_value=False) | |||
|
|||
|
|||
def test_case_6(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个case为什么删除,尽量新增case不减少case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为这个 case 测试的是 torch.randint
,我倾向于和 torch.normal
毫不相关
r"^test_hub_download_url_to_file\.py", # 要下载,费时间,先跳过了 | ||
r"^test_(\w*)Tensor\.py", # 特殊类构造函数,api_mapping.json 不合用,跳过 | ||
r"^test_Size\.py", # api_mapping.json 不合用 | ||
r"^test_nn_ParameterList\.py", # 该文件没有测试 torch.nn.ParameterList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个测试后面需要补充上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个里面有两个测试,有一个是之前改,但是没有使用 torch.nn.ParameterList
,而是使用 list[Parameter]
的,这种不清楚是不是合理的。
with open(test_data_path, "w") as f: | ||
json.dump(test_data, f) | ||
|
||
for k, v in api_alias_mapping.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个的目的是为了检查api_alias_mapping,是否在api_mapping里吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的
test_data.update(newtest_data) | ||
with open(test_data_path, "w") as f: | ||
json.dump(test_data, f) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我觉得下面这个for循环里的逻辑还要再优化下,if-else嵌套过深,变量命名也需要设计下,提升下可读性。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已更新,重写了 alias 的检查逻辑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
tests/test_nn_Module_buffers.py
Outdated
@@ -42,7 +42,8 @@ def forward(self, x): | |||
obj.run(pytorch_code, ["result"]) | |||
|
|||
|
|||
def test_case_2(): | |||
# this is test case for named_buffers | |||
def _test_case_2(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是否要移动到对应位置去?或者改写为相应的新写法?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已移动
PR Docs
无对应映射文档
api_mapping.json
映射数据PR APIs
现存不符合规范的 api
注1:当前规则仅检查以下四种情况:
注2:当
api_mapping.json
不含对应信息或找不到'args_list'
时,暂时跳过对应 api,不做检查当前大约有 800 unittests 不符合规范