-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Error in HamiltonianMonteCarlo when using gather in log_prob function #1837
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to run a Hamiltonian MCMC on a target distribution whose implementation involves a call to tf.gather. The following code:
raises
ValueError: The two structures don't have the same nested structure.
followed by a very long and (to me) cryptic message. Replacing the return statement in the logprob function with the commented line gets rid of the error. The error seems to appear whenever the result of logprob contains atf.gather
subexpression.The error also disappears when I remove the
@tf.function
decorator from the definition ofrun_chain
. However, this comes at a huge performance cost.How can I efficiently sample from a distribution whose log-probability involves a
tf.gather
expression?The text was updated successfully, but these errors were encountered: