Giter Site home page Giter Site logo

Comments (2)

arogozhnikov avatar arogozhnikov commented on May 18, 2024

Hello Daniel,

thanks for bringing this up. I had similar thoughts when reading pytorch documentation of named tensors.

Simplest thing to try is:

  • check non-decomposed features on the input, fail when axis name does not coincide with one in einops
  • set result's axes names when result axis is not a composed axis

Examples:

rearrange(x, 'b (c1 c2) h w -> b c1 h w') # second axis name will not be checked, will fail if for any other axis name was set, but did not coincide
rearrange(x, 'b (c1 c2) h w -> h w c1 c2 b') # result names are exactly h, w, c1, c2, and b
rearrange(x, 'b (c1 c2) h w -> h (c1 c2) w b ()') # result names are exactly h, None, w, b and None

We can try to add this as an experimental module like einops.named_pytorch with separate versions of rearrange, reduce and layers.

from einops.

arogozhnikov avatar arogozhnikov commented on May 18, 2024

I think this repo may be of interest as an experiment of interaction einops <-> xarray (xarray names axes),
https://github.com/arviz-devs/xarray-einstats

I don't have plans to integrate with pytorch's named_tensor; projects related to einops <-> named tensors are welcome in discussions.

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.