Is that still the case of advanced indexing? For example, is the output tensor below also in pinned memory? I assumed that since now the subset of the tensor has non-contiguous memory, CUDA would have difficulties copying through DMA
>>> x = torch.randn(3,4)
>>> x[range(3), [0,1,2]]
tensor([ 0.0127, -0.2941, -2.1625])

— EDIT—
I just found out that there’s .is_pinned() method I can use to check if the tensor is in pinned memory, and it seems like the above is not pinned.
>>> x = torch.randn(3, 4, pin_memory=True)
>>> x.select(0,1).is_pinned()
True
>>> x[range(3), range(3)].is_pinned()
False