code: def video_l1_loss(top_out, targets, model_hparams, vocab_size, weights_fn):
    
    del vocab_size  # unused arg
    logits = top_out
    logits = tf.reshape(logits, [-1] + common_layers.shape_list(logits)[2:-1])
    targets = tf.reshape(targets, [-1] + common_layers.shape_list(targets)[2:])
    weights = weights_fn(targets)
    # Shift targets by 0.5 so later just casting to int gives the prediction.
    # So for int targets, say 0 and 7, we actually train to predict 0.5 and 7.5.
    # Later (in merics or infer) this is cast to int anyway. Also, we have no
    # loss beyond cutoff = 0.2 as these are already correct predictions.
    targets = tf.to_float(targets) + 0.5
    loss = video_l1_internal_loss(logits, targets, model_hparams)
    return tf.reduce_sum(loss * weights), tf.reduce_sum(weights)
docs: Compute loss numerator and denominator for one shard of output.