Week 2, programming assignment, exercise 2

Hi everyone!
I don’t understand why this code:

 train_set_x_flatten = train_set_x_orig.reshape(-1, m_train)

won’t return the correct results as:

 train_set_x_flatten = train_set_x_orig.reshape( m_train, -1).T

I wanted to see if there was a way to implement this without using transpose. My reasoning was that we just want the resulting dataset to have m_train columns and some number of rows we don’t know(hence the -1). So, the first code is should mean the same thing, but the results aren’t the same.

Thanks in advance!

Hi @Nasim_Faridnia ,

You might find this post written by Paul M, one of our mentors, helpful.