- TensorFlow 2.0 Quick Start Guide
- Tony Holdroyd
- 67字
- 2021-06-24 16:02:05
Finding the mean across rows
Find the mean across rows (that is, reduce columns) with this:
tf.reduce_mean(input_tensor=numbers, axis=1) # [ (4. + 5. )/2 , (7. + 3. )/2] = [4.5, 5]
The output will be as follows:
<tf.Tensor: id=64, shape=(2,), dtype=float32, numpy=array([4.5, 5. ], dtype=float32)>
When keepdims is True, the reduced axis is retained with a length of 1:
tf.reduce_mean(input_tensor=numbers, axis=1, keepdims=True)
The output is as follows:
([[4.5], [5]]) (2 rows, 1 column)
推薦閱讀
- MCSA Windows Server 2016 Certification Guide:Exam 70-741
- UTM(統一威脅管理)技術概論
- Expert AWS Development
- JBoss ESB Beginner’s Guide
- 精通特征工程
- Android游戲開發案例與關鍵技術
- Grome Terrain Modeling with Ogre3D,UDK,and Unity3D
- Statistics for Data Science
- 21天學通Linux嵌入式開發
- Web璀璨:Silverlight應用技術完全指南
- 3ds Max造型表現藝術
- 機器人剛柔耦合動力學
- 從機器學習到無人駕駛
- Practical Internet of Things with JavaScript
- 信息技術基礎與應用