torch icon indicating copy to clipboard operation
torch copied to clipboard

einops

Open kevinykuo opened this issue 4 years ago • 2 comments

https://github.com/arogozhnikov/einops

kevinykuo avatar Aug 19 '21 01:08 kevinykuo

Cool! The implementation doesn't look very complicated, I wonder how much work it would be to port it to R. At least a subset of this can be done with torch_einsum, eg:

x <- torch_randn(10, 10)
torch_allclose(x$t(), torch_einsum("i j -> j i", x))

dfalbel avatar Aug 19 '21 01:08 dfalbel

example in the wild of being able to do somewhat complex rearrangements declaratively: https://github.com/lucidrains/mlp-mixer-pytorch/blob/324121d19b9425b2eefe586d6e02de9f263da1e8/mlp_mixer_pytorch/permutator.py#L29

kevinykuo avatar Aug 19 '21 01:08 kevinykuo