C3W3_Assignment Input Shape Error

When creating a post, please add:

  • Week # must be added in the tags option of the post.
  • Link to the classroom item you are referring to: Question Duplicates | Coursera
  • Description (include relevant info but please do not post solution code or your entire notebook)

I am getting the following errors in test for exercise 1

Layer 'sequential' has an incorrect output shape.
	Expected:(None, 16),
	Got:(None, 128).

Layer 'conc_1_2' has an incorrect input shape.
	Expected:[(None, 16), (None, 16)],
	Got:[(None, 128), (None, 128)].

Layer 'conc_1_2' has an incorrect output shape.
	Expected:(None, 32),
	Got:(None, 256).

22 tests passed
3 tests failed

I tried reshaping the input to (1,16) & (16,1) to experiment, but I am still seeing input shape set to 128. What am I missing?

So I found the cause and possible reason.

The reason this test failure happened was because I inputted 128 manually instead of d_feature in Embedding layer for parameter output_dim and LSTM layer for parameter units. The test cases will override d_feature (most likely) to ensure you are using this vs a manually inputted value.

I do wish the error message could have possibly hinted this at least.

The tests don’t parse your source code: they just call your functions and check the results. So I think the fact that they were able to tell you that your outputs were the wrong shape is really the best you can hope for here. Hard-coding things is always a mistake, unless they explicitly tell you to do that.