loss_functions.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:Adversarial_Video_Generation 作者: dyelax 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号