Hi,
I ran your code using random numbers for 10 epochs and it did not caused any error. Maybe other parts of your code?
x = torch.randn(32, 3, 148, 148)
model = CNN()

model.train()
for epoch in range(10):
  model(x)

Something that may weird is the memory issues. On my local environment, on deep models, I got mismatch errors in size or channel but not on non-low-end laptops.
Could you try your code on google colab for instance or run on your local system with small size of dataset such as 100 images etc?
Bests, Nik