def _get_leaf_vec(vec: Dict, selected: np.ndarray) -> np.ndarray:
    """
    From the assignment result of each node, multiply the traversal path from
    the leaf node to obtain the possible selection vector of leaf node.
    Args:
        vec: vectorized information dict in a tree, with reference
             to response vec of function _vectorize_tree
        selected: assignment result for each node, shape: (N, node_num),
                    N is number of data, node_num is the node num in a tree.

    Returns:
        res: the possible leaf node selection vector, shape: (N, leaf_node_num),
             N is number of data, leaf_node_num is the node num in a tree.
    """
    N = selected.shape[0]
    node_num = vec['feature_id'].size

    leaf = np.arange(node_num)[vec['is_leaf']]
    parent = np.tile(vec['parent'], (N, 1))
    row = np.arange(N).repeat(leaf.size).reshape(N, leaf.size)
    leaf_n = np.tile(leaf, (N, 1))

    res = np.ones(leaf_n.shape)
    while leaf_n.sum() != 0:
        tmp = selected[row, leaf_n]
        res = res * tmp
        leaf_n = parent[row, leaf_n]
    return res

    From the assignment result of each node, multiply the traversal path from
    the leaf node to obtain the possible selection vector of leaf node.
    Args:
        vec: vectorized information dict in a tree, with reference
             to response vec of function _vectorize_tree
        selected: assignment result for each node, shape: (N, node_num),
                    N is number of data, node_num is the node num in a tree.

    Returns:
        res: the possible leaf node selection vector, shape: (N, leaf_node_num),
             N is number of data, leaf_node_num is the node num in a tree.
    
fedlearner/model/tree/tree.py