fchollet / deep-learning-with-python-notebooks

Jupyter notebooks for the code samples of the book "Deep Learning with Python"
MIT License
18.61k stars 8.63k forks source link

Problem with listing 8.27 #155

Open errhernandez opened 3 years ago

errhernandez commented 3 years ago

Hello. I have tried running the listings for a VAE example 8.23 to 8.28, both on a stand-alone python script in my workstation and as a colab jupyter notebook. Both attempts fail similarly at the model fit stage (end of listing 8.27) with the message below; the source is word-for-word what appears on the book, and on the notebook here. Any ideas?

Thanks

Epoch 1/10

TypeError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name) 59 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, ---> 60 inputs, attrs, num_outputs) 61 except core._NotOkStatusException as e:

TypeError: An op outside of the function building code is being passed a "Graph" tensor. It is possible to have Graph tensors leak out of the function building context by including a tf.init_scope in your function building code. For example, the following function will fail: @tf.function def has_init_scope(): my_constant = tf.constant(1.) with tf.init_scope(): added = my_constant * 2 The graph tensor has name: dense_9/BiasAdd:0

During handling of the above exception, another exception occurred:

_SymbolicException Traceback (most recent call last) 9 frames /usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name) 72 raise core._SymbolicException( 73 "Inputs to eager execution function cannot be Keras symbolic " ---> 74 "tensors, but found {}".format(keras_symbolic_tensors)) 75 raise e 76 # pylint: enable=protected-access

_SymbolicException: Inputs to eager execution function cannot be Keras symbolic tensors, but found [<tf.Tensor 'dense_9/BiasAdd:0' shape=(None, 2) dtype=float32>, <tf.Tensor 'dense_8/BiasAdd:0' shape=(None, 2) dtype=float32>]