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

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) 
主站蜘蛛池模板: 白山市| 建阳市| 小金县| 利川市| 普兰店市| 上饶县| 山西省| 乳源| 博罗县| 漳州市| 通州市| 谢通门县| 蒲江县| 阳城县| 图们市| 博湖县| 福清市| 临泉县| 长宁县| 杭锦后旗| 安多县| 遂平县| 若尔盖县| 垣曲县| 通渭县| 大安市| 华安县| 湖口县| 山东省| 扬中市| 南川市| 会昌县| 天门市| 开鲁县| 梅州市| 松原市| 昌图县| 绥阳县| 布尔津县| 宁陵县| 岑巩县|