CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[0-size Tensor No.11、262、287] Add 0-size Tensor support for argsort/sort API. #72872
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
修改cpu和gpu的kernel之后需要添加对应的单测。PR中补充paddleAPITest的测试结果 |
test_argsort_op.py中已经有0-size Tensor的单测了 |
|
XPU的前向ArgsortKernel似乎没有添加对0 size Tensor的支持,请检查 |
if (rank == 0) { |
|
明白了,学习,谢谢 |
@DanielSun11 可以review了 |
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.
对于paddle.as_real的处理不够完善。
paddle.as_rea 报的是InvalidArgument,此时说明是参数检查报的错,但是并不代表不需要修改。请根据 https://www.paddlepaddle.org.cn/documentation/docs/zh/3.0-beta/api/paddle/as_real_cn.html#as-real 检查下参数是否合法,以及验证一下torch是否支持同样的shape。如果0 size Tensor的输入是合法的但是报了InvalidArgument,此时需要修改
没太明白,一切以APITest工具为准吗?可是错误是3月份的log,5月份的并没有as_real的错,而且直接调用,3月份的错误代码现在执行并不会报错 import paddle
x = paddle.to_tensor([10, 0, 10, 20], dtype = "complex128")
s = paddle.as_real(x)
print(s) W0529 07:01:43.434468 19996 gpu_resources.cc:114] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.0, Runtime API Version: 11.8
Tensor(shape=[4, 2], dtype=float64, place=Place(gpu:0), stop_gradient=True,
[[10., 0. ],
[0. , 0. ],
[10., 0. ],
[20., 0. ]]) |
paddleAPITest的config中 paddle.as_real(Tensor([0, 10, 10, 20],"complex128"), ) ,[0, 10, 10, 20]是Tensor的shape,并不是tensor初始化的tuple,请重新测一下。测试结果以paddleAPITest为准,但是仍然需要添加单测来验证一些极端case。 |
好的,那我12重开PR |
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.
这个还需要改GPU、CPU的Kernel
as_real按照3月份log的shape测试了下,好像也没有问题: import paddle
x = paddle.randn(shape=[0, 4], dtype='complex64')
z = paddle.as_real(x)
print(z)
y = paddle.randn(shape=[10, 0, 10, 20], dtype='complex128')
z = paddle.as_real(y)
print(z) result: Tensor(shape=[0, 4, 2], dtype=float32, place=Place(gpu:0), stop_gradient=True,
[])
Tensor(shape=[10, 0, 10, 20, 2], dtype=float64, place=Place(gpu:0), stop_gradient=True,
[[],
[],
[],
[],
[],
[],
[],
[],
[],
[]]) |
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
PR Category
Execute Infrastructure
PR Types
Improvements
Description
No.11、287 argsort:
在xpu_test中加入单测。
develop的代码经测试没问题
No.262:
根据log日式显示,
改了argsort,就等于改了sort
Pcard-67164