tensorflow API: tf.unsorted_segment_sum
来源:互联网 发布:如何把json解析出来 编辑:程序博客网 时间:2024/06/01 08:49
unsorted_segment_sum( data, segment_ids, num_segments, name=None)
Computes a tensor such that (output[i] = sum_{j…} data[j…] where the sum is over tuples j… such that segment_ids[j…] == i.
计算一个tensor的输出output[i]等于咱们给的segment_ids[j….]里面所有填i的位置对应到data[j….]的和,意思就是我想对data的j,k,l位置求和放在输出a[0]上,那segment_ids再[j,k,l]上都是0
Unlike SegmentSum, segment_ids need not be sorted and need not cover all values in the full range of valid values.
给出的segment_ids不用像tf.segment_sum一样有序,对data的求和位置可以跨越
If the sum is empty for a given segment ID i, output[i] = 0.
去和为空,那么output[i]为0
num_segments should equal the number of distinct segment IDs
num_segments等于segment_ids里面的划分数,就是分解出来的结果数组的大小。
例子:
a = np.arange(1,10).reshape(3,3)print(a)print('----------')print((sess.run(tf.unsorted_segment_max(data=a,segment_ids=[0,1,0],num_segments=2))))
输出:
Out[20]:array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])----------[[7 8 9] [4 5 6]]
阅读全文
0 0
- tensorflow API: tf.unsorted_segment_sum
- tensorflow API: tf.unsorted_segment_sum
- tensorflow API:tf.truncated_normal
- tensorflow API:tf.set_random_seed
- tensorflow API:tf.split
- tensorflow API:tf.tile
- tensorflow API:tf.slice
- tensorflow API:tf.control_dependencies
- tensorflow API:tf.reduce_sum
- tensorflow API:tf.not_equal
- tensorflow API:tf.argmin
- tensorflow API: tf.concat
- tensorflow API:tf.group
- tensorflow API:tf.Variable
- tf.segment_sum和tf.unsorted_segment_sum实例
- Tensorflow API 学习(1)-tf.concat()
- Tensorflow API 学习(3)-tf.slice()
- Tensorflow API——tf.random_normal_initializer
- 强化学习(Reinforcement Learning, RL)初步介绍
- Vim 使用教程
- c/c++路径为%temp%\\xxx.txt,无法打开文件
- 判断是否是uc或者qq浏览器
- 捕获阶段调用事件处理程序和冒泡阶段调用事件处理程序的区别是什么呢?
- tensorflow API: tf.unsorted_segment_sum
- java static关键词作用解析
- 算法竞赛习题2-2韩信点兵
- js 页面history.back()返回上一页,ios 不重新加载ready的解决办法
- 性能优化之缓存(之前有了解,但是没有认真做,这次找了篇文章,来凑凑)
- java 图片上传的处理,获取图片大小,宽高。
- http缓存
- 通过添加路由的方式解决ping不通网络的问题
- Java爬虫-webmagic