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

Generalized Tensor Algebra and Graph Normalization #5

Closed
brandonwillard opened this issue Mar 5, 2019 · 2 comments · Fixed by #13
Closed

Generalized Tensor Algebra and Graph Normalization #5

brandonwillard opened this issue Mar 5, 2019 · 2 comments · Fixed by #13
Labels
help wanted Extra attention is needed important Features and issues that need to be addressed ASAP miniKanren This issue involves miniKanren goals

Comments

@brandonwillard
Copy link
Contributor

brandonwillard commented Mar 5, 2019

Now that we're actively working toward support for more than one backend (e.g. Theano and TensorFlow), we'll also need to generalize some tensor algebra operations and define our own normalized/canonical graph forms.

For example, addition, dot products, index operations, etc., are all pretty generalizable, so we'll need corresponding meta operations. We can then define our math-level relations (in miniKanren) using those objects—which we're already doing to varying degrees.

Concomitant with that is the need to develop relations and/or meta object logic for meta graph normalization. Using addition as an example, when variable outputs of addition operations are added together, the entire graph can be collapsed into a single addition operation given the combined inputs (which might also need to be deterministically ordered).

Normalization can always be performed manually and/or as part of certain internal steps (e.g. Theano does this during function creation), but some normalizations can also be built into the/a factory-like function that constructs sub-graphs for an operation (e.g. tt.add and tf.add).

For some operations—like the standard associative, commutative and variadic ones—"on-the-fly" normalization is most likely preferables. In general, as long as an operation's normalization steps are quick and cheap, we might want to consider this.

A complete example of how this work can be done in miniKanren is given in #6.

@twiecki
Copy link
Member

twiecki commented Mar 5, 2019

Would things be simpler if Theano support was dropped?

@brandonwillard
Copy link
Contributor Author

Not so much; plus, Theano support might actually be done. We just need to focus exclusively on the meta objects now, but that stops us from being able to make use of some overlapping/related backend-end-specific features (e.g. Theano's existing graph normalization/canonicalization). Even so, Theano's normalization serves a few different purposes and doesn't completely provide what we'll need, so we would have to do this anyway.

@brandonwillard brandonwillard added important Features and issues that need to be addressed ASAP help wanted Extra attention is needed labels Jun 1, 2019
@brandonwillard brandonwillard added the miniKanren This issue involves miniKanren goals label Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed important Features and issues that need to be addressed ASAP miniKanren This issue involves miniKanren goals
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants