Tensorflow model.predict does things I dont understand

I build and trained a tensorflow Sequential model with input shape (1024,) and saved it. Then I tried loading it and test it out with a vector I’d generated:

from tensorflow.keras.models import load_model from data_generation_model import DataGenModel DataGenModel = DataGenModel() model = load_model("concentration_prediction_model_3.h5") spectrogram = DataGenModel.model_i60(100e-6) print(spectrogram) print(spectrogram.shape) prediction = model.predict(spectrogram) print(prediction)

calling .shape on the spectrogram gives me (1024,) but somehow it still raises following error:
‘’’
WARNING:tensorflow:Model was constructed with shape (None, 1024) for input KerasTensor(type_spec=TensorSpec(shape=(None, 1024), dtype=tf.float32, name=‘input_1’), name=‘input_1’, description=“created by layer ‘input_1’”), but it was called on an input with incompatible shape (32,).
Traceback (most recent call last):
File “C:/Users/#/Desktop/Python Projects/gas_concentration_prediction/main.py”, line 10, in
prediction = model.predict(spectrogram)
File “C:\Users#\Desktop\Python Projects\gas_concentration_prediction\venv\lib\site-packages\keras\utils\traceback_utils.py”, line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File “C:\Users#\Desktop\Python Projects\gas_concentration_prediction\venv\lib\site-packages\tensorflow\python\framework\func_graph.py”, line 1129, in autograph_handler
raise e.ag_error_metadata.to_exception(e)
ValueError: in user code:
File “C:\Users#\Desktop\Python Projects\gas_concentration_prediction\venv\lib\site-packages\keras\engine\training.py”, line 1621, in predict_function *
return step_function(self, iterator)
File “C:\Users#\Desktop\Python Projects\gas_concentration_prediction\venv\lib\site-packages\keras\engine\training.py”, line 1611, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File “C:\Users#\Desktop\Python Projects\gas_concentration_prediction\venv\lib\site-packages\keras\engine\training.py”, line 1604, in run_step **
outputs = model.predict_step(data)
File “C:\Users#\Desktop\Python Projects\gas_concentration_prediction\venv\lib\site-packages\keras\engine\training.py”, line 1572, in predict_step
return self(x, training=False)
File “C:\Users#\Desktop\Python Projects\gas_concentration_prediction\venv\lib\site-packages\keras\utils\traceback_utils.py”, line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File “C:\Users#\Desktop\Python Projects\gas_concentration_prediction\venv\lib\site-packages\keras\engine\input_spec.py”, line 227, in assert_input_compatibility
raise ValueError(f’Input {input_index} of layer “{layer_name}” ’
ValueError: Exception encountered when calling layer “sequential” (type Sequential).
Input 0 of layer “dense” is incompatible with the layer: expected min_ndim=2, found ndim=1. Full shape received: (32,)
Call arguments received:
• inputs=tf.Tensor(shape=(32,), dtype=float32)
• training=False
• mask=None

‘’’
if someonee has an idea why and/or how to fix it please help!