How to log train and validation loss in the same figure ?
❓ Questions and Help
What is your question?
How can we log train and validation loss in the same plot and preview them in tensorboard?
Having both in the same plot is useful to identify overfitting visually.
Code
    def training_step(self, batch, batch_idx):
        images, labels = batch
        output = self.forward(images)
        loss = F.nll_loss(output, labels)
        return {"loss": loss, 'log': {'train_loss': loss}}
    
    def validation_step(self, batch, batch_idx):
        images, labels = batch
        output = self.forward(images)
        loss = F.nll_loss(output, labels)
        return {"loss": loss}

    def validation_end(self, outputs):
        avg_loss = torch.stack([x['loss'] for x in outputs]).mean()
        return {'val_loss': avg_loss, 'log': {'val_loss': avg_loss}}

What have you tried?
Using Loss/train and Loss/valid contains them in the same section, but still in separate plot.
    def training_step(self, batch, batch_idx):
        images, labels = batch
        output = self.forward(images)
        loss = F.nll_loss(output, labels)
        return {"loss": loss, 'log': {'Loss/train': loss}}
    
    def validation_step(self, batch, batch_idx):
        images, labels = batch
        output = self.forward(images)
        loss = F.nll_loss(output, labels)
        return {"loss": loss}

    def validation_end(self, outputs):
        avg_loss = torch.stack([x['loss'] for x in outputs]).mean()
        return {'val_loss': avg_loss, 'log': {'Loss/valid': avg_loss}}

I tried to use self.logger.experiment.add_scalars(), but confused on how to access train loss in validation loop.
What's your environment?

OS: MAC OSX
Packaging: conda
Version: 0.5.3.2