本文来自 guotong1988 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/guotong1988/article/details/77622790 import tensorflow as tf c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]]) result = tf.segment_sum(c, tf.constant([0, 0, 1]))#第二个参数长度必须为3 result_ = tf.s…