Skip to content

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

@skeydan

Description

@skeydan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions