Deep Learning/framework

[Pytorch] torch.sort

개발챙 2021. 5. 22. 23:12
728x90

torch.sort(inputdim=-1descending=Falsestable=False*out=None) -> (TensorLongTensor)

  • input (Tensor) – the input tensor.
  • dim (int, optional) – sort할 차원
  • descending (bool, optional) – 내림차순/올림차순 여부
  • stable (bool, optional) – sorting routine을 안정적으로 만들어 equivalent의 순서가 유지되도록 보장합니다. stable=True only works on the CPU for now.

일반 Python list의 sort와 달리 바뀐 인덱스를 담고 있는 텐서를 반환해주기 때문에, 아주 유용하게 쓸 수 있다

728x90