Balanced Accuracy accumlation

Hi,
I have a problem using the balanced accuracy metric for classification. For what I understand, the following should be correct:

from torchmetrics import Accuracy
bacc = Accuracy(average='macro', num_classes=5)

The problem I have now, is that

bacc(torch.tensor([0, 1, 2, 3, 3]), torch.tensor([0, 1, 2, 3, 3])) # returns 0.8

gives a score of 0.8. My classes are unbalenced, so logging during training gives a very bad validation bacc score. The bacc score is much higher, if it is calculated on the whole dataset. Is there a better way how the logging / calculation during training should be done? (Are there arguments for Accuracy, so that it bacc returns 1 in the case above. Would the accumulation then be correct?)

Thanks