Project DelphiTensors Workshop

Reshape

Reshape only reinterprets numbers in memory order. It never moves a value; it re-reads the same flat run of numbers with a new set of brackets.

wrong = photo.reshape(3, 512, 512) # runs, but scrambles the image

That line raises no error. It produces exactly the shape you asked for, and the picture inside it is destroyed.