nn.BCELoss expects probabilities in the range [0, 1] as inputs and will yield an error otherwise:
criterion = nn.BCELoss()
x = torch.randn(10, 1)
criterion(torch.tanh(x), torch.randint(0, 2, (10, 1)).float())
> RuntimeError: all elements of input should be between 0 and 1

so you would have to use an activation function, which creates these values (such as sigmoid) and could thus switch to nn.BCEWithLogitsLoss.