tensorflow / tensorflow/probability

tfb.ScaleMatvecTriL does not work as expected

Open
#1,098 2 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 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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.