def l2_loss(traj_fake, traj_real):
    """
    Returns summary losses for generated trajectories

    traj_fake: Tensor of shape # (batch_size, target_size, 2). Predicted trajectory.
    traj_real: Tensor of shape # (batch_size, target_size, 2). Ground truth predictions.
    """

    loss = (traj_real - traj_fake)**2  # (batch_size, target_size, 2)

    # batch of summary losses for each trajectory
    loss = loss.sum(dim=2).sum(dim=1)  # (batch_size,)
    return loss