View source on GitHub

Sum over subsets of rows in a 2-D tensor.

data 2-D tensor with shape [D1, D2].
group_ids 1-D int tensor with shape [D1].
row_weights 1-D tensor with shape [D1]. Can be None.
name A name for this op. Defaults to 'utils_partition_sums_2d'.

A 2-D tensor with shape [max(group_ids) + 1, D2] where output[i, :] = sum(data[j, :] * weight[j] * 1(group_ids[j] == i)), 1(.) is the indicator function.

ValueError if the inputs have invalid dimensions or types.