So it isn’t very efficient (just like the code you linked) but:
def multi_acc(pred, label):
  accs_per_label_pct = []
  tags = torch.argmax(pred, dim=1)
  for c in range(3):  # the three classes
    of_c = label == c
    num_total_per_label = of_c.sum()
    of_c &= tags == label
    num_corrects_per_label = of_c.sum()
    accs_per_label_pct.append(num_corrects_per_label / num_total_per_label * 100)
  return accs_per_label_pct

Note that you don’t need to cast to float here with non-ancient PyTorch.
For the loss, you can use reduction=‘none’ to get the elementwise loss. Then you can again filter by the label.
Best regards
Thomas