CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers

Ch2 TFP - AttributeError: module 'tensorflow' has no attribute 'contrib'

RyanMarten opened this issue · 1 comments

https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter2_MorePyMC/Ch2_MorePyMC_TFP.ipynb

In the Tensorflow port of Chapter 2, there is an error when the first cell in run:

AttributeError                            Traceback (most recent call last)
<ipython-input-1-103d57c84299> in <module>()
     38 
     39 import tensorflow as tf
---> 40 tfe = tf.contrib.eager
     41 
     42 # Eager Execution

AttributeError: module 'tensorflow' has no attribute 'contrib'

@RyanMarten The notebooks need to be upgraded to the latest versions of tf and tfp, which Collab uses by default. If you downgrade the versions in Collab with the following code, the notebook works:

!pip install tensorflow==1.13.1
!pip install tensorflow-probability==0.6.0