Is my code for getting the predicted class correct? I don’t understand how softmax is being used here in cross entropy to get the class with the highest probability
for i, (x,y) in enumerate(zip(feature_trainloader,label_trainloader), 0):

                optimizer.zero_grad()   

                output = self.forward(x)

                target = y

                loss = self.CrossEntropyLoss(output, target)

                epoch_loss_train.append(loss.item())

                y_true_train = torch.cat((y_true_train, target))

                _, pred_class = torch.max(output, dim=1)

                y_pred_train = torch.cat((y_pred_train, pred_class))

                loss.backward()

                optimizer.step()