Getting Validation Accuracy with validation_epoch_end
Hello i managed to implement training accuracy per epoch with training_epoch_end but i want to do the same with validation accuracy with validation_epoch_end but i get an error of "too many indices for tensor of dimension 0" when train.fit() . I am using pytorch-lightning==1.2.8  . Thanks in advance.
Error is:
<ipython-input-31-41c968828bca> in validation_epoch_end(self, outputs)
     39     predictions = []
     40     for output in outputs:
---> 41       for out_labels in output["labels"].detach().cpu():
     42         labels.append(out_labels)
     43       for out_predictions in output["predictions"].detach().cpu():

IndexError: too many indices for tensor of dimension 0

def validation_step(self, batch, batch_idx):
   input_ids = batch["input_ids"]
   attention_mask = batch["attention_mask"]
   labels = batch["labels"]
   loss, outputs = self(input_ids, attention_mask, labels)
   self.log("val_loss", loss, prog_bar=True, logger=True)
   return loss

 def validation_epoch_end(self, outputs):

   labels = []
   predictions = []
   for output in outputs:
     for out_labels in output["labels"].detach().cpu():
       labels.append(out_labels)
     for out_predictions in output["predictions"].detach().cpu():
       predictions.append(out_predictions)

   labels = torch.stack(labels).int()
   predictions = torch.stack(predictions)

   validation_acc = accuracy(predictions, labels)
   self.logger.experiment.add_scalar("Validation Accuracy", validation_acc, self.current_epoch)
I am a fool , i forgot to add return {"loss": loss, "predictions": outputs, "labels": labels} in the validation step.