-
Notifications
You must be signed in to change notification settings - Fork 47
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
Caching Free Integrated Aesara Objective #629
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #629 +/- ##
============================================
- Coverage 88.16% 34.33% -53.84%
============================================
Files 79 93 +14
Lines 5257 5884 +627
============================================
- Hits 4635 2020 -2615
- Misses 622 3864 +3242
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks very nice and useful!, don't get one point yet.
|
||
return ret | ||
|
||
def __deepcopy__(self, memodict=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is serialization of aesara objects possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(fine without too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think pickling would require some additional work, see https://aesara.readthedocs.io/en/latest/library/compile/function.html#aesara.compile.function.function_dump
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested it though.
log_prob = self._coeff * self._objective.inner_ret[FVAL] | ||
outputs[0][0] = np.array(log_prob) | ||
|
||
def grad(self, inputs, g): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
howby what dark magic is it possible that inputs is not used here? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a note about this. The trick is that we already know what the inputs here are going to look like when computing inner_ret
, so we can ignore them here and just use the precomputed values. This also has the advantage that we only spend a minimal amount of time in aesara functions, since the bulk of computation is done in the outer call_unprocessed
, which improves performance in multithreaded settings as we avoid a lot of locking of aesara functions.
Co-authored-by: Yannik Schälte <31767307+yannikschaelte@users.noreply.github.com>
Simplifies the construction of aesara objectives. This implementation allows exploiting integrated evaluation of the wrapped objective.