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

paddle2.0和pytorch在计算mean时输出的形状不同 #29951

Closed
liguoyu666 opened this issue Dec 28, 2020 · 8 comments
Closed

paddle2.0和pytorch在计算mean时输出的形状不同 #29951

liguoyu666 opened this issue Dec 28, 2020 · 8 comments
Assignees

Comments

@liguoyu666
Copy link

liguoyu666 commented Dec 28, 2020

`import torch

a = torch.rand([8,3,128,128])
b = a.mean()
print(b.shape) # torch.Size([ ])`

`import paddle

c = paddle.rand([8,3,128,128])
d = c.mean()
print(d.shape) # [1]`

paddle输出的shape为[1],要用哪个api才能达到pytorch输出的shape [ ]

@paddle-bot-old
Copy link

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

@willthefrog
Copy link
Contributor

目前paddle还不支持scalar tensor,后续版本可能会改进。

@liguoyu666
Copy link
Author

目前paddle还不支持scalar tensor,后续版本可能会改进。

那shape为[1],有啥方法可以变为[ ] 而值不变吗?还是说现版本shape没法变为[ ]

@willthefrog
Copy link
Contributor

目前应该是不支持[]

@liguoyu666
Copy link
Author

目前应该是不支持[]

好的,谢谢

@paddle-bot-old
Copy link

Are you satisfied with the resolution of your issue?

YES
No

@zhwesky2010
Copy link
Contributor

@liguoyu666 你好,请问如果支持为shape=[],会带来哪些方面的正面收益呢

@zhwesky2010
Copy link
Contributor

@liguoyu666

你好,飞桨将于2.5版本全面支持0维Tensor,上述反馈的0D问题也将同时解决。(索引API需要设置 export FLAGS_set_to_1d=0,其他API无需设置)

欢迎试用并安装develop 版本的paddle whl包,将体验最新的0维特性:https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html
安装命令:
pip install paddlepaddle-gpu==0.0.0.post112 -f https://www.paddlepaddle.org.cn/whl/linux/gpu/develop.html


Hello, Paddle will fully support the 0-dimensional Tensor in version 2.5, and the 0D issue will also be resolved at the same time.
Welcome to try and install the develop version of the paddle whl package, and you will experience the latest 0-dimensional features: https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux -pip.html
Install Command:
pip install paddlepaddle-gpu==0.0.0.post112 -f https://www.paddlepaddle.org.cn/whl/linux/gpu/develop.html

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

No branches or pull requests

3 participants