(model_tgt, model_src, beta)
function to calculate the Exponential moving averages for the Generator weights
    This function updates the exponential average weights based on the current training
    Args:
        model_tgt: target model
        model_src: source model
        beta: value of decay beta
    Returns: None (updates the target model)
function to calculate the Exponential moving averages for the Generator weights
    This function updates the exponential average weights based on the current training
    Args:
        model_tgt: target model
        model_src: source model
        beta: value of decay beta
    Returns: None (updates the target model)
function to calculate the Exponential moving averages for the Generator weights This function updates the exponential average weights based on the current training Args : model_tgt : target model model_src : source model beta : value of decay beta Returns : None ( updates the target model )
def update_average(model_tgt, model_src, beta):
    """
    function to calculate the Exponential moving averages for the Generator weights
    This function updates the exponential average weights based on the current training
    Args:
        model_tgt: target model
        model_src: source model
        beta: value of decay beta
    Returns: None (updates the target model)
    """

    with torch.no_grad():
        param_dict_src = dict(model_src.named_parameters())

        for p_name, p_tgt in model_tgt.named_parameters():
            p_src = param_dict_src[p_name]
            assert p_src is not p_tgt
            p_tgt.copy_(beta * p_tgt + (1.0 - beta) * p_src)
def update_average ( model_tgt , model_src , beta ) : with torch . no_grad ( ) : param_dict_src = dict ( model_src . named_parameters ( ) ) for p_name , p_tgt in model_tgt . named_parameters ( ) : p_src = param_dict_src [ p_name ] assert p_src is not p_tgt p_tgt . copy_ ( beta * p_tgt + ( 1.0 - beta ) * p_src )