The activation shape before flattening it is [batch_size, 16, 17, 17], which corresponds to [batch_size, 4624]. This will raise an error, since the linear layer is using in_features=200, so you would need to change it to 4624.