Log PyTorch Lightning metric over full validation data loader (for the full epoch)

Is there a way to implement metric calculation on validation dataloader level instead on validation batch level?

It is possible to record metrics at the epoch level if that’s what you are interested in. Here is a link to the documentation.

I haven’t tested the code snippet below, but I think it should work:

def validation_step(self, batch, batch_idx):
    loss = ...
    result = EvalResult()
    result.log('val_loss', loss, on_step=False, on_epoch=True)
    return result
2 Likes

Thank you very much =)

1 Like