def instance_bce_with_logits(logits, labels):
    assert (logits.dim() == 2)
    loss = nn.functional.binary_cross_entropy_with_logits(logits, labels)
    loss *= labels.size(1)
    return loss
def instance_bce_with_logits(logits, labels):
    assert (logits.dim() == 2)
    loss = nn.functional.binary_cross_entropy_with_logits(logits, labels)
    loss *= labels.size(1)
    return loss