def count_model_parameters(model):
    """Count trainable parameters of a given model

    Args:
    model(object): torch model object

    Returns:
    trainable_parameters(int): number of trainable parameters

    """
    return sum(p.numel() for p in model.parameters() if p.requires_grad)