-
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
Recent change in tf.vectorized_map breaks MCMC when batch_shape = 1 #1071
Comments
The bug seems to be introduced in tensorflow/tensorflow@c2e5944 it is discovered in pymc-devs/pymc4#317 (comment). @davmre I am assigning this to you since you have a big more context about the change. |
Thanks for reporting; this is a pretty weird issue. After poking for a bit I think the root of the problem is that this snippet computing the gradient of @tf.function(autograph=False)
def gather_grad(x):
with tf.GradientTape() as tape:
tape.watch(x)
v = tf.gather(x, 0)
g = tape.gradient(v, x)
return g
gather_grad(x=tf.convert_to_tensor([1.])) returns a The contribution of tensorflow/tensorflow@c2e5944 is somewhat tangential: it calls I think we'll need to consult TF Core team on the most natural fix: it might make sense to change the gradient definition for |
Actually it might make more sense to just work around this at the TFP level by calling |
Minimal reproducible example:
returns:
The text was updated successfully, but these errors were encountered: