Hello everyone (I’ve googled a lot before posting here, but at this point I’m kind of exhausted with PyTorch).
I want to pass my array of outputs through a sigmoid function with a threshold of 0.5 (e.g every element lower than 0.5 make it 0 and everything bigger than 0.5 make it 1) and provide it to my loss function.
I’ve already tried to do something like this
function = torch.nn.Sigmoid()
outputs = (function(outputs)>=0.5).float()
in order to provide it to my loss function
but if i do that then PyTorch cannot differentiate.
Any thoughts are appreciated