Unique values in PyTorch tensor
I'm tying to find distinct values in a PyTorch tensor. Is there an efficient analogue of Tensorflow's unique op?

There is a torch.unique() method in 0.4.0

In torch &lt;= 0.3.1 you can try:

import torch
import numpy as np

x = torch.rand((3,3)) * 10
np.unique(x.round().numpy())

