When executing in order each code of C4_W3_Lab_1_VAE_MNIST.ipynb, the following error raises at:
“encoder, decoder, vae = get_models(input_shape=(28,28,1,), latent_dim=LATENT_DIM)”
Error:
“ValueError: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces keras.layers
and keras.operations
). You are likely doing something like:”
And it’s not possible to continue.
I was able to complete this lab, by restarting the session and adding a new block of code to install version 2.15 in Colab at the beginning.
This new block of code inserted before the first lab’s block of code called “Imports” was edited as:
"
!pip install tf-keras==2.15 --quiet
!pip install tensorflow==2.15 --quiet
!pip install keras==2.15 --quiet
"
Then, by running all blocks of code in order again, including this new first one, it is possible to complete this lab without any issue.
Hope it helps.