(named_parameters)
return mu_list, sig_list
Get list of mean, std of grad of each parameters
    Code based on web searched result..
Get list of mean, std of grad of each parameters
    Code based on web searched result..
Get list of mean std of grad of each parameters Code based on web searched result ..
def get_mean_grad(named_parameters):
    """
    Get list of mean, std of grad of each parameters
    Code based on web searched result..
    """
    mu_list = []
    sig_list = []
    for name, param in named_parameters:
        if param.requires_grad: # and ("bias" not in name) :
            # bias makes std = nan as it is of single parameters
            magnitude = param.grad.abs()
            mu_list.append(magnitude.mean())
            if len(magnitude) == 1:
                # why nan for single param? Anyway to avoid that..
                sig_list.append(torch.tensor(0))
            else:
                sig_list.append(magnitude.std())

            # if "svp_se"

    return mu_list, sig_list
def get_mean_grad ( named_parameters ) : mu_list = [ ] sig_list = [ ] for name , param in named_parameters : if param . requires_grad : # and ("bias" not in name) : # bias makes std = nan as it is of single parameters magnitude = param . grad . abs ( ) mu_list . append ( magnitude . mean ( ) ) if len ( magnitude ) == 1 : # why nan for single param? Anyway to avoid that.. sig_list . append ( torch . tensor ( 0 ) ) else : sig_list . append ( magnitude . std ( ) ) # if "svp_se" return mu_list , sig_list