Hi,
assume I have a tensor from a sigmoid output containing e.g. [0.1, 0.2, 0.3, 0.2, 0.4]. I now want [0, 0, 1, 1] i.e. for everything > 0.2 I want a 1 and else a 0.
How can I do that in pyTorch?
Hi,
assume I have a tensor from a sigmoid output containing e.g. [0.1, 0.2, 0.3, 0.2, 0.4]. I now want [0, 0, 1, 1] i.e. for everything > 0.2 I want a 1 and else a 0.
How can I do that in pyTorch?
Hi
This can be done as follows =
output = model(input)
output = torch.sigmoid(output)
output = torch.round(output)
no, round has a fixed threshold of 0.5
Oh sorry I misread your question,
Then simply on your acitvated output do -
output = torch.where(output > 0.2, 1, 0)