Sorry for the confusion. No, you should just use a sigmoid on your output, if you are using nn.BCELoss.
Also, I’m not sure @kenmikanmi’s approach will work, as the second term seems to have a small mistake.
The second term should look like: (1 - t) * log(1 - sigmoid(x)), while currently the formula uses (1 - t) * (1 - logsigmoid(x)).