Without knowing anything about the use case: one approach would be to use:
x = x.view(x.size(0), -1)
print(x.shape)

to keep the batch size equal and to check the activation shape afterwards. Once this is done, change the in_features of self.fc1 to the printed dim1 shape.