假设我有一个形状为
x
(21, 256, *)
x[:, :48, ...]
上述问题的等价物是使用
torch.index_select
indexes = torch.arange(48) torch.index_select(myTensor, 1, indexes)