Greetings,

I am writing in order to enquire about another feature that I cannot seem to find.

I am wondering if there is a function that could do something alike “unsorted_segment_sum” in tensorflow. I’ll attempt to illustrate the purpose of this function for clarity:

Let’s say you have an array of shape [3,10,22] so a batch of size 3 with 10 elements of size 22. And you want to sum together a number of those elements or their components.

option 1:

Let’s say we want 4 classes from the 10 elements, we would need a list containing the indices for each element that we want to group togher i.e.:[[0,2,4],[1,6,8],[3,5,9],[7]] , and for each of the 3 element of the batch slice the array and sum sequentially using those group of indices.

Option 2:

The second way would be to have something with lenght 10 and to use numbers that would represent each group i.e.: [0,1,0,2,0,2,1,3,1,2]

With either case we would use those to group together the elements with the same number and perform the summation(or whatever function we would need like max, min, mean on them). The output would be either of size [3,4,22] or [4,22] depending if there is broadcasting of the query or not (though in TF the first shape must match so the latter shape is created and permutation/transposition is a necessary workaround to preserve needed dimensions.).

This could be done sequentially but this would be time intensive and not that efficient.

Let me know what you think and if I can clear this up for you.

Thanks.