semiring-einsum
semiring-einsum copied to clipboard
More than 26 indices?
torch.einsum limits you to 26 indices but can semiring_einsum provide a non-string interface that allows more than 26?
That would be a good idea. How about something like:
compile_equation('abc,cde->bd')
can be written as
compile_equation(inputs=[['a', 'b', 'c'], ['c', 'd', 'e']], output=['b', 'd'])
or
compile_equation(inputs=[[0, 1, 2], [2, 3, 4]], output=[1, 3])
That looks good to me. It's pretty close to numpy.einsum's alternative interface.
Indeed, Python's common sequence operations make it easy to support
inputs=[['a', 'b', 'c'], ['c', 'd', 'e']], output=['b', 'd']
and
inputs=["abc", "cde"], output="bd"
with the same code.