官术网_书友最值得收藏!

Finding the mean across columns

Find the mean across columns (that is, reduce rows) with this:

tf.reduce_mean(input_tensor=numbers, axis=0) # [ (4. + 7. )/2 , (5. + 3.)/2 ] = [5.5, 4.]

The output will be as follows:

<tf.Tensor: id=61, shape=(2,), dtype=float32, numpy=array([5.5, 4. ], dtype=float32)>

When keepdims is True, the reduced axis is retained with a length of 1:

 tf.reduce_mean(input_tensor=numbers, axis=0, keepdims=True)

The output is as follows:

array([[5.5, 4.]])        (1 row, 2 columns) 
主站蜘蛛池模板: 新安县| 西昌市| 佛冈县| 定西市| 清远市| 垣曲县| 天全县| 黄骅市| 临武县| 中超| 化州市| 嘉善县| 那坡县| 华蓥市| 加查县| 兴安盟| 镇赉县| 淮北市| 扎赉特旗| 罗山县| 锡林郭勒盟| 樟树市| 郓城县| 海林市| 克什克腾旗| 榕江县| 新竹市| 堆龙德庆县| 邻水| 育儿| 蓝田县| 麦盖提县| 得荣县| 彭泽县| 晋江市| 大名县| 武威市| 邵阳市| 冀州市| 丁青县| 垣曲县|