def np_gather_ijk_index(arr, index):
    """Gather the features of given index from the feature grid.

    Args:
        arr (numpy array): h*w*d*c, feature grid.
        index (numpy array): nx*3, index of the feature grid
    Returns:
        nx*c, features at given index of the feature grid.
    """
    arr_flat = arr.reshape(-1, arr.shape[-1])
    _, j, k, _ = arr.shape
    index_transform = index[:, 0] * j * k + index[:, 1] * k + index[:, 2]
    return arr_flat[index_transform]