def get_params_by_name(model, names):
    """Get params/buffers by name."""
    named_parameters = dict(model.named_parameters())
    named_buffers = dict(model.named_buffers())
    named_vars = {**named_parameters, **named_buffers}
    res = [named_vars[name] for name in names]
    return res