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

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) 
主站蜘蛛池模板: 南木林县| 高州市| 沾益县| 沁阳市| 泾阳县| 铁岭县| 萝北县| 兰考县| 化州市| 将乐县| 平舆县| 永德县| 麦盖提县| 积石山| 沛县| 新乡县| 中方县| 广饶县| 绥宁县| 河北区| 玛纳斯县| 揭阳市| 琼海市| 铜梁县| 绍兴市| 东辽县| 福海县| 云安县| 怀柔区| 潼南县| 林西县| 稻城县| 邯郸市| 长沙县| 葫芦岛市| 南雄市| 依兰县| 天柱县| 九台市| 大洼县| 安吉县|