I am getting the same error. Any idea where that might be in my code. I don’t seem to figure out where the mistake is…
    class CNN(nn.Module):
        def __init__(self):
            super(CNN, self).__init__()

            self.conv1 = nn.Conv2d(4, 7, (3, 3))
            # self.convnorm1 = nn.BatchNorm2d(7)
            # self.pool1 = nn.MaxPool2d((2, 2))

            self.conv2 = nn.Conv2d(7, 14, (3, 3))
            self.convnorm2 = nn.BatchNorm2d(14)
            # self.pool2 = nn.MaxPool2d((2, 2))
            #
            self.conv3 = nn.Conv2d(14, 28, (3, 3))
            # self.convnorm3 = nn.BatchNorm2d(28)
            # self.pool3 = nn.MaxPool2d((2, 2))

            self.conv4 = nn.Conv2d(28, 56, (3, 3))
            self.convnorm4 = nn.BatchNorm2d(56)
            # self.pool4 = nn.MaxPool2d((2, 2))

            self.conv5= nn.Conv2d(56, 112, (3, 3))
            self.convnorm5 = nn.BatchNorm2d(112)
            # self.pool5 = nn.MaxPool2d((2, 2))

            self.conv6 = nn.Conv2d(112, 224, (2, 2))
            self.convnorm6 = nn.BatchNorm2d(224)
            # self.pool6 = nn.MaxPool2d((2, 2))
            #
            # self.conv7 = nn.Conv2d(224, 448, (2, 2))
            # self.convnorm7 = nn.BatchNorm2d(448)
            # self.pool7 = nn.MaxPool2d((2, 2))

            self.linear1 = nn.Linear(47096, 200)
            self.linear1_bn = nn.BatchNorm1d(200)
            self.drop = nn.Dropout(DROPOUT)
            self.linear2 = nn.Linear(200, 17)
            self.act = torch.relu

        def forward(self, x):
            # x = self.act(self.conv1(x))
            # x = self.pool1(self.convnorm1(self.act(self.conv1(x))))
            #x = self.pool1(self.act(self.conv1(x)))
            x = self.act(self.conv1(x))
            #x = self.pool2(self.convnorm2(self.act(self.conv2(x))))
            x = self.convnorm2(self.act(self.conv2(x)))
            x = self.act(self.conv3(x))
            # x = self.pool3(self.convnorm3(self.act(self.conv3(x))))
            # x = self.pool4(self.convnorm4(self.act(self.conv4(x))))
            x =self.convnorm4(self.act(self.conv4(x)))
            # x = self.pool5(self.convnorm5(self.act(self.conv5(x))))
            # x = self.pool6(self.convnorm6(self.act(self.conv6(x))))
            # x = self.pool7(self.convnorm7(self.act(self.conv7(x))))
            x = self.drop((self.linear1_bn(self.act(self.linear1(x.view(len(x), -1))))))
            return self.linear2(x)