tensorflow / tensorflow/probability

NotImplementedError with tensorflow_probability.layers.IndependentNormal

Open
#1,500 5 comments 1 reaction 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

Please see MWE below. The code gives a NotImplementedError after outputs = tfpl.IndependentNormal(event_shape = encoded_shape) (layer3). The model, however, is constructed correctly. This issue was originally raised in the corresponding downstream R library: https://github.com/rstudio/tfprobability/issues/139.

import tensorflow as tf
import tensorflow_probability as tfp
tfkl = tf.keras.layers
tfpl = tfp.layers

input_shape = [28, 28, 1]
encoded_shape = 2

inputs = tf.keras.Input(shape=input_shape)
layer1 = tfkl.Flatten()(inputs)
layer2 = tfkl.Dense(units=10)(layer1)
layer3 = tfkl.Dense(units=tfpl.IndependentNormal.params_size(encoded_shape)) (layer2)
outputs = tfpl.IndependentNormal(event_shape = encoded_shape) (layer3)
model=tf.keras.Model(inputs, outputs)
model.summary()

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 by running the provided Python MWE and inspect the tensorflow_probability.layers.IndependentNormal entry point, especially the call after Dense.params_size(encoded_shape). Done means the model can be constructed and summarized without the reported NotImplementedError.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.