Which places are .item() to be used in?
Hi,
I read some of the example code using Lightning and in some places, there is usage of .item() in the *_epoch_end() methods to convert the loss to scalar. Is it needed or not? In PyTorch, I know this is used to prevent memory leaks, but I am unsure if this is done automatically in Lightning behind the scenes?
    def validation_epoch_end(self, outputs):
        avg_loss = torch.stack([x['val_loss'] for x in outputs]).mean()
        return {'avg_val_loss': avg_loss.item()}
What's your environment?

OS: Linux
Packaging: conda