Skip to content

More syntactic sugar for named contractions #32

Description

@thomasahle

By defining the right helper types, we could make

Z = X-'j-i'-Y

Equivalent to F.dot(X, Y, ('j', 'i')) which could help readability.

We can also make a renaming syntax:

Z = X-'j-i-'

which is equivalent to X.rename(j='i').
Note the extra - in the string above, which disambiguates it from X-'j-i' which would be part of a contraction.

Other alternatives

  • A simpler idea would be adding the syntax dot(X, 'j', 'i,' Y) as an alternative to the current dot syntax derived from PyTorch.
  • If the motivation is just easier "matrix like" algebra, we could also add the option for left/right co/contra variant edges...
  • We already have the graph notation, F.graph('X -j-i- Y', X=X, Y=Y) which is arguably the most flexible and direct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions