Solved by albanD in post #2 
              
              
                Hi, 
I’m afraid that if you have general indices and counts, you won’t be able to do this in a single op. 
You will need a custom kernel that implements this.