import torch


def flatten_weights_from_model(model):
    """ Return the weights of the given model as a 1-D tensor """
    weights = torch.tensor([], requires_grad=False)
    for param in model.parameters():
        weights = torch.cat((weights, torch.flatten(param)))
    return weights