Hello, I’m trying to train a feedforward neural net for the CIFAR10 dataset. Whenever I run the cell to train the model, I get a dimension error. I used a Cross Entropy loss and SGD optimizer with a learning rate of 0.01.
When I transformed the RGB dataset into grayscale, interestly I was able to train the model. Some help would be great! Thanks.
Below is the code for the model and the error.
batch_size = 100
input_dim = 1024  
output_dim = 10  
hidden_dim = 500

class FNN(nn.Module):
    def __init__(self, input_dim, hidden_dim, output_dim):
        super(FNN, self).__init__()

        self.fc1 = nn.Linear(input_dim, hidden_dim) # has 2 params

        self.relu = nn.ReLU()

        self.fc2 = nn.Linear(hidden_dim, output_dim)
    
    def forward(self, x):
        # print("x size is {}".format(x.size()))
        # size output was [300, 1024]

        out = self.fc1(x)
        out = self.relu(out)
        out = self.fc2(out)
        return out

# fc1 Params size [500, 1024] and [500]
# fc2 params size [10, 500] and [10]

Screen Shot 2020-05-27 at 3.08.55 AM1910×646 109 KB