Input 0 of layer sequential is incompatible with the layer

用Keras-RNN-LSTM做模型时,报错

# 模型训练
from keras.callbacks import ModelCheckpoint
Train = True  

if __name__ == "__main__": 
    if Train == True:  
        train_iter = xs_gen()  
        val_iter = xs_gen(train=False)  

        ckpt = keras.callbacks.ModelCheckpoint(  
            filepath='best_model.{epoch:02d}-{val_loss:.4f}.h5',  
            monitor='val_loss', save_best_only=True,verbose=1)  
        

        model = build_model()  
        opt = Adam(0.0002)  
        model.compile(loss='categorical_crossentropy',  
                    optimizer=opt, metrics=['accuracy'])  
        print(model.summary())  

报错:

Found 400 train items.
list 1 is 3.0
Epoch 1/50
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-3994b0506699> in <module>
     28             validation_data = val_iter,
     29             validation_steps = (Long - Lens)//Batch_size,     # ###gai
---> 30             callbacks=[ckpt],
     31             )  
     32         model.save("finishModel.h5")

ValueError: Input 0 of layer sequential is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, None)