Coder Social home page Coder Social logo

[FR] Optional channels about einops HOT 5 CLOSED

arogozhnikov avatar arogozhnikov commented on May 20, 2024 2
[FR] Optional channels

from einops.

Comments (5)

arogozhnikov avatar arogozhnikov commented on May 20, 2024

@ehknight thanks for coming up with suggestion.

I've been previously considering this feature, however it is quite difficult to generalize beyond a single optional dimension.
The way your example should be implemented in existing einops syntax is:

rearrange(x, "b ... -> (b ...)")

where ellipsis can be 0 or 1 dimensions (or more). However, right now that's not yet supported and is subject of #43

from einops.

arogozhnikov avatar arogozhnikov commented on May 20, 2024

@ehknight that's implemented now and will become a part of the next release

from einops.

shoyer avatar shoyer commented on May 20, 2024

It looks like transformations like "b ... -> (b ...)" work currently, but not "(b ...) -> b ..."?

from einops.

arogozhnikov avatar arogozhnikov commented on May 20, 2024

@shoyer that's right, those expressions are disallowed.

Let's analyze your example:

(b ...) 

left part implies there is one dimension which should be decomposed in b and undefined number of dimensions.
To make this a valid operation one needs to provide number of dimensions in ... and their sizes.
In this scenario user can write ... as separate axes like (b b1 b2) -> b b1 b2.

from einops.

arogozhnikov avatar arogozhnikov commented on May 20, 2024

Ellipsis collapsing is now available as a part of einops 0.3 release.

from einops.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.