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

Make Features less stateful #832

Merged

Conversation

brandonwillard
Copy link
Member

@brandonwillard brandonwillard commented Feb 21, 2022

This PR moves most Features' state (e.g. variables/collections used to track the state of a FunctionGraph) to the FunctionGraph upon which the Features are operating, instead of dedicating one Feature and its state to a single FunctionGraph—as is currently done. With these changes, a few complications surrounding FunctionGraph pickleing and the general dynamic addition/attachment of Features are more easily addressed and/or avoided altogether.

Some more details:

  • Many Features aren't truly stateful in a way that makes the relevant state specific to the Feature as much as the FunctionGraph. In other words, most Features really only care about the state of the FunctionGraphs on which they operate, so, if that state is held by the FunctionGraphs themselves, Features can be more versatile.
  • It's not possible/easy to transfer Features from one FunctionGraph to another (e.g. as is attempted in FunctionGraph.clone_get_equiv), because many Features are unnecessarily dedicated to a single FunctionGraph.

@brandonwillard brandonwillard self-assigned this Feb 22, 2022
@brandonwillard brandonwillard added the refactor This issue involves refactoring label Feb 22, 2022
@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Merging #832 (d54ee84) into main (78253b8) will increase coverage by 0.13%.
The diff coverage is 86.19%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #832      +/-   ##
==========================================
+ Coverage   74.87%   75.00%   +0.13%     
==========================================
  Files         194      194              
  Lines       50123    50072      -51     
  Branches    12098    12095       -3     
==========================================
+ Hits        37530    37559      +29     
+ Misses      10266    10189      -77     
+ Partials     2327     2324       -3     
Impacted Files Coverage Δ
aesara/tensor/basic.py 89.99% <ø> (ø)
aesara/tensor/rewriting/basic.py 92.12% <ø> (ø)
aesara/tensor/rewriting/shape.py 81.58% <79.34%> (+1.66%) ⬆️
aesara/compile/debugmode.py 60.25% <79.36%> (-1.02%) ⬇️
aesara/graph/fg.py 89.01% <81.81%> (-0.45%) ⬇️
aesara/graph/type.py 91.46% <84.21%> (-2.48%) ⬇️
aesara/graph/destroyhandler.py 84.83% <88.31%> (+14.90%) ⬆️
aesara/compile/function/types.py 79.81% <90.90%> (+0.18%) ⬆️
aesara/graph/features.py 70.21% <96.92%> (+4.90%) ⬆️
aesara/compile/builders.py 79.16% <100.00%> (ø)
... and 5 more

@brandonwillard brandonwillard merged commit 204810a into aesara-devs:main Mar 9, 2023
@brandonwillard brandonwillard deleted the make-features-less-stateful branch March 9, 2023 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor This issue involves refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants