tensorflow / tensorflow/probability
DistributionLambda in conjunction with TransformedDistribution and ScalarFunctionWithInferredInverse raises Exception
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 am using:
- TFP Version 0.16.0
- TF Version 2.8.1
I am training a simple model on a density estimation task.
When using a DistributionLambda in conjunction with a TransformedDistribution and a ScalarFunctionWithInferredInverse bijector i get the following Exception:
ValueError: Exception encountered when calling layer "distribution_lambda" (type DistributionLambda).
Cannot infer tensor rank of objective values.
Call arguments received:
• inputs=tf.Tensor(shape=(None, 12), dtype=float32)
• args=<class 'inspect._empty'>
• kwargs={'training': 'None'}
Error: Process completed with exit code 1.
However, using the same distribution as a custom Loss function works.
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 cml/old_faithful.py and reproduce the failure using DistributionLambda, TransformedDistribution, and ScalarFunctionWithInferredInverse with the reported TFP and TF versions. Compare this path with the custom loss that works, using the linked full traceback to locate the rank-inference failure; done means the distribution can be used in DistributionLambda without the exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100