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

Einops doesn't support the PaddlePaddle framework currently #45627

Closed
OccupyMars2025 opened this issue Aug 31, 2022 · 10 comments
Closed

Einops doesn't support the PaddlePaddle framework currently #45627

OccupyMars2025 opened this issue Aug 31, 2022 · 10 comments
Assignees
Labels
good first issue PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/new-issue 新建 type/feature-request 新需求申请

Comments

@OccupyMars2025
Copy link
Contributor

OccupyMars2025 commented Aug 31, 2022

需求描述 Feature Description

related issue: #34220
related PR: arogozhnikov/einops#122

I just want tu use einops with paddlepaddle, just like the following :

import paddle
import torch
import numpy as np
from einops import rearrange


x_np = np.random.randn(1, 2, 3)
print(rearrange(x_np, "a s d -> s a d"))

x_torch = torch.randn([1, 2, 3])
print(rearrange(x_torch, "a s d -> s a d"))

x_pd = paddle.randn([1, 2, 3])
rearrange(x_pd, "a s d -> s a d")

The last line of code reports an error as follows:
RuntimeError Traceback (most recent call last)
in
12
13 x_pd = paddle.randn([1, 2, 3])
---> 14 rearrange(x_pd, "a s d -> s a d")

3 frames
/usr/local/lib/python3.7/dist-packages/einops/_backends.py in get_backend(tensor)
50 return backend
51
---> 52 raise RuntimeError('Tensor type unknown to einops {}'.format(type(tensor)))
53
54

RuntimeError: Tensor type unknown to einops <class 'paddle.Tensor'>

The official website of einops says:

image

It seems that Einops doesn't work with the PaddlePaddle framework now.

替代实现 Alternatives

you can transform a paddle Tensor to a numpy array to work with einops

@paddle-bot
Copy link

paddle-bot bot commented Aug 31, 2022

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网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!

@OccupyMars2025
Copy link
Contributor Author

If the PaddlePaddle team doesn't have time to do it, I will try to implement the requirement before 2022/10/15 when I have time.

@luotao1 luotao1 added the PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc label Sep 1, 2022
@jzhang533
Copy link
Contributor

related issue: #34220

@OccupyMars2025
Copy link
Contributor Author

Now, I understand it is not an easy problem to solve.

@luotao1
Copy link
Contributor

luotao1 commented Sep 1, 2022

@zhouwei25 is doing zero-dimensional tensor related work now.

  • In Segfault on trivial transpose #34220, the author of einops said: Support for zero-dimensional tensor is a hard requirement for inclusion for einops support.
  • Could you help update the progress of zero-dimensional work?

@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Sep 1, 2022

@luotao1 This is still under discussion and pending review. It may cause incompatibility. It is not recommended to modify the output 0D at present, and Modifications PR must be compatible with before.

@zhwesky2010
Copy link
Contributor

@OccupyMars2025 Thanks for asking questions. Plan 0D tensor has passed the internal review and is under development. We will support transpose and reshape 0D before 10/20. In that time, The work of Einops supporting Paddle will not be blocked.

@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Oct 11, 2022

@OccupyMars2025 Thanks, Are you interested in supporting paddle as the backend for Einops?
we have fixed the prolem mentioned above in #46555. And are there any other problem?

@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Mar 15, 2023

This PR support it: arogozhnikov/einops#242
EinOps support Paddle Now, thank to pay attention~

@nemonameless
Copy link
Contributor

pip install git+https://github.com/arogozhnikov/einops.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/new-issue 新建 type/feature-request 新需求申请
Projects
None yet
Development

No branches or pull requests

7 participants