You need to avoid the inplace operation.
If the size along the second dimension is 2, you could use
mult = torch.stack([torch.ones_like(labels[:,0]), labels[:, 0]], dim=1)
outputs = outputs * mult
labels = labels * mult

or so.
Best regards
Thomas