This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
Switch graph accumulator to use new support calculator #1013
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.
Summary:
We need to know the support -- the set of possible values of a stochastic expression -- to handle compiling models of the form
where some_finite_rv has small, finite support. It needs to be small and finite because we're going to actually call some_rv with each possible value.
For our purposes we define small as <= 1000. (We should add a mechanism to tweak this parameter later.)
Previously we had each node compute its own support, but (1) this is not a concern of the node, and (2) we need extra mechanisms to also compute approximate support size, and (3) the implementation was recursive, which crashes if the model has a path that exceeds python's recursion limit.
We now have a module using the same nonrecurisve, mutation-aware algorithm that the type checker uses. In this diff I switch over the graph accumulator to use the new mechanism. In the next diff I will delete the now-unused support instance methods.
Reviewed By: wtaha
Differential Revision: D30738627