scatter_add() is exactly the function I was looking for.
By the way, I have pretrained model and I do not need to train it. I just want to merge some different classes if its prediction before using .max() function to get the corresponding class.
Thank you so much.