Precision and Recall over validation step
When Precision and Recall are directly computed, I get the following result:
import torch
from pytorch_lightning.metrics import Precision
from pytorch_lightning.metrics import Recall

y = torch.tensor([0, 0, 2, 2, 1, 1, 1, 2, 0, 0])
y_hat = torch.tensor([1, 1, 2, 1, 1, 1, 1, 1, 2, 1])

precision = Precision(num_classes=3)
recall = Recall(num_classes=3)
precision(y_hat, y)
#>>>tensor(0.2917)
recall(y_hat, y)
#>>>tensor(0.4444)
However, when the same metrics are computed over validation_step, I get the following stranger result:
    def validation_step(self, batch, batch_idx):
        x, y = batch["x"], batch["y"] # y = tensor([0, 0, 2, 2, 1, 1, 1, 2, 0, 0], device='cuda:0')
        y_hat = self(x) # y_hat  = tensor([1, 1, 2, 1, 1, 1, 1, 1, 2, 1], device='cuda:0')

        precision = self.precision_score(y_hat, y) # precision =  tensor(0.4000, device='cuda:0')
        recall = self.recall_score(y_hat, y) # recall = tensor(0.4000, device='cuda:0')
what am I missing?