title: ValueError: Layer sequential_20 expects 1 inputs, but it received 2 input tensors
body: <p>I am trying to build a simple Autoencoder using the KMNIST dataset from Tensorflow and some sample code from a textbook I'm using, but I keep getting an error when I try to fit the model.</p>
  <p>The error says <code>ValueError: Layer sequential_20 expects 1 inputs, but it received 2 input tensors.</code></p>
  <p>I'm really new to TensorFlow, and all my research on this error has baffled me since it seems to involve things not in my code.
  <a href="https://stackoverflow.com/questions/61006764/valueerror-layer-model-2-expects-2-inputs-but-it-received-1-input-tensors">This thread</a> wasn't helpful since I'm only using sequential layers.</p>
  <p>Code in full:</p>
  <pre><code>import numpy as np
  import tensorflow as tf
  from tensorflow import keras
  import tensorflow_datasets as tfds
  import pandas as pd
  import matplotlib.pyplot as plt
  
  #data = tfds.load(name = 'kmnist')
  
  (img_train, label_train), (img_test, label_test) = tfds.as_numpy(tfds.load(
      name = 'kmnist',
      split=['train', 'test'],
      batch_size=-1,
      as_supervised=True,
  ))
  
  img_train = img_train.squeeze()
  img_test = img_test.squeeze()
  
  ## From Hands on Machine Learning Textbook, chapter 17
  
  stacked_encoder = keras.models.Sequential([
      keras.layers.Flatten(input_shape=[28, 28]),
      keras.layers.Dense(100, activation=&quot;selu&quot;),
      keras.layers.Dense(30, activation=&quot;selu&quot;),
  ])
  
  stacked_decoder = keras.models.Sequential([
      keras.layers.Dense(100, activation=&quot;selu&quot;, input_shape=[30]),
      keras.layers.Dense(28 * 28, activation=&quot;sigmoid&quot;),
      keras.layers.Reshape([28, 28])
  ])
  
  stacked_ae = keras.models.Sequential([stacked_encoder, stacked_decoder])
  stacked_ae.compile(loss=&quot;binary_crossentropy&quot;,
                     optimizer=keras.optimizers.SGD(lr=1.5))
  
  history = stacked_ae.fit(img_train, img_train, epochs=10,
                           validation_data=[img_test, img_test])
  </code></pre>