Torch.mode - what does indices hold

Hi All,

Can’t get my head around the return result (indices) - from docs “mode … a value which appears most often in that row, and indices is the index location of each mode value found.”
my test:
#test
a = torch.tensor([4,1,2,3,4,5,4,4,4,5,6,7,8,4,4,9,4])
print(a)
print(a.size())
torch.mode(a)

result
tensor([4, 1, 2, 3, 4, 5, 4, 4, 4, 5, 6, 7, 8, 4, 4, 9, 4])
torch.Size([17])
torch.return_types.mode(
values=tensor(4),
indices=tensor(16))

The indices seem to point to any index containing the mode value. Based on some runs the last index seems to be used, but I guess there is no guarantee to it and any index of the mode value could be returned:

x = torch.zeros(2, 5)
torch.mode(x)
> torch.return_types.mode(
  values=tensor([0., 0.]),
  indices=tensor([4, 4]))