tensorflow / tensorflow/probability

Errors in cifar10_bnn.py example

Open
#856 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Hello,

I tried to run the cifar10_bnn.py example and ran into two issues described bellow.

Versions used :
tf.__version__ == '2.2.0-rc1'
tfp.__version__ == '0.9.0'
First issue : placeholder and eager mode

RuntimeError: tf.placeholder() is not compatible with eager execution.
which I solved calling
tf.disable_eager_execution()
at the top of the document

Second issue : probs attribute of categorical density

After solving the second issue I ran into another error :
TypeError: Fetch argument None has invalid type <type 'NoneType'>
caused by the following line :

probs = np.asarray([sess.run((labels_distribution.probs),
                                     feed_dict={handle: heldout_handle})
                            for _ in range(FLAGS.num_monte_carlo)])

It turned out that labels_distribution.probs was None.
Changing it to labels_distribution.probs_parameter() solved the issue.

Questions
  • Does these changes make sense ?
  • If so, can someone make them in the repo so that the next person that tries to run it will not run into these issues ?

Thank you very much

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the cifar10_bnn.py example with the TensorFlow 2.2.0-rc1 and TensorFlow Probability 0.9.0 versions reported here. Check the placeholder/eager-execution failure and the labels_distribution.probs usage; done means the example runs without either error and its Monte Carlo probability fetch succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.