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

Ellipsis not mentioned in docs #22

Open
LukasDrude opened this issue Dec 1, 2018 · 10 comments
Open

Ellipsis not mentioned in docs #22

LukasDrude opened this issue Dec 1, 2018 · 10 comments
Milestone

Comments

@LukasDrude
Copy link

Great work!

I discovered in https://github.com/arogozhnikov/einops/blob/master/einops/einops.py#L199 that you also support ellipsis. Its an important feature so you may want to add it to the documentation.

@arogozhnikov
Copy link
Owner

Thanks!

I am not mentioning this in the docs for purpose as I expect this feature to be misused.
So, for now I'd better keep it as is.

@shoyer
Copy link

shoyer commented Aug 20, 2020

+1 I think support for ellipsis is noteworthy. In fact, I recently saw someone note support for ellipsis as a missing feature in einops!

It's true that it's probably a better idea to omit ellipsis when writing code specialized for particular shapes of arrays, but occasionally it's nice to write rank polymorphic code and there's no good alternative to it.

@arogozhnikov arogozhnikov added this to the 0.4 milestone Sep 11, 2020
@zplizzi
Copy link

zplizzi commented Feb 8, 2022

I also agree that this should be documented! Sometimes you have to reshape an array with an undefined number of axes, and I don't think there's any other way to do it with einops? Eg rearrange(x, "a b ... -> (a b) ...") seems to work as I would expect, and I'll be using this in my code right now to replace a messy .reshape(), so it's definitely not unusual.

@JeppeKlitgaard
Copy link

I was initially a little disappointed after not finding ellipsis support in the docs, as it was crucial for my application and I was really enjoying einops in other places. Very glad I found this issue – I hope the feature gets added to einops' excellent documention!

@lucasb-eyer
Copy link

rearrange(x, "b ... -> b (...)") is so much better than np.reshape(x, (x.shape[0], np.prod(x.shape[1:]))) and it is a super widespread operation to do. Ellipsis is beautiful, consider mentioning it very late in the docs!

@NightMachinery
Copy link

I was just going to open a feature request for .... :D

I think the ellipsis notation can be turned even more powerful by adding the ability to name the axes group and add an explicit count. E.g.,

reduce(x, "b size[2] channel -> b size", "mean")

An undetermined count (what ... currently does) can be shown using [] or [-1].

@magehrig
Copy link

I agree with everyone. If there is a concern for misuse, we could have a paragraph informing the user about best practices.

@zjost
Copy link

zjost commented Aug 30, 2022

I'm here because ellipsis are used in StableDiffusion code, and I had a hard time understanding since I couldn't find in the docs.

@Etienne-Meunier
Copy link

In the mean time you can find some usage of ellipsis in the einops paper : Rogozhnikov, Alex. "Einops: Clear and reliable tensor manipulations with einstein-like notation." International Conference on Learning Representations. 2021.

@perklet
Copy link

perklet commented Nov 30, 2023

I'm here because ellipsis are used in FlashAttention. It's hard for non-native English speakers to know the word "ellipsis", let alone find the correct page to explain what it means in einops. I really hope this can be mentioned in the docs or tutorial.

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