I realized that I am using make_grid function which is changing the dimension from 4d to 3d. It is also changing the the dimension from 224, 244,3 to 228,906,3. Which is still confusing for me that how it picks up this dimension.