title: TypeError: 'Tensor' object is not callable | Keras Autoencoder
body: <p>I'm creating an autoencoder in Keras following <a href="https://blog.keras.io/building-autoencoders-in-keras.html" rel="nofollow noreferrer">this tutorial</a> and I keep getting the following error. </p>
  
  <pre><code>decoder = tf.keras.Model(encoded_input, decoded(input_img))
  TypeError: 'Tensor' object is not callable
  </code></pre>
  
  <p>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. </p>
  
  <p>Here is a minimal working example of my code: </p>
  
  <pre><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))
  </code></pre>