Skip to content

[feature request] unique to work on nd tensors via dim arg #9997

@alicanb

Description

@alicanb

Can we have unique to return unique rows and cols as well, similar to numpy.unique? Example usage to give an idea:

>>> a = torch.tensor([[1, 0, 0], [1, 0, 0], [2, 3, 3]])
>>> torch.unique(a)
tensor([0, 1, 2, 3])
>>> torch.unique(a, dim=0)
tensor([[1, 0, 0], [2, 3, 3]])
>>> torch.unique(a, dim=1)
tensor([[1, 0], [1, 0], [2, 3]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    todoNot as important as medium or high priority tasks, but we will work on these.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions