Open ByzanTine opened 3 years ago
If I remember correctly, the einsum parser actually just generates index notation. I believe index notation in general does not support using the same index variable to access a tensor meaning we can't do things like traces currently.
I don't recall why that is the case so I'm not sure how complicated it would be to add support for that. Perhaps the docs for pt.evaluate should be updated with a similar warning.
Thanks for the response, then I am wondering how hard would it be for index notation to support using the same index var to access a tensor of different dimensions.
I think the main issue is having the compiler generate the correct code to locate in accesses that are indexed with repeated vars. (For dense its easy but for ordered sparse you have to binary search) The bare bones way to do this is to probably change the lowerer (and relax whatever assertions fail before then). However, this way may not be the cleanest. I think something like this is nontrivial to implement but definitely doable.
Looking at the einsum documentation warning, you suggests that "the same subscript cannot appear more than once in a given operand". So I tried in pt.evaluate() as well, but it seems there is no luck as well. The use case being einsum that involves "...kk->k.." for example, or simpler things like trace.
I got errors like
Am I writing the evaluate expressions wrong or there is no support for trace like operation at all? And if latter, wondering how complicated would it be to implement such supports?