Week2 Exercise2- mini batches

Hello,

I’m trying to verify my solution for the random_mini_batches function.

without posting code I get results which are of the expected shape but throw the assertion error that not all tests were passed.

Within the function I do something similar to

X[i*desired_size:(i+1)*desired size]

and for the final batch, which is smaller than the desired size I have something like

X[(i+1)*desired_size:]

This gives me the correct shapes, but somehow I still get the error… any help would be great.

Cheers,

W

Note that the inputs there are supposed to be the “shuffled” versions, right? The intent is that the minibatches are the same size on every “epoch”, but the actual contents of any given minibatch will be different.

1 Like

oh, what a silly mistake… Thank you for the prompt and clear response!

Glad to hear that was the solution. It’s just luck: I happened to see another case from someone with this issue last week, so it was fresh in my mind.

Onward! :nerd_face: