The example https://github.com/tensorflow/probability/blob/master/tensorflow_probability/examples/bayesian_neural_network.py imports mnist from tensorflow.contrib.learn.python.learn.datasets. However, this is no more available in TensorFlow 2. I don't even know where the API of tensorflow.contrib.learn.python.learn.datasets is documented, so it is not clear how to port the code in https://github.com/tensorflow/probability/blob/master/tensorflow_probability/examples/bayesian_neural_network.py to TensorFlow 2, where I should be using tensorflow_datasets.
tf.contrib was deprecated in TensorFlow 2.0, but you should be able to use MNIST from tensorflow_datasets or by using tf.keras.datasets.mnist. You can see an example of that here, in the TensorFlow 2.0 beginners' tutorial.
Will keep this issue open, as a reminder to update the example above to TF 2.0. Thank you for flagging! 馃檪
@dynamicwebpaige I was actually able to solve this problem, but I think you should update your examples to TF 2.0, ASAP.
In the new version of the example of BNN (https://github.com/tensorflow/probability/blob/master/tensorflow_probability/examples/bayesian_neural_network.py), this problem doesn't occur anymore, so I will close this issue.
Most helpful comment
@dynamicwebpaige I was actually able to solve this problem, but I think you should update your examples to TF 2.0, ASAP.