Comments (2)
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.
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)
- [BUG] Noisy patches generated when using `einops.rearrange` to split a grayscale brain image of `skimage.data` HOT 2
- [BUG] einops should support floating point bound variables HOT 1
- [BUG] Ellipsis cannot be parsed [redacted] HOT 2
- [BUG] Please explain in the README how to run tests HOT 1
- [BUG] 5 tests failed HOT 1
- Test test_torch_layer fails: RuntimeError: required keyword attribute 'value' has the wrong type HOT 3
- einops compatible with ONNX export? HOT 3
- [Feature suggestion] All/Any Reduction HOT 2
- [BUG] get_backend is not thread-safe HOT 3
- einops.layers.torch.Rearrange does not accept a list[torch.Tensor] as an input HOT 1
- [Feature suggestion] Support composition/decomposition of axes in `einsum` HOT 2
- *** AttributeError: 'Rearrange' object has no attribute 'recipe'[BUG] HOT 1
- [BUG] batchsize of dataloading
- [BUG] error when import einops HOT 1
- [BUG] Einops repeat throws device error during torchscripting HOT 1
- [Feature suggestion] apple mlx support
- [Feature suggestion] Allow performing a view instead of a reshape HOT 3
- [BUG] einops.repeat returns value with type Never HOT 3
- Add support for keras3 HOT 2
- [Feature suggestion] fixup/support anonymous axes in `parse_shape` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from einops.