Logging accuracy with batch accumulation
I wanted to ask how pytorch handles accuracy (and maybe even loss) logging when we have something like pl.Trainer(accumulate_grad_batches=ACCUMULATIONS).
My training looks like this:
    def training_step(self, batch, batch_idx):
        x, y = batch
        y_hat = self(x)
        loss = F.cross_entropy(y_hat, y, weight=self.weight)
        result = pl.TrainResult(loss)
        result.log("train_loss", loss, prog_bar=True)
        result.log("train_accuracy", self.accuracy(y_hat.argmax(dim=-1), y), prog_bar=True)

        return result
where self.accuracy = pl.metrics.classification.Accuracy(). Is there a way to make sure that the loss and accuracy is averaged across the accumulated batches?
If this is not currently the case, I'm happy to do a PR if someone can show me where to look in the source code to make such a change.
Thanks in advance