- 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)
推薦閱讀
- 構建高質量的C#代碼
- 21天學通PHP
- Verilog HDL數字系統設計入門與應用實例
- Apache Hive Essentials
- 精通Excel VBA
- Security Automation with Ansible 2
- WordPress Theme Development Beginner's Guide(Third Edition)
- Embedded Programming with Modern C++ Cookbook
- 工業機器人維護與保養
- Unity Multiplayer Games
- 生成對抗網絡項目實戰
- 人工智能:智能人機交互
- 與人共融機器人的關節力矩測量技術
- Machine Learning with Spark(Second Edition)
- Effective Business Intelligence with QuickSight