Hi, considering you have replaced the code as @Abdulrahman mentioned.
Now, in-order for the flatten()'s output to pass through the fc1(), you need to have a Tensor of size->(num_batches, 896).
Since you are using Fully Connected layers, the Network will produce output for only one specific input size.
You must find what’s that particular input size.!!
Can you check what’s the output shape after flattening ?