Do you have RGB images perchance and expect only a single channel?
I’m asking because apparently images.view triples the shape[0]. You might want to try printing images.shape before and after the view.
A quick fix might be averaging over the channel dimension to eliminate the excess data.
Best regards
Thomas
P.S.: When you post code, the triple backticks (```) can be used at the beginning and end of the code to preserve the code formatting.