pytorch技巧1: 數組排序後復原

pytorch用法1: 數組排序後復原 主要是利用torch.sort函數裏返回的第二個參數index,這個index表示的是排序後的數字在原來數組中的位置。 比如: l = torch.randint(10,(10,)) a, idx1 = torch.sort(l) 結果爲: l: tensor([3., 3., 8., 7., 9., 9., 7., 4., 5., 1.]) a: tens
相關文章
相關標籤/搜索