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

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) 
主站蜘蛛池模板: 米易县| 秭归县| 廊坊市| 兴山县| 兖州市| 周宁县| 嘉峪关市| 陆川县| 峡江县| 苏尼特右旗| 沙湾县| 商城县| 衡山县| 当雄县| 增城市| 蕉岭县| 美姑县| 定边县| 定安县| 郑州市| 建德市| 乐东| 双江| 烟台市| 安徽省| 吴川市| 阿克| 鹤岗市| 邵东县| 东兰县| 剑河县| 泰兴市| 华阴市| 顺平县| 延津县| 沙洋县| 辽源市| 二连浩特市| 灵寿县| 宁阳县| 井研县|