tensorflow / tensorflow/probability
tfb.ScaleMatvecTriL does not work as expected
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 found out that the bijectors "ScaleMatvecX" are not working as expected, at least according to the documentation (https://www.tensorflow.org/probability/api_docs/python/tfp/bijectors/ScaleMatvecTriL). According to this, the bijectors "Compute Y = g(X; scale) = scale @ X".
However this is not the case:
scale_tril = [[1., 0.], [1., 1.]]
X = tf.random.uniform((2, 4))
scale_tril @ X # works as expected
tfb.ScaleMatvecTriL(scale_tril, validate_args=True)(X) # ValueError: Dimensions 2 and 4 are not compatible
Instead, the correct result occurs with
tfb.Chain([
tfb.Transpose(rightmost_transposed_ndims=2),
tfb.ScaleMatvecTriL(scale_tril, validate_args=True),
tfb.Transpose(rightmost_transposed_ndims=2),
])(X) # works as expected, equivalent to scale_tril @ X
I'm not really sure what is happening in the bijector.
Thank you!
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 with the ScaleMatvecTriL entry point and reproduce the reported ValueError using the scale_tril and X examples in the issue. Compare its documented scale @ X behavior with the working Transpose/ScaleMatvecTriL/Transpose chain, then update the implementation or documentation so the behavior and documentation agree.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100