import torch


def get_flat_params_from(model):
    """
    Get the flattened parameters of the model.

    Args:
        model: the model from which the parameters are derived

    Return:
        flat_param: the flattened parameters
    """
    params = []
    for param in model.parameters():
        params.append(param.data.view(-1))
    flat_params = torch.cat(params)
    return flat_params