def dwn_f_hat(f_hat, nj1):
    """
    downsample f_hat vector to level j - 1 with length Nj1.
    [PyTorch-enabled Function]

    :param f_hat: a matrix of size (d,j1), d-dim feature, nj > nj1, torch tensor format
    :param nj1: length nj1, must be integer
    :return: a vector which components are those of f_hat from 1 to nj1,
                torch tensor format
    """
    f_hat_dwn = f_hat[:, :nj1]
    return f_hat_dwn