Expected 3-dimensional input for 3-dimensional weight [512, 512, 5], but got 4-dimensional input of size [1, 0, 1, 512] instead

I have checked the shape of the input tensor and its showing a 3 dimensional shape/size. Also, if you could please specifically tell me the changes in the CNN architecture or can I achieve this without making any changes to the trained model?