tensorflow / tensorflow/probability

With TF 2.0 preview, "old-style" variational layers error with "Inputs to eager execution function cannot be Keras symbolic tensors"

Open
#519 20 comments 4 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

Hi,

I have unit tests for Convolution1DReparameterization , Convolution1DReparameterization etc. that basically look like this

x = tf.ones(shape = [150,1])
y = tf.ones(shape = [150])

model = tf.keras.Sequential(
  [tfpl.DenseReparameterization(
      units = 512,
      activation = "relu"),
   tfpl.DenseReparameterization(
      units = 1)])

model.compile(optimizer = 'adam', loss = "mse")
model.fit(x, y, steps_per_epoch = 1)

These run fine with TF 1, but with TF 2 preview I get

_SymbolicException: Inputs to eager execution function cannot be Keras symbolic tensors, but found [<tf.Tensor 'sequential/dense_reparameterization/divergence_kernel:0' shape=() dtype=float32>, <tf.Tensor 'sequential/dense_reparameterization_1/divergence_kernel:0' shape=() dtype=float32>]

Would you happen to know what is the cause here?
Are these "old-style" variational layers supposed to run with TF 2?

Many thanks in advance!!

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 provided tf.keras.Sequential reproducer using DenseReparameterization and the existing unit tests for the variational layers. Run it with the TensorFlow 2 preview and compare the eager-execution failure with TensorFlow 1 behavior. Done means the old-style layers have a verified TensorFlow 2 outcome and the relevant tests pass or clearly capture the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
keras, tensorflow
Domain
machine-learning, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.