Thanks for the help.
I checked the shape of images when training and it was [300, 1024]. I reshaped images into a 3d tensor [100, 3, 1024].  I think that solved my previous dim issue.
After reshaping I have another dim issue during the loss =criterion(outputs,labels) step.
ValueError: Expected target size (100, 10),
                     got torch.Size([100])

When i printed the size of label, it also was [100]. When i reshaped labels to [100,1], the shape in the ValueError above also changed to [100,1]. It looks like labels should have size [100,10]. Batch =100 and 10 classes? Any suggestions on how to debug this?
Below is the code for training.
model = FNN(input_dim,hidden_dim, output_dim)

criterion = nn.CrossEntropyLoss() 
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

iteration = 1
for epoch in range(num_epochs):
    for i, (images, labels) in enumerate(trainloader):
       
        images = images.view(-1, 32*32).requires_grad_()
        images = images.reshape([100,3,1024])
        
        print('label size is {}'.format(labels.size())) 
        # [100]
        print('image size is {}'.format(images.size())) 
        # [100,3,1024]

        # clear gradients from previous iters w.r.t params
        optimizer.zero_grad()

        # forward pass to get outputs
        outputs = model(images)

        print('the output sizes {}'.format(outputs.size()))
        #[100,3,10]

        # Calculate loss
        loss = criterion(outputs, labels)

        # getting gradients w.r.t params
        loss.backward()

        # updating params
        optimizer.step()

        iteration += 1