I'm creating an autoencoder in Keras following this tutorial and I keep getting the following error.
decoder = tf.keras.Model(encoded_input, decoded(input_img))
TypeError: 'Tensor' object is not callable
I believe it's something to do with not being able to use tensors in this way because of the nature of this type of object but I have some gaps in understanding of why and how to go about solving this.
Here is a minimal working example of my code:
# input_img input placeholder
input_img = tf.keras.layers.Input(shape=(16, 16, 1), name ="input")
encoded = tf.keras.layers.Dense(encoding_dim, activation='relu')(input_img)
decoded = tf.keras.layers.Dense(256, activation='sigmoid')(encoded)
autoencoder = tf.keras.Model(input_img, decoded)
encoder = tf.keras.Model(input_img, encoded)
encoded_input = tf.keras.layers.Input(shape=(encoding_dim,))
decoder = tf.keras.Model(input_img, decoded(encoded_input))