tensorflow / tensorflow/probability
Likely bug in `tfp.math.fill_triangular_inverse`
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
I'm on tfp 0.16.0, python 3.8, windows10
Trying to extract a triangluar part of a matrix into a vector, I came across:
print(
tfp.math.fill_triangular_inverse([
[4, 0, 0],
[6, 5, 0],
[3, 2, 1]
])
)
print(
tfp.math.fill_triangular_inverse([
[4, 0, 0],
[6, 5, 0],
[3, 2, 1]
], upper=True)
)
which produces
tf.Tensor([1 2 3 4 5 6], shape=(6,), dtype=int32)
tf.Tensor([4 0 0 7 7 3], shape=(6,), dtype=int32)
and this makes absolutely no sense to me - where does the 7 come from and the 3 is clearly not part of the upper triangle....
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 reproducing both tfp.math.fill_triangular_inverse calls from the issue with the shown matrix and upper=True. Check the documented ordering and expected upper-triangle contents, then trace the implementation responsible for the unexpected 7 values. Done means the upper-triangle result contains only the intended matrix elements and a regression test covers this example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100