def semi_loss_func(ac, full_ob, semi_dataset, is_relative_actions=False):
    """
    get the L2 loss between generated actions and semi supervised actions
    :param ac: the semi supervised actions
    :param full_ob: the full observations of the semi supervised dataset
    :param semi_dataset: the semi supervised dataset
    :return: the L2 loss if semi_dataset exists, 0 otherwise
    """
    diff = ac - semi_dataset.full_ob_2_acs(full_ob) if not is_relative_actions else ac
    return (diff ** 2).mean() if semi_dataset is not None else 0