April 19, 2024, 11:29 p.m. | Super Kai (Kazuya Ito)

DEV Community dev.to

sort() can get the zero or more sorted elements and their indices of a 0D or more D tensor in ascending(Default) or descending order as shown below:


*Memos:




  • sort() can be called both from torch and a tensor.

  • The 2nd argument(int) with torch or the 1st argument(int) with a tensor is dim(Optional-Defualt:-1) which is a dimension.

  • The 3rd argument(bool) with torch or the 2nd argument(bool) with a tensor is descending(Optional-Default:False). *False is ascending order and True is descending order.

  • The …

argsort memos msort pytorch sort tensor torch

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

Senior Software Engineer, Generative AI (C++)

@ SoundHound Inc. | Toronto, Canada