tensorflow / tensorflow/probability
Crash when manually calling DenseReparameterization.build()
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 first applying the layer inside a symbolic loop, I have to manually call build before the loop. However, this fails for two reasons right now. First, the input shape is expected to be 2D but should only be 1D. Second, the data type of the layer is not yet set. See dense_variational.py#L146.
Example:
layer = tfp.layers.DenseReparameterization(20, tf.tanh)
layer.build((10,))
# ValueError: Shape (10,) must have rank at least 2
layer = tfp.layers.DenseReparameterization(20, tf.tanh)
layer.build((9999, 10))
# TypeError: Cannot convert value None to a TensorFlow DType.
layer = tfp.layers.DenseReparameterization(20, tf.tanh)
layer._dtype = tf.float32
layer.build((9999, 10))
# 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 at tensorflow_probability/python/layers/dense_variational.py#L146 and reproduce the three DenseReparameterization.build() examples from the issue. Trace the input-shape and dtype handling during build; done means a one-dimensional input shape builds successfully without manually assigning the layer dtype, while preserving the existing valid behavior.
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