Yes, you should use sigmoid function.
def sigmoid(x): return 1/(1 + (-x).exp())

It will convert the space of [-inf, inf] into a probability [0,1].
Note this sigmoid works on a tensor. So it will do that for all your activations.
What ever goes to the sigmoid you can call “logit”, even though this is not a mathematical logit function.
After that you will use bce, which works on a batch.
def binary_cross_entropy(p, y): return -(p.log()*y + (1-y)*(1-p).log()).mean()

Note that sigmoid used exponential function to grab the probabilities and now we use log of these probabilities.