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
[Feature Request] Distributions should track their variables #1282
Comments
I just found the following in the tensorflow documentation:
So it seems like the current behavior is expected. Does anyone know if there's a way to access a distribution's variables without wrapping it inside |
#946 and tensorflow/tensorflow#47264 seem to be related to this. |
To answer my own question: it seems like one acceptable way of handling the variable tracking is to separately create the shift_and_scale layer and then manually assign it to the bijector so that the variables get tracked. There are several examples of such pattern in the tfp repo, for example in the glow flow: probability/tensorflow_probability/python/bijectors/glow.py Lines 542 to 548 in 80980fb
|
Accessing the variables of a distribution, for example one transformed with a
RealNVP
bijectors, always results in an empty tuple. It would be really useful if these variables were accessible in the same way as they are fromtf.keras.Layer
andtf.keras.Model
. In the script below,nvp.variables
is empty whereas thetf.Model
containing the distribution correctly returns the variables (model.variables
).The text was updated successfully, but these errors were encountered: