@AreTor’s snippet looks to be an example of NumPy “Advanced Indexing” with non-adjacent advanced indexing objects, as described here: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#combining-advanced-and-basic-indexing 246. Unfortunately, we do not have advanced indexing in PyTorch for non-adjacent advanced indexing objects (i.e. in this case the fact that xs and ys are not adjacent.