-
Notifications
You must be signed in to change notification settings - Fork 3
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
idea: typesafe einsum #2
Labels
enhancement
New feature or request
Comments
Good idea! Let me check how to do first. thanks. |
@bgavran Thanks. It's not easy to provide type safe einsum. |
Hi @tscholak, I found a way to do By defining following type class, I can implement by type-level programming. class (KnownSymbol s, Num n) => Einsum s r n where
einsum :: r in ghci λ> :t einsum @"ijk,kl->ijl"
einsum @"ijk,kl->ijl"
:: Num n =>
Tensor '[0, 1, 2] n -> Tensor '[2, 3] n -> Tensor '[0, 1, 3] n
λ> :t einsum @"ij->ji"
einsum @"ij->ji" :: Num n => Tensor '[0, 1] n -> Tensor '[1, 0] n But I still need sometimes to finish it. |
@leptonyu cool, this looks promising! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://rockt.github.io/2018/04/30/einsum
The text was updated successfully, but these errors were encountered: