Ok perfect this is great and i solved using output.split(1, dim=1) but there is another problem:



 Lukens:

targets = (target1, target2, target3, target4, target5, target6, target7, target8)
outputs = torch.sigmoid(outputs)
loss = binary_loss_fn(outputs, targets)



size of outuputs and targets is not the same when i call the function binary_loss_fn, I read this error:
ValueError: Target size (torch.Size([2])) must be the same as input size (torch.Size([2, 1]))
this is my targets:
(tensor([0., 0.], device='cuda:0'), tensor([0., 0.], device='cuda:0'), tensor([0., 0.], device='cuda:0'), tensor([0., 0.], device='cuda:0'), tensor([0., 0.], device='cuda:0'), tensor([0., 0.], device='cuda:0'), tensor([0., 1.], device='cuda:0'), tensor([1., 0.], device='cuda:0'))
this is my outputs after the split:
(tensor([[0.5201],
        [0.5200]], device='cuda:0', grad_fn=<SplitBackward>), tensor([[0.3892],
        [0.3740]], device='cuda:0', grad_fn=<SplitBackward>), tensor([[0.4612],
        [0.4714]], device='cuda:0', grad_fn=<SplitBackward>), tensor([[0.5387],
        [0.5210]], device='cuda:0', grad_fn=<SplitBackward>), tensor([[0.5536],
        [0.5366]], device='cuda:0', grad_fn=<SplitBackward>), tensor([[0.4580],
        [0.4908]], device='cuda:0', grad_fn=<SplitBackward>), tensor([[0.5311],
        [0.5242]], device='cuda:0', grad_fn=<SplitBackward>), tensor([[0.5169],
        [0.5242]], device='cuda:0', grad_fn=<SplitBackward>))