(preds, labels)
return tf.reduce_mean(tf.pack(scale_losses))
Calculates the sum of BCE losses between the predicted classifications and true labels.

    @param preds: The predicted classifications at each scale.
    @param labels: The true labels. (Same for every scale).

    @return: The adversarial loss.
Calculates the sum of BCE losses between the predicted classifications and true labels.
Calculates the sum of BCE losses between the predicted classifications and true labels .
def adv_loss(preds, labels):
    """
    Calculates the sum of BCE losses between the predicted classifications and true labels.

    @param preds: The predicted classifications at each scale.
    @param labels: The true labels. (Same for every scale).

    @return: The adversarial loss.
    """
    # calculate the loss for each scale
    scale_losses = []
    for i in xrange(len(preds)):
        loss = bce_loss(preds[i], labels)
        scale_losses.append(loss)

    # condense into one tensor and avg
    return tf.reduce_mean(tf.pack(scale_losses))
def adv_loss ( preds , labels ) : # calculate the loss for each scale scale_losses = [ ] for i in xrange ( len ( preds ) ) : loss = bce_loss ( preds [ i ] , labels ) scale_losses . append ( loss ) # condense into one tensor and avg return tf . reduce_mean ( tf . pack ( scale_losses ) )