The error is expected, given that your Linear layer takes in an input of 7168 and you are getting an input of 802816. Declare the Linear layer as self.fc1 = nn.Linear(802816, 45). However, this solution is not recommended as  it places huge computational constraint in terms of the number of parameters. It is recommended to downsample the spatial dimension further before you use a fully connected layer.