I encountered the same problem as I try to simplify my CNN to run faster epochs. How to fix it?
def init(self):
super(Net, self).init()
## Define layers of a CNN
self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1)
self.conv2 = nn.Conv2d(16, 32, kernel_size=3, padding=1)
self.conv3 = nn.Conv2d(32, 64, kernel_size=3, padding=1)
self.pool = nn.MaxPool2d(2, 2)
self.fc1 = nn.Linear(25088, 512)
self.fc2 = nn.Linear(512, 133)
self.dropout = nn.Dropout(0.5)
def forward(self, x):
    ## Define forward behavior
    x = self.pool(F.relu(self.conv1(x)))
    x = self.pool(F.relu(self.conv2(x)))
    x = self.pool(F.relu(self.conv3(x)))
    print(x.shape)
    x = x.view(-1, 25088)
    x = F.relu(self.fc1(x))
    x = self.dropout(x)
    x = self.fc2(x)
    return x