I will add that num_workers, however, I am training the below model, it does not through any error but it even does not output anything, don’t know the reason . Please help.
class autoencoder(nn.Module):
def __init__(self):
    
    super(autoencoder, self).__init__()
    self.encoder = nn.Sequential(
        nn.Conv2d(1, 6,stride = 1,kernel_size=5),  
        nn.ReLU(True),
        nn.MaxPool2d(2,2),  
        nn.Conv2d(6, 16,stride = 1,kernel_size=5),
        nn.Flatten(),
        nn.Linear(16*114*154, 20000),
        nn.Linear(20000, 50000),

    )
    self.decoder = nn.Sequential(
        nn.Linear(50000,20000),
        nn.Linear(20000,16*114*154),
       
        
    )

def forward(self, x):
   
    x = self.encoder(x)
    x = self.decoder(x)
    return x

def train(model, num_epochs=5, batch_size=10, learning_rate=1e-3):
torch.manual_seed(42)
criterion = nn.CrossEntropyLoss() # mean square error loss
optimizer = torch.optim.Adam(model.parameters(),
lr=learning_rate,
weight_decay=1e-5) # <–
outputs = []
for epoch in range(num_epochs):
    for data in traindataloader:
        img, labels = data
        optimizer.zero_grad()
        print(img.size())
        img = Variable(img)
        print(img.size())
        labels = Variable(labels)
        print(labels.size())
    # ===================forward=====================
        output = model(img)
        print(output.size())
        train_loss = criterion(output, labels.squeeze())
    # ===================backward====================
    
        train_loss.backward()
        optimizer.step()

    print('Epoch:{}, Loss:{:.4f}'.format(epoch+1, float(train_loss)))
    outputs.append((epoch, img, output),)
return outputs

model = autoencoder()
max_epochs = 5
outputs = train(model, num_epochs=max_epochs)