I have a tensor of values and a corresponding tensor of indices. I want to sum all the values where the index is not a special token (tokenizers).
For instance:

values=tensor([1.0000, 0.1574, 0.1507, 0.2520, 0.2456, 0.2365, 0.2330, 0.2294, 0.2321,
         0.2339], grad_fn=<MaxBackward0>),
indices=tensor([32099,    12,    24,     3,     3,     3,     3,     3,     3,     3])

I want sum(0.1574, 0.1507)
What is the optimal way to achieve this?