I am unable to train the model:
@ptrblck  I have tried everything… but couldn’t solve it 
class LogisticRegression(nn.Module):
def __init__(self, input_size, output_size, hidden_size):
    super(LogisticRegression, self).__init__()
    self.linear = nn.Linear(input_size, hidden_size)
    self.relu = nn.Sigmoid()
    self.linear2 = nn.Linear(hidden_size, output_size)
    self.initialize()

def initialize(self):
    nn.init.xavier_uniform(self.linear.weight.data)
    nn.init.xavier_uniform(self.linear2.weight.data)
    self.linear.bias.data.zero_()
    self.linear2.bias.data.zero_()

def forward(self, x):
    hidden = self.linear(x)
    out = self.relu(hidden)
    out = self.linear2(out)
    return out

Model Training
l_batch_sz = 16
X = [torch.from_numpy(np.array(item)).float() for item in dev_loss]
Y = [torch.from_numpy(np.array(item)).float() for item in noise_flag]
X = Variable(torch.FloatTensor(X), requires_grad = True).cuda()
Y = Variable(torch.FloatTensor(Y), requires_grad = True).cuda()
l_dataset = data.TensorDataset(X,Y)
l_loader = data.DataLoader(l_dataset, batch_size=l_batch_sz, drop_last=True)
l_input_size = l_batch_sz
l_output_size = l_batch_sz
l_hidden_size = 64
l_total_epoch = 100
l_learning_rate = 0.01
l_model = LogisticRegression(l_input_size, l_output_size, l_hidden_size)
l_model.cuda()
l_model.train()
print('l_model.parameters() : ',l_model.parameters())
l_criterion = nn.BCEWithLogitsLoss()
l_optimizer = torch.optim.Adam(l_model.parameters(), lr=l_learning_rate)
import ipdb
for epoch in range(l_total_epoch):
  for batch_idx, (x, y) in enumerate(l_loader):
  
        l_optimizer.zero_grad() 
        output = l_model(x)
        l_loss = l_criterion(output, y)
        
        l_loss.backward()
        l_optimizer.step()
                            
        if (batch_idx + 1) % 1 == 0:
            print('\nEpoch: [%d/%d], Loss: %.4f' %(epoch+1, l_total_epoch, l_loss))