- TensorFlow 2.0 Quick Start Guide
- Tony Holdroyd
- 66字
- 2021-06-24 16:02:05
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)
推薦閱讀
- Julia 1.0 Programming
- Learning Social Media Analytics with R
- Expert AWS Development
- 機器人創新實訓教程
- Photoshop CS3圖像處理融會貫通
- 機器學習流水線實戰
- CentOS 8 Essentials
- 21天學通C語言
- Apache Superset Quick Start Guide
- Mastering Game Development with Unreal Engine 4(Second Edition)
- Citrix? XenDesktop? 7 Cookbook
- 計算機硬件技術基礎(第2版)
- Practical Network Automation
- Flink內核原理與實現
- ARM嵌入式系統開發完全入門與主流實踐