Project DelphiTensors Workshop

Mistake: the shape proves reshape worked

“Both results have shape (3, 2, 2), so both are valid CHW images.”

hwc = np.arange(12).reshape(2, 2, 3) right = hwc.transpose(2, 0, 1) wrong = hwc.reshape(3, 2, 2) assert right.shape == wrong.shape assert right[1, 0, 0] == hwc[0, 0, 1] == 1 assert wrong[1, 0, 0] == 4

Shape checks pass; a channel-value check fails. right[1, 0, 0] is 1, the value that really belongs there — wrong[1, 0, 0] is 4. Use transpose to reorder axes.