-
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
MultivariateNormalTriL Layer appears to be incompatible with tf.keras in tf 2.16.1 and tfp 0.24 #1809
Comments
It appears that simply import tf_keras as tfk and using So maybe that's suggestion for changing the documentation then. |
Thanks for the report! I believe we have changed all of our documentation/examples in the TFP codebase to use I'll investigate to see why the documentation at tensorflow.org has not been updated. |
There appears to be a breaking change in the way MultivariateNormalTriL works together with tf.keras in tf 2.16.1 and tfp 0.24.0, tf_keras version 2.16.0
I'm using python 3.11.8 on a Mac M3, but can reproduce the issue also on a Linux Machine. I did not try a different python version.
The last version I tested where this problem does not occur is tf 2.14.0 and tfp 0.22.0 with python 3.10.13 - I did not test intermediate versions.
Here is a minimal example to reproduce the issue - it simply implements the example from the documentation (https://www.tensorflow.org/probability/api_docs/python/tfp/layers/MultivariateNormalTriL)
This raises
Using the function API from keras results in a related but different error:
This raises
Maybe that helps identifying the problem. I appears that MultivariateNormalTriL is not recognised as a layer anymore, but as a distribution function.
Using the example from https://www.tensorflow.org/probability/api_docs/python/tfp/layers/DistributionLambda seems to support this assumption. It, too, raises the error
ValueError: Only instances of keras.Layer can be added to a Sequential model.
.Any help is greatly appreciated!
The text was updated successfully, but these errors were encountered: