function get_phrases_from_posmap(posmaps, input_ids) {

    const left_idx = 0;
    const right_idx = posmaps.dims.at(-1) - 1;

    const posmaps_list = posmaps.tolist();
    posmaps_list.fill(false, 0, left_idx + 1);
    posmaps_list.fill(false, right_idx);

    const input_ids_list = input_ids.tolist();
    return posmaps_list
        .map((val, idx) => val ? idx : null)
        .filter(idx => idx !== null)
        .map(i => input_ids_list[i]);
}
Get token ids of phrases from posmaps and input_ids.
@param {import('../../utils/tensor.js').Tensor} posmaps A boolean tensor of unbatched text-thresholded logits related to the detected bounding boxes of shape `(hidden_size, )`.
@param {import('../../utils/tensor.js').Tensor} input_ids A tensor of token ids of shape `(sequence_length, )`.