xtensor
xtensor copied to clipboard
Support for integer Advanced Indexing
It seems that xtensor is lacking a part of one of the three indexing types supported numpy, the integer Advanced Indexing type.
Example for integer advanced index:
From each row, a specific element should be selected. The row index is just [0, 1, 2] and the column index specifies the element to choose for the corresponding row, here [0, 1, 0]. Using both together the task can be solved using advanced indexing:
x = np.array([[1, 2], [3, 4], [5, 6]])
x[[0, 1, 2], [0, 1, 0]]
array([1, 4, 5])
Maybe it should be included in the numpy coverage completion project?
Any updates on if/when this will be implemented? It seems a few other packages (e.g. Pytorch's C++ library) can do it. In the meanwhile an example workaround would be helpful.