Uploaded image for project: 'AI Platform Core Components'
  1. AI Platform Core Components
  2. AIPCC-8313

Feedback about torch.unique

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • PyTorch
    • None
    • PyTorch Sprint 18, PyTorch Sprint 19, PyTorch Sprint 20, PyTorch Sprint 21, PyTorch Sprint 22, PyTorch Sprint 23, PyTorch Sprint 24

      There is the following issue on this page: https://docs.pytorch.org/docs/stable/generated/torch.unique.html

      The documentation does not mention the important nuance when using the argument dim - since the output has to have equal sizes in the dimensions not specified by dim , we will get some repetitions, rather than a unique set of values, to force all the unique sets to be represented in equal length torch tensors.

      Example:
      ```
      >>> import torch
      >>> x = torch.tensor([[1, 3, 2, 3], [1,2,1,2]], dtype=torch.long)
      >>> torch.unique(x,dim=0)
      tensor([[1, 2, 1, 2],
      [1, 3, 2, 3]])
      >>> torch.unique(x,dim=1)
      tensor([[1, 2, 3],
      [1, 1, 2]])
      ```

      cc @svekars @sekyondaMeta @AlannaBurke

              rh-ee-visgoyal Vishal Goyal
              rh-ee-visgoyal Vishal Goyal
              PyTorch Core
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: