C1W2 Assignment - Inputs to a layer should be tensors

Here is my model definition

Define the model

model = tf.keras.models.Sequential([ 
      tf.keras.layers.Flatten(input_shape=(28, 28)),
      tf.keras.layers.Dense(512, activation=tf.nn.relu),
      tf.keras.layers.Dense(10, activation=tf.nn.softmax)
]) 

When I call this method history = model.fit(x_train, y_train, epochs=10, callbacks=[callbacks])

I am getting the following error


TypeError Traceback (most recent call last)
in
----> 1 hist = train_mnist(x_train, y_train)

in train_mnist(x_train, y_train)
22 # Fit the model for 10 epochs adding the callbacks
23 # and save the training history
—> 24 history = model.fit(x_train, y_train, epochs=10, callbacks=[callbacks])
25
26 ### END CODE HERE

/opt/conda/lib/python3.8/site-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.traceback)
—> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb

/opt/conda/lib/python3.8/site-packages/keras/engine/input_spec.py in assert_input_compatibility(input_spec, inputs, layer_name)
194 # have a shape attribute.
195 if not hasattr(x, ‘shape’):
→ 196 raise TypeError(f’Inputs to a layer should be tensors. Got: {x}')
197
198 if len(inputs) != len(input_spec):

TypeError: Inputs to a layer should be tensors. Got: <keras.engine.sequential.Sequential object at 0x7fd14b898550>

Any thoughts? Help is highly appreciated. Thanks in advance.

Please check type(x_train)