-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[0-size Tensor No.355] Add 0-size Tensor support for unique_consecutive #73444
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提交成功,感谢你对开源项目的贡献! |
|
paddleAPITest回测请优先使用accuracy模式( |
因为 |
|
/re-run all-failed |
| if (axis.empty()) { | ||
| out->set_dims({0}); | ||
| if (return_inverse) { | ||
| index->set_dims(in_dims); | ||
| } | ||
| } else { | ||
| out->set_dims(in_dims); | ||
| if (return_inverse) { | ||
| index->set_dims({0}); | ||
| } | ||
| } | ||
| if (return_counts) { | ||
| counts->set_dims({0}); |
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.
这个地方还是有些疑问。
out->set_dims({0}) 设置完后,tensor的shape是不是[0] ? shape [0] 和shape[ ] 是两个不同的shape,shape [0]的dims().size() 为1,是1d Tensor,尽管是0-size。shape [ ]的dims().size() 为0,是0d Tensor也是个标量。 试试out->set_dims({}),让tensor的shape为[ ]
请把
import torch
x = torch.randn([0,1,2])
output, inverse, counts = torch.unique_consecutive(x, return_inverse=True,return_counts=True)
print("x ",x)
print("output ",output)
print("inverse ",inverse)
print("counts ",counts)转化为paddle的代码,跑一下,将结果贴到PR描述里。
请注意如下三种情况:case1import torch
x = torch.randn([0,1,2])
output, inverse, counts = torch.unique_consecutive(x, return_inverse=True,return_counts=True,dim = 0)
print("x ",x)
print("output ",output)
print("inverse ",inverse)
print("counts ",counts)输出: case2import torch
x = torch.randn([0,1,2])
output, inverse, counts = torch.unique_consecutive(x, return_inverse=True,return_counts=True)
print("x ",x)
print("output ",output)
print("inverse ",inverse)
print("counts ",counts)输出: case3import torch
x = torch.randn([0,1,2])
output, inverse, counts = torch.unique_consecutive(x, return_inverse=True,return_counts=True,dim=1)
print("x ",x)
print("output ",output)
print("inverse ",inverse)
print("counts ",counts)输出:报错paddle error 请验证修复后如下三种情形的输出,并告知输出结果~ |
|
使用paddleAPITest在CPU和GPU上使用accuracy模式,跑如下测试case,非0size的Tensor不要求进行回测: |
|
Sorry to inform you that 73bb142's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
|
已经被 #74305 修复 |

PR Category
Execute Infrastructure
PR Types
Improvements
Description
infermeta修改设置维度
修改cpu/gpu kernel
当0-size Tensor时, out tensor的shape与输入保持一致(与torch保持一致)
PaddleAPITest测试通过
