I think if you would like to create a confusion matrix, this could would be easier:
nb_classes = 2
conf_mat = torch.zeros(nb_classes, nb_classes)
pred = torch.randint(0, 2, (10,))
label = torch.randint(0, 2, (10,))

for l, p in zip(label, pred):
    conf_mat[l, p] += 1
print(conf_mat)

Currently your script would just set the values for the metrics to 1, instead of counting them.
I’m not sure, if that’s what you want.