@stvhuang you can do it like this :
class MetricsGroup:
        
    def __init__(self, metrics_dict):
        self.metrics = metrics_dict
        
    def update(self, output):
        for name, metric in self.metrics.items():
            metric.update(output)
            
    def compute(self):
        output = {}
        for name, metric in self.metrics.items():
            output[name] = metric.compute()
        return output


import torch
from ignite.metrics import Accuracy, Precision, Recall, Fbeta

p = Precision()
r = Recall()
m_group = MetricsGroup({
    "accuracy": Accuracy(),
    "precision": p,
    "recall": r,
    "f1": Fbeta(beta=1.0, average=False, precision=p, recall=r)
})

for _ in range(10):
    
    y = torch.randint(0, 4, size=(32, ))
    y_pred = torch.rand(32, 4)

    m_group.update((y_pred, y))

scores = m_group.compute()
print(f"Accuracy: {scores['accuracy']}")
print(f"Precision: {scores['precision']}")
print(f"Recall: {scores['recall']}")
print(f"F1: {scores['f1']}")

HTH