thank you. My intention was to find out the true positives, false positives etc. and set entries in the associated tensors to one. I wrote now the following
                pred = pred.byte()
                labels = labels.byte()
                true = pred.nonzero().squeeze()
                false = (~pred).nonzero().squeeze()
                
                tp = torch.zeros_like(pred)
                tn = torch.zeros_like(pred)
                fn = torch.zeros_like(pred)
                fp = torch.zeros_like(pred)
                
                tp[true[pred[true] == labels[true]]] = 1
                fp[true[pred[true] != labels[true]]] = 1
                tn[false[pred[false] == labels[false]]] = 1
                fn[false[pred[false] != labels[false]]] = 1

is this the most concise way of doing that? oO