Inhomogenous shape

In C3 week 4 assignment I receive this for padding function:

Failed test case: There was an error grading this function. Details shown in ‘got’ value below:.
Expected:
no exceptions,
but got:
setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part…

There is no exceptions when I rerun notebook myself and max and minimum second part of shape are the same.
The code is pretty simple and straightforward
What should I look for ?
May it come from reusing variable names in non-graded cells ?
I do need to restart almost every cell in notebook after full run if I want to check single function because of it.
By the way. All other parts of code and history have no errors or exceptions and are accepted by tests.

I’ve tried to change names of variables so that they weren’t reused but it didn’t help.

Oh. I’ve used function from keras and it worked perfectly.

I’m still having same issue. What is the version of your tensorflow & numpy.
Mine are:

tf: 2.12.0
np: 1.25.1

Edit: I had a bug in my implementation of n_gram_seqs which affected pad_seqs's output.

Hello @iamtalha ,

Send me your notebook via dm such that I can check where it went wrong. By clicking on the profile picture, you will see an option to message. There you can attach your notebook. Then we can discuss the issues here.

With regards,
Nilosree Sengupta