aesara icon indicating copy to clipboard operation
aesara copied to clipboard

Reduce `aesara.compile.builders.infer_shape`'s recursions

Open brandonwillard opened this issue 2 years ago • 2 comments

aesara.compile.builders.infer_shape recurses in a way that's not optimal for large graphs. This is especially problematic for large Scan graphs, since Scan.infer_shape uses the aforementioned infer_shape function.

brandonwillard avatar Aug 16 '22 22:08 brandonwillard

@brandonwillard can you please share an example of a large Scan graph with which I can replicate this issue locally? I would like to attempt to solve this bug.

anirudhacharya avatar Oct 16 '22 09:10 anirudhacharya

@brandonwillard can you please share an example of a large Scan graph with which I can replicate this issue locally? I would like to attempt to solve this bug.

A useful MWE in this situation would, for example, demonstrate how aesara.compile.builders.infer_shape is stack bound (e.g. turn the issue into a bug via a RecursionError). Such an example could also serve as a good unit test for the changes requested by this issue.

Unfortunately, I don't have one on hand, but, regardless, creating one would serve as good first steps toward solving this issue, especially since it could clarify some details regarding exactly when/how the current approach becomes problematic.

brandonwillard avatar Oct 17 '22 20:10 brandonwillard