def get_length_task_loss(config: LossConfig) -> 'Loss':
    """
    Returns a Loss instance.

    :param config: Loss configuration.
    :return: Instance implementing Loss.
    """
    if config.length_task_link is not None:
        if config.length_task_link == C.LINK_NORMAL:
            return MSELoss(config,
                           output_names=[C.LENRATIO_OUTPUT_NAME],
                           label_names=[C.LENRATIO_LABEL_NAME])
        elif config.length_task_link == C.LINK_POISSON:
            return PoissonLoss(config,
                               output_names=[C.LENRATIO_OUTPUT_NAME],
                               label_names=[C.LENRATIO_LABEL_NAME])
        else:
            raise ValueError("unknown link function name for length task: %s" % config.length_task_link)
    return None
def get_length_task_loss ( config : LossConfig ) -> 'Loss' : if config . length_task_link is not None : if config . length_task_link == C . LINK_NORMAL : return MSELoss ( config , output_names = [ C . LENRATIO_OUTPUT_NAME ] , label_names = [ C . LENRATIO_LABEL_NAME ] ) elif config . length_task_link == C . LINK_POISSON : return PoissonLoss ( config , output_names = [ C . LENRATIO_OUTPUT_NAME ] , label_names = [ C . LENRATIO_LABEL_NAME ] ) else : raise ValueError ( "unknown link function name for length task: %s" % config . length_task_link ) return None
Returns a Loss instance.

    :param config: Loss configuration.
    :return: Instance implementing Loss.