Convert raw binary-classification logits into 0/1 predicted labels: apply sigmoid, then round to the nearest integer.
logits
Input
tensor([-1.2000, 0.3000, 2.5000, -0.1000])
Output
tensor([0., 1., 1., 0.])
This one's part of Premium. Unlock the full PyTorch track plus every other premium problem on the site.
solve(...)