I'm trying to reproduce a snippet of code I found on google colaboratory (here) and I have problems with the methods used (tfb.Shift and tfp.util.TransformedVariable) that I can't find in the documentation.
import numpy as np
import tensorflow.compat.v2 as tf
import tensorflow_probability as tfp
tfb = tfp.bijectors
tfd = tfp.distributions
tf.enable_v2_behavior()
constrain_positive = tfb.Shift(np.finfo(np.float64).tiny)(tfb.Exp())
amplitude_var = tfp.util.TransformedVariable(
initial_value=1.,
bijector=constrain_positive,
name='amplitude',
dtype=np.float64)
I get
AttributeError: module 'tensorflow_probability.python.bijectors' has no attribute 'Shift'
and
AttributeError: module 'tensorflow_probability.python.util' has no attribute 'TransformedVariable'
Could be a version issue?
I'm using tensorflow 2.0.0 and tensorflow-probability 0.8.0 and I see that in colab notebook is used @tf.function so I thought it used tensorflow 2.0.0 too.
What can I use instead?
Thank you very much