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
相关文章
相关标签/搜索