import torch


def ravel_parameters(para_dict):
    """
        parameters: learnable variables only
        para_dict = dict(model.named_parameters())
    """
    return torch.cat([p.detach().view(-1) for n, p in para_dict.items() if p.requires_grad])