(gen_frames, gt_frames, l_num)
return tf.reduce_mean(tf.pack(scale_losses))
Calculates the sum of lp losses between the predicted and ground truth frames.

    @param gen_frames: The predicted frames at each scale.
    @param gt_frames: The ground truth frames at each scale
    @param l_num: 1 or 2 for l1 and l2 loss, respectively).

    @return: The lp loss.
Calculates the sum of lp losses between the predicted and ground truth frames.
Calculates the sum of lp losses between the predicted and ground truth frames .
def lp_loss(gen_frames, gt_frames, l_num):
    """
    Calculates the sum of lp losses between the predicted and ground truth frames.

    @param gen_frames: The predicted frames at each scale.
    @param gt_frames: The ground truth frames at each scale
    @param l_num: 1 or 2 for l1 and l2 loss, respectively).

    @return: The lp loss.
    """
    # calculate the loss for each scale
    scale_losses = []
    for i in xrange(len(gen_frames)):
        scale_losses.append(tf.reduce_sum(tf.abs(gen_frames[i] - gt_frames[i])**l_num))

    # condense into one tensor and avg
    return tf.reduce_mean(tf.pack(scale_losses))
def lp_loss ( gen_frames , gt_frames , l_num ) : # calculate the loss for each scale scale_losses = [ ] for i in xrange ( len ( gen_frames ) ) : scale_losses . append ( tf . reduce_sum ( tf . abs ( gen_frames [ i ] - gt_frames [ i ] ) ** l_num ) ) # condense into one tensor and avg return tf . reduce_mean ( tf . pack ( scale_losses ) )