How to slice multiple spans from a big 1D tensor ...
https://discuss.pytorch.org/t/how-to-slice-multiple-spans-from-a-big-1d-tensor...31.12.2021 · I have a big 1D tensor A, which contains around 20M elements.I also have some spans with unequal lengths, i.e., B=[(s_1, e_1), (s_2, e_2), ..., (s_n, e_n)], where n may be more than 8K. The one-time slicing A[s:e] is very fast, but slicing for all spans in B by for loop is very time consuming. Is there any way to slice parallelly on gpu? My torch version is 1.8.1, and some …