Skip to content
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

[PaddlePaddle hackathon] add UpsamplingNearest2D unittest #35964 #224

Merged
merged 62 commits into from Oct 19, 2021
Merged

[PaddlePaddle hackathon] add UpsamplingNearest2D unittest #35964 #224

merged 62 commits into from Oct 19, 2021

Conversation

GeYuYao-hub
Copy link
Contributor

PR types

Others

PR changes

Others

Describe

  • Task:#35964
  • add unsamplingnearest2D unittest

@CLAassistant
Copy link

CLAassistant commented Oct 9, 2021

CLA assistant check
All committers have signed the CLA.

@GeYuYao-hub
Copy link
Contributor Author

@kolinwei 请问这个linux -ci的报错怎么改呀,我觉得好像没什么问题也不知道哪里错了

@kolinwei
Copy link
Collaborator

@kolinwei 请问这个linux -ci的报错怎么改呀,我觉得好像没什么问题也不知道哪里错了
可以点开这个ci的链接看下log。显示是这个case运行出错了,提交前可以本地跑一下。
image

@GeYuYao-hub
Copy link
Contributor Author

@kolinwei 佬,改好了~



@pytest.mark.api_nn_UpsamplingNearest2d_vartype
def test_upsamplingnearest2d():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_upsamplingnearest2d和test_upsamplingnearest2d_base有啥区别,每个case需要验证不同的测试点

size = None
scale_factor = 5
res = upsample_2d(img=x, size=size, scale_factor=scale_factor, data_format=data_format)
obj.run(res=res, data=x, size=size, scale_factor=scale_factor, data_format=data_format)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

补充更多的测试case,比如size(scale_factor)为其他类型输入时(tuple|Tensor)等。输入x的值包含负数等异常情况。

def test_upsamplingnearest2d_base():
"""
base
"""
Copy link
Collaborator

@kolinwei kolinwei Oct 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc部分详细描述下该测试用例的验证点,测试输入,预期结果等,通过doc部分可以清楚的知晓该用例的测试点。

@GeYuYao-hub GeYuYao-hub reopened this Oct 12, 2021
@GeYuYao-hub
Copy link
Contributor Author

@kolinwei 请问为什么我的报错一直提示我说to_tense中出现了问题呢,是paddle内部出现bug了嘛,困惑好几天了,在群里也问了,但是没有合适的解决方案,需要大佬帮忙解决一下orz

@DDDivano
Copy link
Collaborator

@kolinwei 请问为什么我的报错一直提示我说to_tense中出现了问题呢,是paddle内部出现bug了嘛,困惑好几天了,在群里也问了,但是没有合适的解决方案,需要大佬帮忙解决一下orz

这个出错原因是这样的,测试框架默认传入类型为numpy的参数,会在底层转成Tensor。你这个报错是6,8两个Case,因为你传入了一个动态图的Tensor,底层框架的静态图没有这个函数,所以这就是报错的原因。如果一个API的参数支持Tensor类型的输入,只需要传入numpy即可,因为测试框架目的就是为了尽可能脱离paddle概念,方便补充测试用例。
对于Tensor类型param输入,也只需要传入numpy类型,但需要参考文档。
image
我给你改了一下,你可以参考一下。针对6,8两个Case。
首先指定no_grad_var 声明不参与反向的参数
image
case这样写,传入numpy类型参数并显式声明type,目的是为了防止不同系统平台对numpy的转化类型diff。
image
image

@DDDivano
Copy link
Collaborator

@kolinwei 请问为什么我的报错一直提示我说to_tense中出现了问题呢,是paddle内部出现bug了嘛,困惑好几天了,在群里也问了,但是没有合适的解决方案,需要大佬帮忙解决一下orz

@GeYuYao-hub 这个出错原因是这样的,测试框架默认传入类型为numpy的参数,会在底层转成Tensor。你这个报错是6,8两个Case,因为你传入了一个动态图的Tensor,底层框架的静态图没有这个函数,所以这就是报错的原因。如果一个API的参数支持Tensor类型的输入,只需要传入numpy即可,因为测试框架目的就是为了尽可能脱离paddle概念,方便补充测试用例。 对于Tensor类型param输入,也只需要传入numpy类型,但需要参考文档。 image 我给你改了一下,你可以参考一下。针对6,8两个Case。 首先指定no_grad_var 声明不参与反向的参数 image case这样写,传入numpy类型参数并显式声明type,目的是为了防止不同系统平台对numpy的转化类型diff。 image image

@GeYuYao-hub
Copy link
Contributor Author

@kolinwei 佬~改好啦

@GeYuYao-hub GeYuYao-hub changed the title [PaddlePaddle hackathon] add unsamplingnearest2D unittest #35964 [PaddlePaddle hackathon] add UpsamplingNearest2D unittest #35964 Oct 16, 2021
@DDDivano DDDivano merged commit 85091c6 into PaddlePaddle:develop Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants