I don’t know what might be causing this issue, as it seems no workflow (neither the binaries nor a source build) fixes it in your setup.
Unfortunately I’m unable to reproduce the issue using:
import torch
import torch.nn as nn
import torch.nn.functional as F

class Classifier(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc0 = nn.Linear(50176, 784)
        self.fc1 = nn.Linear(784, 256)
        self.fc2 = nn.Linear(256, 128)
        self.fc3 = nn.Linear(128, 64)
        self.fc4 = nn.Linear(64, 2)

    def forward(self, x):
        # make sure input tensor is flattened
        print('The shape of X is: ')
        print(x.shape)
        x = x.view(x.shape[0], -1)
        print('The shape of X flattened is: ')
        print(x.shape)

        x = F.relu(self.fc0(x))
        x = F.relu(self.fc1(x))
        x = F.relu(self.fc2(x))
        x = F.relu(self.fc3(x))
        x = F.log_softmax(self.fc4(x), dim=1)

        print('The shape of X is: ')
        print(x.shape)

        return x

device = 'cuda:0'
print(torch.cuda.get_device_name(device))

model = Classifier().to(device)
for i in [1, 8, 16, 32]:
    x = torch.randn(i, 50176, device=device)
    out = model(x)
    print(out.shape)

on an RTX2080Ti and the 1.8.1+CUDA10.2 binaries, so I guess your system setup might not work properly and would recommend to update the NVIDIA drivers etc.