Yes, nn.BCEWithLogitsLoss for example takes targets in the range [0, 1] and could thus be used.
This use case would be applied for “soft” targets, which are between the two binary target classes 0 and 1.