April 17, 2024, 1:35 a.m. | Super Kai (Kazuya Ito)

DEV Community dev.to

unique() can get the zero or more unique elements of a 0D or more D tensor as shown below:


*Memos:




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

  • The 2nd argument with torch or the 1st argument with a tensor is sorted(Default:True). *Currently setting Falseis also sorted.

  • The 3rd argument with torch or the 2nd argument with a tensor is return_inverse(Default:False).

  • The 4th argument with torch or the 3rd argument with a tensor is return_counts(Default:False) which returns the …

function memos pytorch tensor torch true unique

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

Risk Management - Machine Learning and Model Delivery Services, Product Associate - Senior Associate-

@ JPMorgan Chase & Co. | Wilmington, DE, United States

Senior ML Engineer (Speech/ASR)

@ ObserveAI | Bengaluru