def validation_epoch_end(self, outputs):
    for (dataloader_idx, dataloader_outputs) in enumerate(outputs):
        tag = f'validation{dataloader_idx}'
        avg_val_loss = torch.stack([out['val_loss'] for out in dataloader_outputs]).mean()
        self.log((tag + '/loss'), avg_val_loss)
        mlflow.log_metric((tag + '/loss'), avg_val_loss.item(), step=self.global_step)
        if True:
            step = None
            self.log_layer_weights('weight', ['convs.conv1'], step=step)
        y_true = torch.cat([out['y_true'] for out in dataloader_outputs])
        y_prob = torch.cat([out['y_prob'] for out in dataloader_outputs])
        self.trainer.datamodule.fill_prob(tag, self.global_step, y_prob.detach().cpu().numpy())
        (scores, cm2, _) = utils.get_metrics_probabilistic(y_true, y_prob, criterion=None)
        self.log_scores(tag, scores, step=self.global_step)
        self.log_cm((tag + '/cm2'), cm2, step=self.global_step)
        self.log_eval_plots(tag, y_true, y_prob, step=self.global_step)
        mlflow.log_artifacts(self.logger.log_dir, 'tensorboard/train_val')
def validation_epoch_end(self, outputs):
    for (dataloader_idx, dataloader_outputs) in enumerate(outputs):
        tag = f'validation{dataloader_idx}'
        avg_val_loss = torch.stack([out['val_loss'] for out in dataloader_outputs]).mean()
        self.log((tag + '/loss'), avg_val_loss)
        mlflow.log_metric((tag + '/loss'), avg_val_loss.item(), step=self.global_step)
        if True:
            step = None
            self.log_layer_weights('weight', ['convs.conv1'], step=step)
        y_true = torch.cat([out['y_true'] for out in dataloader_outputs])
        y_prob = torch.cat([out['y_prob'] for out in dataloader_outputs])
        self.trainer.datamodule.fill_prob(tag, self.global_step, y_prob.detach().cpu().numpy())
        (scores, cm2, _) = utils.get_metrics_probabilistic(y_true, y_prob, criterion=None)
        self.log_scores(tag, scores, step=self.global_step)
        self.log_cm((tag + '/cm2'), cm2, step=self.global_step)
        self.log_eval_plots(tag, y_true, y_prob, step=self.global_step)
        mlflow.log_artifacts(self.logger.log_dir, 'tensorboard/train_val')