import torch


def make_p(model,
           omega: float):
    """Aggregates added regularization terms into a vector.

    Args:
        model: A (pre-trained) torch.nn.Module or torch.nn.Sequential model.
        omega: The regularization strength (prior variance).

    Returns:
        The regularization vector.
    """
    weight_p = list()
    bias_p = list()
    for module in model.modules():
        if module.__class__.__name__ in ['Linear']:
            w = module.weight
            b = module.bias
            wp = torch.ones(w.numel(), device=w.device) / (omega ** 2 / w.shape[0])
            bp = torch.ones(b.numel(), device=b.device)
            weight_p.append(wp)
            bias_p.append(bp)
    weight_p.extend(bias_p)
    return torch.cat(weight_p)