我尝试在二维数组的单轴上使用指定的切片执行局部reduce。你知道吗
我使用numpy的numpy.ufunc.reduceat
或numpy.add.reduceat
实现了这一点,但是我想在tensorflow中做同样的事情,因为这个reduce操作的输入是tensorflow卷积的输出。你知道吗
我遇到了tf.math.reduce_sum
,但我不确定如何在我的案例中使用它。你知道吗
如果我能像利用GPU一样在tensorflow中执行reduceat
操作,那就太好了。你知道吗
Tags:
您可以使用^{} 执行几乎相同的操作:
您可以用要使用的归约函数替换上面的^{} 。这和实际的^{} 之间的唯一区别是
indices[i] >= indices[i + 1]
的特殊情况。posted函数要求对indices
进行排序,如果存在indices[i] == indices[i + 1]
的情况,则输出中相应的i
位置将为零,而不是a[indices[i]]
。你知道吗相关问题 更多 >
编程相关推荐