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

einsum notation #2

Open
JohannesBuchner opened this issue Feb 1, 2024 · 1 comment
Open

einsum notation #2

JohannesBuchner opened this issue Feb 1, 2024 · 1 comment

Comments

@JohannesBuchner
Copy link

Hi @dkogan,

Thanks for this very interesting project, I came across it from HN and your talk.

  1. I was looking at the syntax for broadcast_define, which is given by
    @nps.broadcast_define( (('n',), ('n',)) ) or @nps.broadcast_define( (('n',), ('n',), ())) in the examples.

I am not sure whether you are familiar with numpy's einsum function. I quite like the intuitive style of writing indices.

I am wondering whether it could be reused here. In that case, one could write something like:
@nps.broadcast_define('n,n->')
@nps.broadcast_define('n,mn->m')

However, I am not sure how complex the parser of einsum is and whether it can be easily reused here.

  1. Maybe one could also consider a concat/stacking API that is based on einsum notation:
    cat(arr13,arr3) -> einstack(arr13,arr3,'ij,j->kij')
    glue(arr13,arr3) -> einstack(arr13,arr3,'ij,ij->ij')

  2. I am a bit scared of the automatic adding of leading dimensions, because it may hide passing the wrong array. Is there a way to turn it off?

@dkogan
Copy link
Owner

dkogan commented Feb 2, 2024 via email

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

No branches or pull requests

2 participants