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

Output permutation in einsum fails #118

Closed
matthiasneuner opened this issue Aug 5, 2020 · 1 comment
Closed

Output permutation in einsum fails #118

matthiasneuner opened this issue Aug 5, 2020 · 1 comment

Comments

@matthiasneuner
Copy link
Contributor

Hello Roman,

your snippet regarding OIndex in einsum from the Wiki does not compile for me:

enum {I,J,K,L,M,N};

Tensor<double,2,3,5> A; Tensor<double,3,5,2,4> B;
// fill A and B
A.random(); B.random();
// Order as I,K,L,M,N - same as default
auto C = einsum<Index<I,J,K>,Index<J,L,M,N>,OIndex<I,K,L,M,N>>(A,B);    // works

// Order as I,L,K,N,M - resulting tensor [Tensor<double,2,5,5,4,2>]
auto D = einsum<Index<I,J,K>,Index<J,L,M,N>,OIndex<I,M,K,N,M>>(A,B);    // fails

Although using OIndex works in many places, occasionally it fails to compile, like in the example above.
Thank you in advance :-) !

@romeric
Copy link
Owner

romeric commented Aug 6, 2020

The Wiki entry is incorrect. In the second example, there are duplicate entries in the output Index (in OIndex<I,M,K,N,M>, M is repeated twice).

There is some discussion on how to support this feature, see #91. In the above example however, even if the duplicate entries were taken care of the output tensor cannot be reshaped like that. That typo makes the whole example incorrect. I will correct the Wiki. If you have other cases where einsum with OIndex fails, report it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants