Week 4 : Assignment: Shape Error during Metric Evaluation

mse, mae = compute_metrics(series_valid, rnn_forecast)

is throwing off an error, specifically:

InvalidArgumentError: Incompatible shapes: [1150,64] vs. [1150] [Op:SquaredDifference]

Please print the model summary and notice the shape of the final layer. Shapes of forecast and true_series must match.

2 Likes

still having problems, can i send you my notebook so that you can identify where i am going wrong?

Please click my name and message your notebook as an attachment.

1 Like

@Ali_Zahid

Here’s a hint:

The output shape of the last layer should be (None, 1).
Yours is (None, None, 1)
Please think about where the correction(s) should be made.

2 Likes

return_sequences, got it

I’m also using return_sequences = True for the first LSTM layer but for whatever reason I still have an extra dimension. What else could be causing this incorrect shape?

Nevermind, I got it to work. I was loading an earlier version of my DNN

mine is (none,none,1) but it is still showing same error please reply

Please click my name and message your notebook as an attachment.

i’ve did the same thing but got the same error:

There was a problem grading your submission. Details:
Incompatible shapes: [1150,64] vs. [1150] [Op:SquaredDifference]

1 Like

Please pay attention to model output shape and fix the NN.

1 Like