import torch


def quantile_features(density, q_vals):
    """
    Input
    - density: tensor of shape [n_samples]
    - q_vals: list of numbers between 0 and 1 with the quantiles to use
    
    Output
    - quartile_sigs: tensor of shape [len(q_vals)]
    """    
    q_vals = torch.tensor(q_vals, dtype=density.dtype)
    quantiles = torch.quantile(density, q_vals) 
    return quantiles