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

Define database for symbolic simplification #639

Open
ricardoV94 opened this issue Feb 8, 2024 · 3 comments
Open

Define database for symbolic simplification #639

ricardoV94 opened this issue Feb 8, 2024 · 3 comments

Comments

@ricardoV94
Copy link
Member

Description

As discussed in #637 PyTensor is geared mostly towards computational efficiency, although the same machinery could be easily tuned for symbolic simplification.

We could create a database of rewrites just for that goal

@jessegrabowski
Copy link
Member

This was something on the Theano team's radar, I think at least one of the original devs was interested in piggy-backing on sympy for this purpose. See this blog post, for example.

I also think this is a place where Eggs could really shine. See their symbolic algebra example here, it might be a good place to start?

@ricardoV94
Copy link
Member Author

ricardoV94 commented Feb 8, 2024

I would say easiest place to start is to just curate from the rewrites we already have. After that I'm confident egglog could be nice for better simplifications.

Given how easy it is to write egglog rewrites I would lean to bypass sympy completely.

@jessegrabowski
Copy link
Member

Yes, I don't like adding a sympy dependency either. It's non-trivial to switch between representations (sympy and pytensor), mostly because of broadcasting stuff. From my own experience, it would be easier to just start fresh on our side.

This does tie into the discussion we were having on #573 though, because algebraic rewrites might need more information about variables in order to execute. For example, $(x^a)^{\frac{1}{a}}$ can be rewritten to $x$, but only if we know x is non-negative.

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

No branches or pull requests

2 participants