rewrite test helper#2103
Open
ricardoV94 wants to merge 2 commits intopymc-devs:mainfrom
Open
Conversation
Provides RewriteTester class and rewrite_test factory that clone a graph, apply rewrites to the clone, and offer structural/numerical assertions without compiling full-mode functions.
e906a7b to
86aded4
Compare
11 tasks
Member
|
Why do you think a numerical test should be standard after a structural comparison? It seems like the structural should be sufficient in most cases. |
Member
Author
I also like structural check but we've been bit by that in the past. We got the structure we expected but there was a flaw in it. The numbers are less likely to be fooled |
Member
Author
|
Example the square(sqrt) rewrite we got the wrong order recently. Needed nan in the test but you get the idea |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a helper to streamline our rewrite tests, according to what I these days feel is the best strategy:
For instance, the test in #2101 would look like:
I really don't like op counts, because it can miss stuff like AdvancedSubtensor become AdvancedSubtensor1, or Blockwise(Dot) become Dot, or Gemm, and it seems like we are optimizing stuff when we are not. Still I added the helpers to count ops...
The main goal though is to reduce friction / have a baseline for contributions