tensorflow / tensorflow/probability
tfp.distributions.RelaxedBernoulli produces samples on the boundary with inf log_prob
Open
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
When using relaxed_bernouli to sample on boundary, it outputs inf or NaN log_prob.
import tensorflow as tf
import tensorflow_probability as tfp
tf.random.set_seed(2)
dist = tfp.distributions.RelaxedBernoulli(temperature = tf.constant(0.005), logits = tf.constant(-5.0))
sample = dist.sample()
print('Sample: {}'.format(sample)) # should be non-zero value
print('Log prob: {}'.format(dist.log_prob(sample).numpy())) # should be non-inf value
dist = tfp.distributions.RelaxedBernoulli(temperature = tf.constant(0.0), logits = tf.constant(-5.0))
sample = dist.sample()
print('Sample: {}'.format(sample)) # should be non-nan value
print('Log prob: {}'.format(dist.log_prob(sample).numpy())) # should be non-nan value
Outputs:
Sample: 0.0
Log prob: inf
Sample: nan
Log prob: nan
Expected Outputs:
Sample: normal value but not not 0.0
Log prob: normal value not not inf
Sample: something not nan
Log prob: something not nan
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied RelaxedBernoulli reproduction with temperatures 0.005 and 0.0, then inspect the RelaxedBernoulli sampling and log_prob implementation. Determine how boundary or non-finite samples arise and verify that both examples produce finite, non-NaN samples and log probabilities.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- tensorflow
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100