Thankyou so much, I have modified the code based on your suggestion as such:
for epoch in range(num_epochs):
    logs = {}
    total_correct = 0
    total_loss = 0
    total_images = 0
    total_val_loss = 0

    model.train()
    for i, (data, target) in enumerate(train_loader):

        images = data.to('cuda:0')
        labels = target.to('cuda:0')


        # Forward propagation
        outputs = model(images)

        # Calculating loss with softmax to obtain cross entropy loss

        # loss = criterion(outputs, labels)

        loss = criterion(outputs, labels)    #....>

        optimizer.zero_grad()
        # Backward prop
        loss.backward()

        # Updating gradients
        optimizer.step()

        # Total number of labels
        total_images+= labels.size(0)


        # Obtaining predictions from max value
        _, predicted = torch.max(outputs.detach(), 1)



        # Calculate the number of correct answers
        correct = (predicted == labels).sum().item()

        total_correct+=correct
        total_loss+=loss.item()
    logs['log loss'] = total_loss / total_images
    logs['Accuracy'] = ((total_correct / total_images) * 100)


    print('Epoch [{}/{}], Step [{}/{}], Loss: {:.4f}, Accuracy: {:.2f}%'
              .format(epoch + 1, num_epochs, i + 1, len(test_loader), (total_loss / total_images),
                      (total_correct / total_images) * 100))




    # Testing the model
    model.eval()

    with torch.no_grad():
        correct = 0
        total = 0
        total_losss =0

        for data, target in test_loader:
            images = data.to('cuda:0')
            labels = target.to('cuda:0')
            outputs = model(images)

            _, predicted = torch.max(outputs.detach(), 1)
            total += labels.size(0)
            correct += (predicted == labels).sum().item()
            total_losss += loss.item()

            accuracy = correct / total

        print('Test Accuracy of the model: {} %'.format(100 * correct / total))
        logs['val_' + 'log loss'] = total_losss/total
        logs['val_' + 'Accuracy'] = ((correct / total) * 100)
       # logs['accuracy'] = accuracy
    liveloss.update(logs)
    liveloss.draw()