The code for your layers looks fine. There are multiple ways in PyTorch for flattening a multi-dimensional input. In your case, one option is to change your forward method to something like
def forward(self, x):
    x = torch.flatten(x, start_dim=1)  # Assumes input 'x' is batched
    x = F.relu(self.fc1(x))
    x = F.softmax(self.fc2(x))
    return x

Note that you could also combine the flatten instruction with the first line in your example;
def forward(self, x):
    x = F.relu(self.fc1(x.flatten(start_dim=1))  # Assumes input 'x' is batched
    x = F.softmax(self.fc2(x))
    return x

Personally, I prefer the first alternative since I find it more readable.
UPDATE: You could also solve this by using torch.nn.Flatten.