Query about array reshaping

We know that, array reshaping works in such a way that it preserves the data. In the 2nd video of Pokemon Classification using Neural Network project, at 1:35 in the video, Prateek Bhaiya reshapes the numpy array X[i] from (100, 100, 3) to (40, 40, 3) but he does not receive an error. When I tried to code along and do the same, I receive this error. Why?

hey @Jalaanchal-Tewari-1816244721737412 ,
There is difference between reshaping and resizing , with reshaping you need to preserve the number of pixels and with resizing we don’t , we just resize it the required shape.

For you doubt ,
Check the same video at 0:31 time ,you will see a for loop for loading the data , having target size as (40,40,3) and hence due to this prateek bhaiya is able to reshape his data in such a way.

I hope this would have helped You.
Thank You :slightly_smiling_face:.

1 Like