AssertionError when fitting the lstm model
I am getting the following error when training my own lstm model.
I define "train_iter" as follows: train_iter = mx.io.NDArrayIter(X_train, y_train, batch_size=batch_size) where X_train and y_train are numpy.ndarray. The shapes of X_train and y_train are (203, 15, 18) and (203, 15), which means that I have 203 examples and the sequence length is 15.
Here comes the error information:
Traceback (most recent call last):
File "train_lstm.py", line 57, in
Any idea what might go wrong? Lots of thanks!
BYW, I get rid of the embedding layer as defined in the lstm.py and put my X_train directly to hidden layer. Is this why it is not working?
Is your provided_data empty?
@Godricly Thanks for your reply! I am pretty sure that X_train and y_train are not empty. I did print their shape right before build this train_iter = mx.io.NDArrayIter(X_train, y_train, batch_size=batch_size).
What I'm asking is not the actual data, but the provided_data and provided_label attributes. They are used in LSTM to infer network shape. Go checking them in your your DataIter and the DataBatch.
@Godricly thanks! It seems that you are right! I just wrote my own iterator.
I have the same question with Mr Wang. Do you have a solution? How to train my own data in the lstm