Actually i am a very beginner in torch 
i made the model in keras and it went well but in pytorch it is not converging
i just want to know is it an error or something that i don’t know about torch
the input is the question and the output is answer.
class Classifier(nn.Module): 

    def __init__(self, num_labels= 503, vocab_size= 880):

        super(Classifier, self).__init__()
    
        self.embed = nn.Embedding(vocab_size, 128)
        self.linear1 = nn.Linear(128, 128)
        self.linear2 = nn.Linear(128, num_labels)

    def forward(self, bow_vec):
        layer1 = self.embed(bow_vec)
        layer2 = layer1.sum(1).squeeze(1)
    
        layer3 = F.relu(self.linear1(layer2))
        layer3 = F.relu(self.linear1(layer3))
        layer4 = self.linear2(layer3)
        return layer4

x_loaders = torch.utils.data.DataLoader(train_x, batch_size=512, num_workers=4)
y_loaders = torch.utils.data.DataLoader(new_y, batch_size=512, num_workers=4)

losses = []
loss_function = nn.CrossEntropyLoss()
model = Classifier()
optimizer = optim.Adam(model.parameters(), lr=0.01)
for epoch in range(50):
    total_loss = torch.Tensor([0])
    for x,y in zip(x_loaders, y_loaders):
    
        inputs, labels = Variable(x), Variable(y, requires_grad= False)

        model.zero_grad()

        log_probs = model(inputs)

        loss = loss_function(log_probs, labels)

    # Step 5. Do the backward pass and update the gradient
        loss.backward()
        optimizer.step()

        total_loss += loss.data
    losses.append(total_loss[0])
print(losses)

btw new_y is a vector of the target indices.
sorry for that long code but this is my first time
thanks