Skip to content

Conversation

@devmotion
Copy link
Member

This PR fixes TuringLang/Turing.jl#1595.

It is an alternative to #235 that does not require us to rewrite the primal less efficiently which would affect regular execution and other AD backends.

Copy link
Member

@torfjelde torfjelde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Not much to say here I think 🤷‍♂️ Nice work, again :)

@devmotion
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Apr 27, 2021
This PR fixes TuringLang/Turing.jl#1595.

It is an alternative to #235 that does not require us to rewrite the primal less efficiently which would affect regular execution and other AD backends.

Co-authored-by: David Widmann <devmotion@users.noreply.github.com>
@bors bors bot changed the title Fix Zygote issue with dot_observe [Merged by Bors] - Fix Zygote issue with dot_observe Apr 27, 2021
@bors bors bot closed this Apr 27, 2021
@bors bors bot deleted the dw/dot_observe branch April 27, 2021 19:32
Comment on lines +23 to +26
function dot_observe_fallback(spl, dists, value, vi)
increment_num_produce!(vi)
return sum(map(Distributions.loglikelihood, dists, value))
end
Copy link
Member

@torfjelde torfjelde Sep 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just making some changes to #309 and noticed the adjoint introduced here. Isn't this wrong? If dists = [Normal()] and value = [1.0, 2.0], then we'd end up with sum([loglikelihood(Normal(), 1.0)]), right? 😕

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but at least back then this case was not supported by the primal definition so it did not seem to be necessary to consider it here: https://github.com/TuringLang/DynamicPPL.jl/pull/235/files

It seems the primal definition was removed/changed though, maybe it's not even needed anymore?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ZygoteAD dot operator fails again

3 participants